rspec_rails_4 icon indicating copy to clipboard operation
rspec_rails_4 copied to clipboard

Ch.9, be_named matcher should use "=="

Open JunichiIto opened this issue 10 years ago • 0 comments

In be_named matcher, eq is used but it fails with message "ArgumentError: wrong number of arguments (1 for 0)". According to the RSpec document, it should be "==".

RSpec::Matchers.define :be_named do |expected|
  match do |actual|
    # not work
    # actual.name eq expected 

    # should be
    actual.name == expected
  end
  description do
    "return a full name as a string"
  end
end

JunichiIto avatar Aug 25 '14 20:08 JunichiIto