更改有效的测试,例如:
describe "a" do
it "does part A" do
it "does not wait if not run in parallel" do
ParallelTests.should_not_receive(:sleep)
ParallelTests.wait_for_other_processes_to_finish
end
end
end
Run Code Online (Sandbox Code Playgroud)
至
describe "a" do
it "does not wait if not run in parallel" do
expect(ParallelTests).to_not receive(:sleep)
ParallelTests.wait_for_other_processes_to_finish
end
end
Run Code Online (Sandbox Code Playgroud)
给
Failure/Error: expect(ParallelTests).to_not receive(:sleep)
NoMethodError:
undefined method `receive' for
#<RSpec::Core::ExampleGroup::Nested_1::Nested_3:0x00000002874158>
Run Code Online (Sandbox Code Playgroud)
这是一个例子.发生在许多地方,共同的主题是,它总是要改变.should_receive到expect().to receive
Gemfile的版本为2.4的rspec
怎么修?
expect根据http://myronmars.to/n/dev-blog/2013/07/rspec-2-14-is-released,在RSpec 2.14中引入了消息期望语法的使用.(注意:根据建议的http://semver.org/,RSpec 2.4是比RSpec 2.14 更早的十个次要版本.)
将Gemfile更改为2.14,例如gem 'rspec', '2.14'并执行bundle
| 归档时间: |
|
| 查看次数: |
4188 次 |
| 最近记录: |