Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I mark a Capybara feature test as pending?

I expect these tests not to "FAIL", but be marked as pending. Perhaps I am not using pending or the correct directive for Capybara specifically?

feature 'Tenant Scoping ' do

  scenario "displays only Tenant A's things" do
    pending
  end

  scenario "displays only Tenant B's things" do
    pending
  end

end

Here's the output when run:

Tenant Scoping
  displays only Tenant A's things (FAILED - 1)
  displays only Tenant B's things (FAILED - 2)

Failures:

  1) Tenant Scoping  displays only Tenant A's things FIXED
     Expected pending 'No reason given' to fail. No Error was raised.
     # ./spec/features/tenants/scopingtest_spec.rb:3

  2) Tenant Scoping  displays only Tenant B's things FIXED
     Expected pending 'No reason given' to fail. No Error was raised.
     # ./spec/features/tenants/scopingtest_spec.rb:7

Finished in 0.04047 seconds (files took 1.62 seconds to load)
2 examples, 2 failures
like image 823
typeoneerror Avatar asked Aug 01 '14 01:08

typeoneerror


2 Answers

Just replace 'scenario' with 'xscenario'.

Only drawback is that it will mark the entire feature as pending, instead of each individual spec. I have not found a way around this.

like image 167
Phil Avatar answered Nov 07 '22 08:11

Phil


As of RSpec 3, pending examples are considered a failure if they pass. Try using skip instead of pending to completely skip those specs.

See Notable Changes in RSpec 3 for more info.

like image 10
Dylan Markow Avatar answered Nov 07 '22 10:11

Dylan Markow