Prashanth Sams Prashanth Sams - 5 months ago 29
Ruby Question

How to ignore or skip a test method using RSpec?

please guide how to disable one of the below test methods using RSpec. I am using Selenuim WebDriver + RSpec combinations to run tests.

require 'rspec'
require 'selenium-webdriver'

describe 'Automation System' do

before(:each) do
###
end

after(:each) do
@driver.quit
end

it 'Test01' do
#positive test case
end

it 'Test02' do
#negative test case
end
end

Answer

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
Comments