Permalink
Switch branches/tags
Commits on Sep 18, 2012
  1. Fix confusing error message.

    When a class method was mocked and it was called an extra time with the wrong arguments, the error being raised was:
    
    "NoMethodError: undefined method `bar' for Object:Class"
    
    ...which was very confusing.
    myronmarston committed Sep 18, 2012
Commits on Sep 16, 2012
  1. and_raise more closely matches Kernel#raise

    * Closes #177
    basvodde committed with alindeman Aug 23, 2012
Commits on Sep 15, 2012
  1. Fixes regression with methods stubbed multiple times in a single test

    * Regression introduced by a727464.
    * The cause:
      - Test code requests a method be stubbed
      - Since the method was not defined on the object's singleton class, it
        did not need to be stashed
      - Proxied method is defined on the object's singleton class
      - Test code requests a method to be stubbed (again)
      - Since the proxied method is defined on the object's singleton class,
        it is stashed (bug here!)
      - Later, the proxied method is restored in the reset step; future
        calls to that method are broken
    * The fix:
      - Do not stash methods if a method has already been proxied by
        TestDouble
    * Test written by @myronmarston (thanks!)
    alindeman committed Sep 12, 2012
Commits on Sep 12, 2012
  1. update Gemfile-custom

    David Chelimsky committed Sep 12, 2012
Commits on Sep 9, 2012
  1. Adds test to prevent regression of #69

    * Bug fixed in a727464
    * Closes #69
    alindeman committed Sep 9, 2012
  2. Adds travis build badge

    [ci skip]
    alindeman committed Sep 9, 2012
  3. Changelog for #167 and #182

    [ci skip]
    alindeman committed Sep 9, 2012
  4. Correctly unstubs methods stubbed with `#any_instance`

    * Instances stubbed with `#any_instance` would not be usable after the
      test finished because `MethodDouble` would stash the implementation of
      the method already overridden by `AnyInstance::Recorder`. When the
      test finished, that implementation would be restored on the object's
      singleton class, and any future calls to it would blow up with a stack
      overflow.
    * This fix only stashes methods if they are defined on the object's
      singleton class to begin with; `AnyInstance::Recorder` defines a
      method on the object's class so that method will not be stashed.
    * If there is no method on the object's singleton class, RSpec can
      safely define one there without stashing the original implementation.
      At the end of the test, the method is simply removed entirely from the
      singleton class. Any original implementation defined in the object's
      ancestor chain will show through again.
    * This issue cannot be fixed on MRI 1.8.6 because it does not support
      `Method#owner`. However, `#any_instance` itself is not supported on
      1.8.6 for the same reason. The fix should not negatively affect 1.8.6,
      though, because the fallback behavior is to stash the method in all
      cases (which was the original behavior).
    
    * This commit also refactors the stashing behavior out into its own
      object. While not explicitly necessary, it helped me reason about the
      fix much easier than when all the responsibility was in `MethodDouble`
      (which also has other responsibilities).
    
    * Fixes #167
    * Closes #182
    alindeman committed Sep 9, 2012
Commits on Aug 26, 2012
Commits on Aug 25, 2012
  1. Print each command before running it.

    This makes it easier to run one of them when we get a failure.
    myronmarston committed Aug 25, 2012
Commits on Aug 24, 2012
  1. Explicitly load psych.

    This is needed on 1.9.2 to get the serialization specs to pass when run in isolation w/o bundler.
    
    For #174.
    myronmarston committed Aug 24, 2012
  2. Run all specs together and in isolation w/o bundler as part of the bu…

    …ild.
    
    We want these to always pass this way, so having it as part of the build is important.
    
    This should help prevent a regression for #174 and issues like it.
    myronmarston committed Aug 24, 2012
Commits on Aug 20, 2012
  1. Changelog for #151

    dchelimsky committed Aug 20, 2012
  2. Add caller info to deprecation warning

    - See #151
    dchelimsky committed Aug 20, 2012
  3. Merge pull request #151 from c42engineering/issue_134

    Issue #134: Add deprecation warning for should_not_receive followed by and_return
    dchelimsky committed Aug 20, 2012
Commits on Aug 16, 2012
  1. Use pure doubles (Mock.new) in the middle of stub_chain

    - was using Object.new
    - Fixes #587
    dchelimsky committed Aug 16, 2012
Commits on Aug 14, 2012
  1. Fix transfer_nested_constants option of stub_const.

    My changes in deec990 caused it to blow up in the face of inherited constants.
    myronmarston committed Aug 14, 2012
Commits on Aug 12, 2012
  1. 2.11.2 release.

    myronmarston committed Aug 12, 2012
Commits on Aug 11, 2012
  1. Fix use of const_defined? and const_get so it ignores top-level const…

    …ants.
    
    I didn't realize this previously, but these methods can pick up a top-level
    constant when you don't intend it (e.g. ::Hash when checking MyGem.const_defined?("Hash")).
    myronmarston committed Aug 10, 2012
Commits on Aug 10, 2012
  1. Merge pull request #173 from jredville/master

    Clean up formatting for Relish
    alindeman committed Aug 10, 2012
  2. fix formatting for relish

    jredville committed Aug 10, 2012
Commits on Aug 5, 2012
Commits on Aug 3, 2012
  1. Update changelog.

    myronmarston committed Aug 3, 2012
  2. Cleanup spec a bit.

    myronmarston committed Aug 3, 2012
  3. Fix any_instance to handle methods defined on superclasses.

    Previously, the recorder implementation created a SystemStackError.
    
    Closes #152.
    daneget committed with myronmarston Aug 2, 2012
Commits on Aug 1, 2012
Commits on Jul 11, 2012
  1. Fix ruby warnings.

    - lib/rspec/mocks/error_generator.rb:32: warning: assigned but unused variable - expected_args
    - lib/rspec/mocks/error_generator.rb:33: warning: assigned but unused variable - actual_args
    - lib/rspec/mocks/stub_const.rb:8: warning: shadowing outer local variable - name
    - lib/rspec/mocks/stub_const.rb:12: warning: shadowing outer local variable - name
    - spec/rspec/mocks/stub_const_spec.rb:60: warning: assigned but unused variable - orig_value
    - lib/rspec/mocks/stub_const.rb:233: warning: instance variable @registered_with_mocks_space not initialized
    
    
    Closes #162.
    myronmarston committed Jul 11, 2012
Commits on Jul 10, 2012
  1. Merge pull request #161 from ugisozols/master

    Add missing 'be's to the README.
    justinko committed Jul 10, 2012
  2. 2.11.1 release.

    myronmarston committed Jul 10, 2012
Commits on Jul 9, 2012
  1. Fix edge case bug exposed w/ `should_receive` on a null object w/ a p…

    …revious stub.
    
    In a case like:
    
      double = stub.as_null_object
      double.stub(:foo => "bar")
      double.should_receive(:foo)
      double.foo
    
    ..it used to return "bar", but due to my changes in a5f296e it was returning `self`.
    myronmarston committed Jul 9, 2012
Commits on Jul 7, 2012