I'm making a mock for some Object with RSpec and rspec-mocks. What I dis is the below.
In Spec file
describe 'foo' do
before do
Mock.start
end
end
In Mock file
module Mock
def self.start
SomeClass.stub_chain(:foo).and_return(Mock.mock_create)
end
def self.mock_create
return json
end
end
But if I use stub_chain
, the below deprecation warning occurs.
Using `stub_chain` from rspec-mocks' old `:should` syntax without explicitly enabling the syntax is deprecated. Use the new `:expect` syntax or explicitly enable `:should` instead.
Do you have any ideas which solve this warning?
The allow
method looks unuseful because I wanna code like Object.something_instead_of_stub_chain(:create).and_return(Mock.mock_create)
.