Question

it 'should be an array and not be empty' do
  pending
  expect(a.class).to be(Array)
  expect(a.empty?).to be(false)
  expect(a.first.class).to be(ExampleClass)
end

When I run rspec:

Failures:

  1) should be an array and not be empty FIXED
     Expected pending 'No reason given' to fail. No Error was raised.
     # ./spec/example_spec.rb:19

Any ideas why this is being listed as a failure?

Was it helpful?

Solution

As of Rspec 3.x, pending specs are actually run, and if they pass, it's considered a failure (because if it passes, then Rspec thinks it shouldn't be pending).

You can use skip instead of pending to make sure your spec doesn't actually run.

More info: http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#changes_to__semantics_and_introduction_of_

OTHER TIPS

Here's your clue:

should be an array and not be empty FIXED

Things that pass will cause a pending test to fail. Check the docs for examples [1], [2].

  1. RSpec 2
  2. RSpec 3
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top