Permalink
Commits on Apr 7, 2013
  1. @myronmarston

    2.13.1 release.

    myronmarston committed Apr 7, 2013
Commits on Apr 4, 2013
  1. @myronmarston

    Fix travis CI build.

    Fix travis CI build.
    
    - Bundler 1.3 needs rbconfig to be required to run `bin/rspec` after
      installing with `--standalone --binstubs`.
      bundler/bundler#2382
    - The Travis VMs no longer have 32-bit JVMs available. Aruba 0.4.11
      forced the -d32 flag. 0.5 just documents it and makes a file available
      to require that will set it. We've updated Aruba here so that the jruby
      ENV vars aren't set automatically; we've kept the flag to disable JIT
      but removed -d32.
    myronmarston committed Mar 12, 2013
  2. @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
  3. @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 Feb 23, 2013
  1. @myronmarston

    2.13.0 release

    myronmarston committed Feb 23, 2013
  2. @myronmarston
  3. @dchelimsky
  4. @dchelimsky
  5. @dchelimsky
Commits on Feb 21, 2013
  1. @myronmarston
Commits on Feb 18, 2013
  1. @myronmarston

    Better fix for SimpleDelegator subclasses (#219).

    My last fix did not properly simulate SimpleDelegator since it mixes in
    a dup of Kernel and not Kernel itself.  This actually fixes it, and I
    also fixed `and_call_original` (which suffered from the same bug) for
    this case as well.
    myronmarston committed Feb 18, 2013
  2. @dchelimsky

    Only run example with BasicObject when BasicObject is defined.

    It's not in Ruby < 1.9.
    dchelimsky committed Feb 18, 2013
  3. @myronmarston
  4. @myronmarston

    Add changelog entry for #223.

    [ci skip]
    myronmarston committed Feb 18, 2013
  5. @myronmarston

    Merge pull request #223 from RyanonRails/unstub_any_instance

    disallow unstub! on any_instance
    myronmarston committed Feb 18, 2013
  6. @myronmarston

    Rename MessageImplementation to Implementation.

    See #221 (comment) for the surrounding discussion.
    myronmarston committed Feb 18, 2013
  7. @myronmarston
  8. @myronmarston

    Add changelog entry for #226.

    [ci skip]
    myronmarston committed Feb 18, 2013
  9. @myronmarston

    Fix missing_default_stub_error message so array args are handled prop…

    …erly.
    
    The source of this bug is that `raise_similar_message_args_error` receives
    a list of args from multiple calls, e.g.:
    
    foo.bar("a")
    foo.bar(2, 3)
    
    translates to `[["a"], [2, 3]]` being passed to it.  For the other `raise_...` methods, they receive an args list from a single call
    (e.g. just `["a"]` for the first call in the example above).
    
    `raise_similar_message_args_error` has slightly different logic to handle
    the fact that it is different, but when `raise_missing_default_stub_error`
    was added in 409955f, it wrongly copied this logic.
    
    Fixes #226.
    myronmarston committed Feb 18, 2013
Commits on Feb 17, 2013
  1. @myronmarston

    rbx-18 is failing with strange errors on travis.

        
    Missing or uninitialized constant: RbConfig (NameError)
        
    I don't have the energy to fight with it now :(.
    myronmarston committed Feb 17, 2013
Commits on Feb 15, 2013
  1. @myronmarston

    Update changelog [ci skip].

    myronmarston committed Feb 15, 2013
  2. @myronmarston

    Do not call `#nil?` extra times.

    ...in case `nil?` is expected a set number of times.
    
    Fixes #224.
    myronmarston committed Feb 15, 2013
Commits on Feb 13, 2013
  1. @myronmarston

    Merge pull request #225 from pjambet/use_new_codeclimate_shield

    Use new Codeclimate badge, made by @olivierlacan
    myronmarston committed Feb 13, 2013
  2. @pjambet
Commits on Feb 10, 2013
  1. @myronmarston
Commits on Feb 9, 2013
  1. @myronmarston

    Merge pull request #221 from rspec/use_matching_parent_stub

    Use the matching parent stub rather than just picking the first one.
    myronmarston committed Feb 9, 2013
Commits on Feb 7, 2013
  1. @ryanjones
Commits on Feb 5, 2013
  1. @myronmarston

    Use the matching parent stub rather than just picking the first one.

    Previously, when a mock expectation was added, it was derived as a
    child stub from the first existing stub. However, if there were multiple
    existing stubs constrained with different `with` criteria, this could
    cause it to pick the wrong one because it arbitrarily chose the first
    one.
    
    Our fix is to defer the choosing of the parent stub until the message
    expectation is invoked, at which point we can properly match the
    parent stub based on the arguments.
    
    As part of this, I've refactored MessageExpectation, extracting a new
    MessageImplementation class to hold the logic for an implementation
    based on `and_return` and `and_yield` declarations.
    
    Fixes #127.
    myronmarston committed Feb 2, 2013
Commits on Feb 4, 2013
  1. @myronmarston

    Refactor spec for greater clarity.

    I found the use of `File.open` confusing for a spec
    that demonstrates yielding multiple times. `File.open`
    is a well-known API that only yields once.
    myronmarston committed Feb 4, 2013
  2. @myronmarston

    Merge pull request #218 from rspec/remove_consecutive

    Simplify implementation of consecutive return values.
    myronmarston committed Feb 4, 2013
Commits on Jan 31, 2013
  1. @myronmarston

    Simplify implementation of consecutive return values.

    There's no need to track extra instance variable state (e.g. @consecutive); 
    instead, the implementation lambda can just do the right thing.
    
    This also fixes #217. Previously, message_expectation got confused when it
    was in consecutive mode (due to being stubbed with multiple return values)
    and then got mocked with a single return value. This simplified implementation
    fixes this bug.
    myronmarston committed Jan 31, 2013
Commits on Jan 28, 2013
  1. @myronmarston

    2.12.2 release.

    myronmarston committed Jan 28, 2013
  2. @myronmarston

    Handle `stub_const("::SomeUndefinedConst")`.

    I thought I fixed the problem in 17daf44,
    but I missed this edge case.  That only fixed `stub_const("::SomeDefinedConst").
    
    Fixes #200.
    myronmarston committed Jan 28, 2013
  3. @myronmarston

    Fix doc string typos.

    [ci skip]
    myronmarston committed Jan 28, 2013
Commits on Jan 7, 2013
  1. @myronmarston

    Merge pull request #211 from rspec/issue_210

    Adds failing spec demonstrating #210
    myronmarston committed Jan 7, 2013