Correct way of testing “associations” with Rspec?

前端 未结 4 1556
情深已故
情深已故 2021-01-30 20:49

I am trying to test the following scenario:

-> I have a model called Team which it just makes sense when it has been created by a User. Therefore, each Team instance has

4条回答
  •  故里飘歌
    2021-01-30 21:23

      it { Idea.reflect_on_association(:person).macro.should  eq(:belongs_to) }
      it { Idea.reflect_on_association(:company).macro.should eq(:belongs_to) }
      it { Idea.reflect_on_association(:votes).macro.should   eq(:has_many) }
    

提交回复
热议问题