--
You received this message because you are subscribed to the Google Groups "rspec" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rspec+un...@googlegroups.com.
To post to this group, send email to rs...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rspec/29269646.tYJQcMUKxg%40linux-wzza.site.
For more options, visit https://groups.google.com/d/optout.
Hi Arup,
try doing this in your foo_spec.rb
describe Foo dobefore { allow(Foo).to receive(:baz).and_return(20) }
# all other lines as they areend
This feature is sometimes
useful when working with legacy code, though in general we
discourage its use for a number of reasons:
rspec-mocks API is designed for
individual object instances, but this feature operates on entire
classes of objects. As a result there are some sematically
confusing edge cases. For example, in expect_any_instance_of(Widget).to
receive(:name).twice it
isn't clear whether each specific instance is expected to
receive name twice, or if two
receives total are expected. (It's the former.)rspec-mocks, and
has historically received the most bug reports. (None of the
core team actively use it, which doesn't help.))
To view this discussion on the web visit https://groups.google.com/d/msgid/rspec/CANS3KkK%2BOX_A%3D%2Br8xGcLKK%2BPt%3DFs42hDhKW5%3DHpf4cK2dfG9FQ%40mail.gmail.com.