To add a collaborator to this project you will need to use the Relish gem to add the collaborator via a terminal command. Soon you'll be able to also add collaborators here!More about adding a collaborator
Historically, rspec-mocks has used a monkey-patched syntax to allow you to mock or stub any object:
Unfortunately, this is prone to weird, confusing failures when applied to delegate/proxy objects. For a method like
stub to work properly, it must be defined on every object in the
system, but RSpec does not own every object in the system and cannot ensure that it always
For this reason, in RSpec 2.14, we introduced a new syntax that avoids monkey patching
altogether. It's the syntax shown in all examples of this documentation outside of this
directory. As of RSpec 3, we consider this to be the main, recommended syntax of rspec-
mocks. The old monkey-patched syntax continues to work, but you will get a deprecation
warning if you use it without explicitly opting-in to it:
# If you're using rspec-core: RSpec.configure do |config| config.mock_with :rspec do |mocks| mocks.syntax = :should end end # Or, if you're using rspec-mocks in another context: RSpec::Mocks.configuration.syntax = :should
We have no plans to ever kill the old syntax, but we may extract it into an external gem in
If you have an old project that uses the old syntax and you want to update it to the current
syntax, checkout transpec.
Last published over 2 years ago by Jon Rowe.
RSpec Mocks settings