未定义的方法“双”为
undefined method `double' for
我在使用 rspec-mock 时遇到问题。
捆绑包列表显示:
Gems included by the bundle:
* CFPropertyList (2.2.8)
* builder (3.2.2)
* bundler (1.7.12)
* ci_reporter (1.9.3)
* diff-lcs (1.2.5)
* excon (0.44.0)
* facter (2.4.0)
* hiera (1.3.4)
* json_pure (1.8.2)
* metaclass (0.0.4)
* mocha (1.1.0)
* puppet (3.7.4)
* puppet-lint (1.1.0)
* puppet-syntax (1.4.1)
* puppetlabs_spec_helper (0.8.2)
* rake (10.4.2)
* rcov (1.0.0)
* rspec (3.1.0)
* rspec-core (3.1.7)
* rspec-expectations (3.1.2)
* rspec-legacy_formatters (1.0.0)
* rspec-mocks (3.1.3)
* rspec-puppet (1.0.1)
* rspec-support (3.1.2)
我的rspec:
require 'spec/spec_helper'
describe 'My behaviour' do
it 'should do something' do
t = double()
end
end
据我所知,我做的一切都是正确的,但是我在测试执行期间不断遇到此类错误:
1) My behaviour should do something
Failure/Error: Unable to find matching line from backtrace
NoMethodError:
undefined method `double' for #<RSpec::ExampleGroups::MyBehaviour:0x10275f168>
# ./spec/puppet/util/network_device/netapp_e/my_example_spec.rb:8
rspec-mocks 中的每个方法也是如此,例如:'allow'、'receive' 等。
有谁知道,为什么会这样?
您是否声明要使用 RSpec 模拟?通常这是在 spec_helper.rb
文件中完成的,如下所示:
RSpec.configure do |config|
config.mock_framework = :rspec
end
我在使用 rspec-mock 时遇到问题。
捆绑包列表显示:
Gems included by the bundle:
* CFPropertyList (2.2.8)
* builder (3.2.2)
* bundler (1.7.12)
* ci_reporter (1.9.3)
* diff-lcs (1.2.5)
* excon (0.44.0)
* facter (2.4.0)
* hiera (1.3.4)
* json_pure (1.8.2)
* metaclass (0.0.4)
* mocha (1.1.0)
* puppet (3.7.4)
* puppet-lint (1.1.0)
* puppet-syntax (1.4.1)
* puppetlabs_spec_helper (0.8.2)
* rake (10.4.2)
* rcov (1.0.0)
* rspec (3.1.0)
* rspec-core (3.1.7)
* rspec-expectations (3.1.2)
* rspec-legacy_formatters (1.0.0)
* rspec-mocks (3.1.3)
* rspec-puppet (1.0.1)
* rspec-support (3.1.2)
我的rspec:
require 'spec/spec_helper'
describe 'My behaviour' do
it 'should do something' do
t = double()
end
end
据我所知,我做的一切都是正确的,但是我在测试执行期间不断遇到此类错误:
1) My behaviour should do something
Failure/Error: Unable to find matching line from backtrace
NoMethodError:
undefined method `double' for #<RSpec::ExampleGroups::MyBehaviour:0x10275f168>
# ./spec/puppet/util/network_device/netapp_e/my_example_spec.rb:8
rspec-mocks 中的每个方法也是如此,例如:'allow'、'receive' 等。 有谁知道,为什么会这样?
您是否声明要使用 RSpec 模拟?通常这是在 spec_helper.rb
文件中完成的,如下所示:
RSpec.configure do |config|
config.mock_framework = :rspec
end