How to ignore or skip a test method using RSpec? How to ignore or skip a test method using RSpec? ruby ruby

How to ignore or skip a test method using RSpec?


You can use pending() or change it to xit or wrap assert in pending block for wait implementation:

describe 'Automation System' do  # some code here  it 'Test01' do     pending("is implemented but waiting")  end  it 'Test02' do     # or without message     pending  end  pending do    "string".reverse.should == "gnirts"  end  xit 'Test03' do     true.should be(true)  end    end


Another way to skip tests:

# feature testscenario 'having js driver enabled', skip: true do  expect(page).to have_content 'a very slow test'end# controller specit 'renders a view very slow', skip: true do  expect(response).to be_very_slowend

source: rspec 3.4 documentation


Here is an alternate solution to ignore (skip) the above test method (say, Test01) from sample script.

describe 'Automation System' do  # some code here  it 'Test01' do     skip "is skipped" do     ###CODE###     end  end  it 'Test02' do     ###CODE###           end    end