开发者

Failing an entire context with Shoulda Unit Tests

开发者 https://www.devze.com 2023-01-13 10:34 出处:网络
Using shoulda with unit/test I have a context which requires one test to pass before the others are even tried.

Using shoulda with unit/test I have a context which requires one test to pass before the others are even tried.

Is there a method I can invoke which will fail all following tests in the current context? Or not even run them?

I'm imagining something like:

context "My thing" do
 开发者_运维技巧 setup do
    my_variable = false
  end

  should "have my_variable as true" do
    assert_or_contextflunk my_variable
  end
end

(Obviously this is a pointless example, but you see what I'm trying to do)


Add a pending block to your setup method.

setup do
  pending ('This will be tested later')
  my_variable = false
end

See the Pending Examples section of http://rspec.info/documentation/ for further.

0

精彩评论

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