undefined method 'assert_equal' for #<RSpec::Core::ExampleGroup::Nested_1:0x8d6f75c>创业板列表
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发布于 2013-04-14 20:48:27
请尝试使用object.should eq('foo')或expect(object).to eq('foo')。顺便说一句,当使用-w标志运行时,object.should == 'foo'会给你一个Ruby警告。
另外,这是一个假设的答案,因为你没有给我们任何实际的代码。
发布于 2014-09-11 23:43:27
不需要更改spec文件中的所有行,您可以将这些行添加到顶部
require_relative '../spec_config'并在该文件中放入:
RSpec.configure do |config|
config.expect_with :minitest
end因为minitest有assert_equal方法。抱歉,我来晚了,我只是在寻找答案,碰巧看到了这个。
发布于 2013-04-14 20:46:15
你可以试试object.should == "something"。在这里,object指的是您要测试的对象。
https://stackoverflow.com/questions/15999165
复制相似问题