내 모델에이 코드가 있습니다. Rspec 테스트 belongs_to with shoulda_matchers
belongs_to :user, -> { includes :user_profile }
나는 내가 그
proc
포함
includes
부분을 테스트 할 수있는 방법을 발견하지 않았다
shoulda doc 통해 갔다. 도와주세요.
describe 'user' do
let(:car) { create_car_somehow }
it 'preloads the user_profile association' do
expect(car.user.association(:user_profile)).to be_loaded
end
end
#association
반환의 메타 데이터 :
AFAIK –