开发者

How can I reduce rspec test dependency?

If 1 test fails, tons of others do. How could I change this so that the other checks (the开发者_运维技巧 "it's") below only get done if should be_valid is true, i.e. how can I nest the following "it"'s. I can create a different context for all the other ones and have be_valid on its own but how do I ensure that they are dependent (in a good way in this case! e.g. they won't run).

describe Gorilla do
  context "is valid" do
    subject { Factory.build(:gorilla) }
    it { should be_valid }
    it { should have_many :gorilla_memberships}
    it { should have_many(:gorilla_groups).through(:gorilla_memberships) }
    it { should have_many :gorilla_observations }
    it { should have_one(:avatar).through(:gorilla_observations) }
    it { should have_one(:noseprint).through(:gorilla_observations) }
...


There is no explicit support for creating any sort of relationship between examples in rspec.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜