测试关联模型是否存在

Test that associated model exists

一个用户有一个个人资料。配置文件是在创建用户后创建的。如何使用 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

你可能不能写成一行。这是我的想法 -

let(:user) { FactoryGirl.create(:student) }
subject { user }
it { is_expected.to be_valid }
expect(user.profile).to be_present