views:

33

answers:

1

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)

A: 

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.

Jason Noble
I didn't realise shoulda could be used with RSpec too — I'm actually using unit/test and I can't find any mention of `pending` in the documentation for it - sorry!
JP
http://github.com/jm/pending looks promising. Adds pending test for unit/test.
Jason Noble