ahmet
ahmet

Reputation: 5005

rspec assert_equal no method error

undefined method 'assert_equal' for #<RSpec::Core::ExampleGroup::Nested_1:0x8d6f75c>

gem list

bundler (1.3.5)
diff-lcs (1.2.3)
rspec (2.13.0)
rspec-core (2.13.1)
rspec-expectations (2.13.0)
rspec-mocks (2.13.1)
test-unit (2.5.4)

spec_helper.rb

require './lib/checkout.rb'
require './lib/product.rb'
require 'rspec'

RSpec.configure do |config|
  config.treat_symbols_as_metadata_keys_with_true_values = true
  config.run_all_when_everything_filtered = true
  config.filter_run :focus
end

Upvotes: 2

Views: 1871

Answers (3)

Douglas G. Allen
Douglas G. Allen

Reputation: 2261

Rather than change all your lines in a spec file you can add these at the top

 require_relative '../spec_config'

and in that file put:

RSpec.configure do |config|
  config.expect_with :minitest
end

because minitest has assert_equal method. Sorry I'm so late but I was just looking for answer myself to something and just happened to see this.

Upvotes: 2

tbuehlmann
tbuehlmann

Reputation: 9110

Try object.should eq('foo') or expect(object).to eq('foo') instead. As a side note, object.should == 'foo' will give you a Ruby warning when running with the -w flag.

Also, this is an assumption answer since you didn't give us any actual code.

Upvotes: 4

Ashish Bista
Ashish Bista

Reputation: 4693

You can try object.should == "something". Here object means the object you want to test.

Upvotes: 1

Related Questions