everydayrails / rails-4-1-rspec-3-0

Code samples for Everyday Rails Testing with RSpec, Rails 4.1/RSpec 3.0 edition
272 stars 229 forks source link

Ch.3 eq != eql #37

Open JunichiIto opened 9 years ago

JunichiIto commented 9 years ago

You wrote "RSpec requires eq or eql, not ==, to indicate an expectation of equality.". However, eq and eql are not interchangeable. This expression might lead misunderstanding. I think you don't have to mention eql here.

https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers

  it "is equal to a float of the same value" do
    expect(5).to eq(5.0)
  end

  it "is not equal to a float of the same value" do
    expect(5).not_to eql(5.0)
  end