Question

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)

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top