Reputation:
I just picked up a RSpec book to read and I have this example, all in one file:
class RSpecGreeter
def greet
'howdy purdy'
end
end
describe 'RSpec Greeter' do
it 'should say howdy purdy when it receives the greet() message'
greeter = RSpecGreeter.new
greeting = greeter.greet
greeting.should == 'howdy purdy'
end
So when I run it the book says it should pass and it makes sense, it should pass. But for me it shows as "pending"
Pending: RSpec Greeter should say howdy purdy when it receives the greet() message # Not yet implemented # ./greeter_spec.rb:8
Finished in 0.00012 seconds 1 example, 0 failures, 1 pending
Upvotes: 0
Views: 117
Reputation: 11107
It's because you did not wrap the it statement in a block. To correct this you write
describe 'RSpec Greeter' do
it 'should say howdy purdy when it receives the greet() message' do
greeter = RSpecGreeter.new
greeting = greeter.greet
greeting.should == 'howdy purdy'
end
end
For more on pending examples.
And more advanced examples of pending tests as well.
Upvotes: 3