Krish13287
Krish13287

Reputation: 198

Rspec undefined method 'matches?' error

I tried to create a simple test suite in Rspec.

require "selenium-webdriver"
require "rspec"

describe "User" do
  before (:all) do
    @ch = Selenium::WebDriver.for :chrome
  end
  it should "navigate to open2test" do
    @ch.get"http://www.open2test.org/"
  end
  it should "enter user name and email" do
    @ch.find_element(:id, "name").send_keys "jack"
    @ch.find_element(:id, "emailID").send_keys "[email protected]"
  end
end

While executing rspec file_name.rb, I get:

"rspec/expectations/handler.rb:50:in `block in handle_matcher': undefined method `matches?' for "navigate to open2test":String (NoMethodError)"

Kindly update what I am missing.

Upvotes: 1

Views: 2321

Answers (1)

Santhosh
Santhosh

Reputation: 29124

You are calling both it and should methods.

it should "navigate to open2test" do

You should call only it here as you are using RSpec

it "should navigate to open2test" do
  # assert something
end

Note that shoulda has the below syntax with Test::Unit

should "do something" do
  # assert something
end 

Upvotes: 2

Related Questions