gpt4 book ai didi

ruby-on-rails - rspec assert_equal 没有方法错误

转载 作者:数据小太阳 更新时间:2023-10-29 08:23:46 36 4
gpt4 key购买 nike

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

最佳答案

试试 object.should eq('foo')expect(object).to eq('foo')。作为旁注,object.should == 'foo' 将在使用 -w 标志运行时向您发出 Ruby 警告。

此外,这是一个假设答案,因为您没有给我们任何实际代码。

关于ruby-on-rails - rspec assert_equal 没有方法错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15999165/

36 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com