Reputation: 205
A user has one profile. The profile was created after creating the user. How can I test that the profile exists using rspec?
let(:user) { FactoryGirl.create(:student) }
subject { user }
it { is_expected.to be_valid }
it { is_expected.to (#profile exist)) # I don't know what goes here
Upvotes: 0
Views: 65
Reputation: 118271
You probably can't write it in one line. Here is my thought -
let(:user) { FactoryGirl.create(:student) }
subject { user }
it { is_expected.to be_valid }
expect(user.profile).to be_present
Upvotes: 1