Reputation: 9329
Is there a way to indicate that an rspec example is expected to fail?
My code includes a workaround for a bug in a 3rd party library. I would like to include a check that the bug in the library exists. However a normal test might suggest to someone that the bug is desired behaviour, so rather than check for the bug existing, I want to check that it doesn't exist, and mark it as "expected failure".
Then if the bug is later fixed, I'll know and will be able to take out the workaround.
Is there a way to do this in rspec?
Upvotes: 1
Views: 1463
Reputation: 5081
Check out pending with block feature. It reverts example status -- it is green as long as expectations inside block are failing.
describe "an example" do
it "is implemented but waiting" do
pending("something else getting finished")
raise "this is the failure"
end
end
Upvotes: 2