2014-01-21 3 views
4

"위하여"를 했어야 매처 (matcher) "have_many"4 구문 :
it {should have_many(:items).order(:position)}레일은 내 사용자 모델을위한 레일 4 확인을

: has_many :items, -> { order(:position) }

나는 다음과 같은 했어야 정규 작동 할 것으로 예상

그러나이 오류가 발생합니다 : Expected User to have a has_many association called items (items should be ordered by position)


는 TES 내 구문이 잘못인가를 티?

답변

3

이것이 작동하지 않는 v2.4.0의 버그가있었습니다. 이 문제는 v2.5.0에서 수정되었으므로 확인하십시오!

자세한 내용은 여기를 참조하십시오. https://github.com/thoughtbot/shoulda-matchers/issues/388

+0

감사합니다. 그것이 문제였습니다. –

+0

@MichaelvanHolst [accept] (http://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work) 올바른 경우 답변 – gotva

+0

@MichaelvanHolst @MichaelvanHolst 님이 답변을 수락하면 다른 사용자 이것 좀 봐? –