Failing an entire context with Shoulda Unit Tests
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.
精彩评论