Permalink
Commits on Apr 4, 2013
  1. @myronmarston

    Clarify relationship between different method stub actions.

    In 2.13.0 only `and_yield` and `and_return` could be combined, since
    that was the only combination case that was specified by an example.
    This was a regression, as reported by a user in #230.
    
    I tried here to fully specify all of the various combinations of stub 
    actions. Notes:
    
    * `and_return`, `and_raise` and `and_throw` are "terminal" actions
      in the sense that they terminate the method. They _must_ happen last
      and it is impossible to support more than one of these. Hence, we allow
      only one of these, and allow them to be overridden. We also return `nil`
      from these methods to discourage further stub configuration.
    * `and_call_original` is a special case that doesn't make sense to be
      combined with any of the others. Once you've set it up, this causes
      any further instructions to raise an error.
    * `and_yield` is treated as an "initial" action. Yielding doesn't exit
      a method the way the terminal actions do. It is the only initial action.
      Calling it multiple times sets up multiple yields.
    * Setting a block implementation (possible by passing a block to almost
      any method on the fluent interface) sets the block as the "inner" action.
      It runs between the configured yields (if there are any) and the configured
      terminal action (if there is one). My thinking here is that in many cases,
      users use a block implementation to specify a return value, essentially
      making it like a terminal action (so it should come after the `and_yield`
      actions), but in other cases, the user may just use a block for a side
      effect, and may configure an terminal action as well. Only one block
      implementation is supported and it can be overridden.
    myronmarston committed Mar 12, 2013
  2. @myronmarston

    Refactor implementation pieces in prep for #230.

    This splits each implementation piece into a separate object
    so that it is easier to combine them.
    myronmarston committed Mar 6, 2013
Commits on Apr 3, 2013
  1. @myronmarston

    Merge pull request #265 from rspec/refactor_any_instance

    Externalize `any_instance` methods and state like we did mock proxies.
    myronmarston committed Apr 3, 2013
  2. @myronmarston

    Externalize `any_instance` methods and state like we did mock proxies.

    This is similar to #250, but doing a similar refactoring for `any_instance`.
    myronmarston committed Apr 3, 2013
Commits on Apr 2, 2013
  1. @myronmarston
  2. @myronmarston

    Merge pull request #260 from craiglittle/throw-args-ambiguity

    Remove throw arguments ambiguity
    myronmarston committed Apr 2, 2013
  3. @myronmarston

    Make specs less brittle.

    `expect { }.not_to raise_error(ErrorClass)` is brittle because
    the expectation passes if the block raises any other kind of error,
    which could silence other expectation failures or fat-fingered
    method names.
    myronmarston committed Apr 2, 2013
  4. @myronmarston

    Merge pull request #255 from samphippen/better-at-least-expected-message

    Give a better error message with .at_least(3).times style expectations
    myronmarston committed Apr 2, 2013
  5. @myronmarston

    Merge pull request #262 from rspec/marshal_dump

    Marshal.dump operates correctly even when space has yet to be initialized
    myronmarston committed Apr 2, 2013
  6. @alindeman
Commits on Mar 31, 2013
  1. @craiglittle

    Remove throw arguments ambiguity

    When running the specs for another project with the -w flag, I was
    receiving the following warning:
    
    rspec/mocks/message_expectation.rb:145: warning: `*' interpreted as argument prefix
    
    This patch adds parentheses to remove the ambiguity of *.
    craiglittle committed Mar 31, 2013
  2. @samphippen

    Remove some better messages todos

    Signed-off-by: Sam Phippen <samphippen@googlemail.com>
    samphippen committed Mar 31, 2013
  3. @samphippen

    Make at_least and at_most expect messages instead of classes.

    Signed-off-by: Sam Phippen <samphippen@googlemail.com>
    samphippen committed Mar 31, 2013
  4. @samphippen

    Fix a cuke related to the new at_least at_most output

    Signed-off-by: Sam Phippen <samphippen@googlemail.com>
    samphippen committed Mar 31, 2013
  5. @samphippen

    Add a changelog entry for the new received expectation message

    Signed-off-by: Sam Phippen <samphippen@googlemail.com>
    samphippen committed Mar 31, 2013
  6. @samphippen

    Break up a monster line in the mocks error generator

    Signed-off-by: Sam Phippen <samphippen@googlemail.com>
    samphippen committed Mar 31, 2013
  7. @samphippen

    Make the specs pass

    Signed-off-by: Sam Phippen <samphippen@googlemail.com>
    samphippen committed Mar 31, 2013
  8. @myronmarston

    Merge pull request #259 from rspec/fix_proxy_for_basic_object

    BasicObject defines #__id__ but not #object_id.
    myronmarston committed Mar 31, 2013
  9. @myronmarston

    On 1.9.2, BasicObject does not define __id__.

    This was added in 1.9.3:
    
    http://bugs.ruby-lang.org/projects/rurema/repository/revisions/5085
    
    So, in order to support mocking or stubbing a BasicObject-based proxy
    in 1.9.2, we need some special handling.
    myronmarston committed Mar 31, 2013
  10. @myronmarston

    object_id => __id__

    I forgot to change it here.
    myronmarston committed Mar 31, 2013
  11. @myronmarston

    BasicObject defines #__id__ but not #object_id.

    Thus, we need to use #__id__ as the object id.
    myronmarston committed Mar 31, 2013
Commits on Mar 30, 2013
  1. @myronmarston

    Merge pull request #257 from marcandre/ruby_21

    Ruby 2.1 compatibility
    myronmarston committed Mar 30, 2013
  2. @marcandre
  3. @marcandre
Commits on Mar 29, 2013
  1. @dchelimsky
  2. @samphippen

    Give a better error message with .at_least(3).times style expectations

    Signed-off-by: Sam Phippen <samphippen@googlemail.com>
    samphippen committed Mar 29, 2013
  3. @myronmarston
  4. @myronmarston
  5. @myronmarston
  6. @myronmarston

    Deal with our recent changes to __mock_proxy in master.

    Proxies are no longer held internally in each mock'd object.
    myronmarston committed Mar 29, 2013
  7. @myronmarston
Commits on Mar 28, 2013
  1. @myronmarston

    Changelog entry for #250.

    [ci skip]
    myronmarston committed Mar 28, 2013
  2. @myronmarston

    Merge pull request #250 from rspec/externalize_methods_and_mock_state

    Externalize methods and state that was previously held on all objects.
    myronmarston committed Mar 28, 2013
  3. @myronmarston
  4. @myronmarston

    RSpec::Mocks.space.mock_proxy_for => RSpec::Mocks.proxy_for

    ...for a bit shorter, nicer API.
    myronmarston committed Mar 28, 2013