gems rspec-mocks 2.14.0

latest releases: 3.13.2, 3.13.1, 3.13.0...
11 years ago

2.14.0 / 2013-07-06

full changelog

Enhancements:

  • Document test spies in the readme. (Adarsh Pandit)
  • Add an array_including matcher. (Sam Phippen)
  • Add a syntax-agnostic API for mocking or stubbing a method. This is
    intended for use by libraries such as rspec-rails that need to mock
    or stub a method, and work regardless of the syntax the user has
    configured (Paul Annesley, Myron Marston and Sam Phippen).

Bug Fixes:

  • Fix double so that it sets up passed stubs correctly regardless of
    the configured syntax (Paul Annesley).
  • Allow a block implementation to be used in combination with
    and_yield, and_raise, and_return or and_throw. This got fixed
    in 2.13.1 but failed to get merged into master for the 2.14.0.rc1
    release (Myron Marston).
  • Marshal.dump does not unnecessarily duplicate objects when rspec-mocks has
    not been fully initialized. This could cause errors when using spork or
    similar preloading gems (Andy Lindeman).

2.14.0.rc1 / 2013-05-27

full changelog

Enhancements:

  • Refactor internals so that the mock proxy methods and state are held
    outside of the mocked object rather than inside it. This paves the way
    for future syntax enhancements and removes the need for some hacky
    work arounds for any_instance dup'ing and YAML serialization,
    among other things. Note that the code now relies upon __id__
    returning a unique, consistent value for any object you want to
    mock or stub (Myron Marston).
  • Add support for test spies. This allows you to verify a message
    was received afterwards using the have_received matcher.
    Note that you must first stub the method or use a null double.
    (Joe Ferris and Joël Quenneville)
  • Make at_least and at_most style receive expectations print that they were
    expecting at least or at most some number of calls, rather than just the
    number of calls given in the expectation (Sam Phippen)
  • Make with style receive expectations print the args they were expecting, and
    the args that they got (Sam Phippen)
  • Fix some warnings seen under ruby 2.0.0p0 (Sam Phippen).
  • Add a new :expect syntax for message expectations
    (Myron Marston and Sam Phippen).

Bug fixes

  • Fix any_instance so that a frozen object can be dup'd when methods
    have been stubbed on that type using any_instance (Jon Rowe).
  • Fix and_call_original so that it properly raises an ArgumentError
    when the wrong number of args are passed (Jon Rowe).
  • Fix double on 1.9.2 so you can wrap them in an Array
    using Array(my_double) (Jon Rowe).
  • Fix stub_const and hide_const to handle constants that redefine send
    (Sam Phippen).
  • Fix Marshal.dump extension so that it correctly handles nil.
    (Luke Imhoff, Jon Rowe)
  • Fix isolation of allow_message_expectations_on_nil (Jon Rowe)
  • Use inspect to format actual arguments on expectations in failure messages (#280, Ben Langfeld)
  • Protect against improperly initialised test doubles (#293) (Joseph Shraibman and Jon Rowe)

Deprecations

  • Deprecate stub and mock as aliases for double. double is the
    best term for creating a test double, and it reduces confusion to
    have only one term (Michi Huber).
  • Deprecate stub! and unstub! in favor of stub and unstub
    (Jon Rowe).
  • Deprecate at_least(0).times and any_number_of_times (Michi Huber).

Don't miss a new rspec-mocks release

NewReleases is sending notifications on new releases.