Skip to content
This repository
  • 238 commits
  • 107 files changed
  • 16 comments
  • 26 contributors
Mar 05, 2012
Nathan Long nathanl Explained why `before(:all)` won't work for stubs. 0815a4a
May 04, 2012
David Chelimsky dchelimsky rename some things in a spec d4b983c
David Chelimsky dchelimsky Fixed bug where at_least(0) failed when message was received
- Fixes #132
6b188a8
David Chelimsky dchelimsky Make sure at_least(0) passes even when never called
- Fixes #132 again
73be258
May 05, 2012
David Chelimsky dchelimsky dev: config for :focus 877dfa6
David Chelimsky dchelimsky dev: refactor a spec 2e9d990
David Chelimsky dchelimsky should_not_receive ignores and_return
- See #132
70aaf1c
David Chelimsky dchelimsky bump to 2.10.1 112b430
May 08, 2012
David Chelimsky dchelimsky Expose ArgumentListMatcher as a formal API
- supports use by 3rd party mock frameworks like Surrogate.
5d3e1dc
May 13, 2012
David Chelimsky dchelimsky spec refactoring: move shared examples to the one spec using them. eb12635
David Chelimsky dchelimsky dev: use :unless filter instead of a global exclusion filter e03d66b
David Chelimsky dchelimsky dev: rename context 671076d
David Chelimsky dchelimsky spec refactoring: rename subject with intention revealing name
- even though 'object' is no less generic than 'subject', it makes it
  more clear that we're talking about a generic object.
eebee30
May 17, 2012
David Chelimsky dchelimsky Merge pull request #115 from nathanl/master
Explained why `before(:all)` won't work for stubs.
2a69b71
Myron Marston myronmarston Fix a regression.
When doing something like:

  double.stub(:foo).and_return(a, b)
  double.should_receive(:foo).once { a }
  double.foo

...it used to work, but in 2.10 it raises a NoMethodError (#size).
b44db2a
May 19, 2012
Sidu Ponnappa kaiwren Replicating Issue #120 7d85604
May 21, 2012
Sidu Ponnappa kaiwren Issue #120: Under any_instance, modify #dup to remove the mock proxy 5de6500
Myron Marston myronmarston Update changelog. a11fcdc
May 22, 2012
Justin Ko justinko Merge pull request #138 from c42engineering/issue_120
Issue #120
bab88c7
Justin Ko justinko changelog [ci skip] c64c605
Justin Ko justinko No need for an "issue specific" spec file. aca2b40
May 23, 2012
Sidu Ponnappa kaiwren Replicated Issue #124 419b64a
aakash dharmadhikari aakashd issue #124: adding support for any_instance.should_not_receive 6e858e4
David Chelimsky dchelimsky Merge pull request #139 from c42engineering/issue124
add support for any_instance.should_not_receive
b38da74
May 24, 2012
David Chelimsky dchelimsky `should_receive(x).at_least(:once).and_return(y)` always returns y ev…
…en if x is already stubbed

    widget.stub(:count => 1)
    widget.should_receive(:count).at_least(:once).and_return(2)
    widget.count #=> 2
    widget.count #=> 2

If there is no return value set, it will fall back to the stub value:

    widget.stub(:count => 1)
    widget.should_receive(:count).at_least(:once)
    widget.count #=> 1
    widget.count #=> 1

- Fixes #142
dbe44e6
May 25, 2012
Bryan Helmkamp brynary Add Code Climate badge 8879661
David Chelimsky dchelimsky Merge pull request #143 from brynary/codeclimate-badge
Add Code Climate badge
ea1053b
May 31, 2012
Patrick Ellis pje `:%s/ducktype/duck_type/g` 5edfe94
David Chelimsky dchelimsky Merge pull request #145 from pjellis/patch-1
[typo] underscore-ize 'ducktype' in README.md
4b70b45
Jun 02, 2012
Myron Marston myronmarston First pass at implementing constant stubbing.
This is almost copied verbatim from rspec-fire.

For #144.
9c44b28
Myron Marston myronmarston Always restore original constants.
The original logic from rspec-fire did not restore original constants
if the user changed them in the example after stubbing them, but after
talking it over with @dchelimsky and @garyberhnardt we've decided to
be consistent and always restore them.

For #144.
9a7c90d
Myron Marston myronmarston Remove the bang from our #stub! methods.
I'm not really sure why I used them when I wrote this in rspec-fire;
given there were not corresponding bang-less methods, it didn't
really make sense.

For #144.
2b4fad7
Myron Marston myronmarston Fix a constant stubbing edge case.
stub_const("A::B::C", whatever) cannot work if A::B is defined
but A::B is not a module.

For #144.
d1669a8
Myron Marston myronmarston Remove unused method.
For #144.
f77357e
Myron Marston myronmarston Add API docs for new constant stubbing code.
For #144.
ecfb7f6
Myron Marston myronmarston Add cukes for new stub_const feature.
Closes #144.
e31f4a4
Myron Marston myronmarston Fix typo pointed out by @justinko. 7ab3d61
Jun 03, 2012
Myron Marston myronmarston Replace duplicated README content with a link.
As per the conversation with @justinko and @dchelimsky:
#146 (comment)

Note that this link is broken for now because this hasn't
yet been merged into master. But I figured it was better
not to use a working link just to the branch since that
branch will likely be deleted in the near future.
0bd5850
Myron Marston myronmarston Refactor constant stubbers a bit.
This is based on @justinko's suggestions:
#146 (comment)
2cbf9c4
Myron Marston myronmarston Remove unused helper method. 22c2049
Jun 04, 2012
Neha Kumari Issue #123: Improved error message when user forgets to stub a method…
… with default behavior.
409955f
David Chelimsky dchelimsky Merge pull request #147 from c42engineering/issue123
Issue #123: Improved error message when user forgets to stub a method with a default.
1ebc698
David Chelimsky dchelimsky Use the improved message from the prev commit for stubs, not message …
…expectations.

- Closes #147, #123.
49ce496
Jun 06, 2012
Myron Marston myronmarston Return stubbed value rather than original value from stub_const.
This allows chaining:

  stub_const("Foo", double).stub(:foo)
f94e6b2
Myron Marston myronmarston Add `Constant.original` API to query rspec-mocks about stubbed consta…
…nts.

This needs to be documented, but I want to get feedback from others before spending effort on that.
211743d
Jun 07, 2012
Myron Marston myronmarston Make Constant.unstubbed private since it's an internal API. fd595a8
Myron Marston myronmarston Refactor away the use of #its.
#its is going away in rspec-core at some future point, so we shouldn't use it here.
722529e
Jun 10, 2012
Myron Marston myronmarston Add API docs for Constant.original query API. 3b63c51
Myron Marston myronmarston Merge pull request #146 from rspec/constant-stubbing f5c63c3
Myron Marston myronmarston Mention new stub_const feature in changelog. f04d527
Jun 11, 2012
Neha Kumari Issue #134: Add deprecation warning for should_not_receive followed b…
…y and_return.
15c84d7
Jun 15, 2012
David Chelimsky dchelimsky refactor: rename ExpectationChain to PositiveExpectationChain
Also extract base ExpectationChain.
980b98f
Jun 17, 2012
Myron Marston myronmarston Prevent infinite loop when interpolating a null double as an integer …
…into a string.

Closes #154.
f8cae14
Myron Marston myronmarston Weird, 1.9.2 acts differently here than 1.9.3 and 1.8.7. b96dd92
Jun 23, 2012
Myron Marston myronmarston Fix `should_receive` to preserve null object behavior.
Given a case like:

   double = mock.as_null_object
   double.should_receive(:bar)

...`double.bar` was returning nil when it should return the double itself, since that's the expected null object behavior and no implementation was provided for the mock expectation.

Closes #155.
a5f296e
Jun 24, 2012
Myron Marston myronmarston Cleanup whitespace.
(Actually, I'm mostly doing this just to trigger a travis build. A
recent change in rspec-expectations[1] broke the rspec-mocks
travis build, and now that it's fixed[2], I want to see that the
rspec-mocks build is passing.  I figured I may as well make a useful
but non functional change while I'm at it, though).

[1] rspec/rspec-expectations@4024344#commitcomment-1496381
[2] rspec/rspec-expectations@a3e2839
28b284d
Jun 26, 2012
Myron Marston myronmarston Merge pull request #156 from amarshall/master
Raise RuntimeError instead of Exception by default in and_raise to match Ruby's default
c3539b9
Myron Marston myronmarston Update changelog. aa179ed
Jun 27, 2012
Andrew Marshall amarshall Raise RuntimeError instead by default in and_raise to match Ruby default dc5e1a7
Jul 07, 2012
David Chelimsky dchelimsky bump to 2.11.0 e6bba62
David Chelimsky dchelimsky improve automation for publishing to relishapp.com b35b5b4
Jul 09, 2012
Myron Marston myronmarston 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`.
26f6476
Myron Marston myronmarston 2.11.1 release. 24090f8
Jul 10, 2012
Uģis Ozols ugisozols Add missing 'be's to the README. 5288070
Justin Ko justinko Merge pull request #161 from ugisozols/master
Add missing 'be's to the README.
d9169ca
Myron Marston myronmarston 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.
f36ad4d
Aug 01, 2012
David Chelimsky dchelimsky Don't modify dup on classes that don't support dup
Fixes #168.
b828604
Aug 02, 2012
daneget daneget Fix any_instance to handle methods defined on superclasses.
Previously, the recorder implementation created a SystemStackError.

Closes #152.
1272c8a
Myron Marston myronmarston Cleanup spec a bit. 306ee36
Myron Marston myronmarston Update changelog. f1a2682
Aug 05, 2012
David Chelimsky dchelimsky align the feature READMEs for stubs and message expectations e2826c6
David Chelimsky dchelimsky dev: update optional dev dependencies 37e095c
Aug 10, 2012
Jim Deville jredville fix formatting for relish df607ea
Andy Lindeman alindeman Merge pull request #173 from jredville/master
Clean up formatting for Relish
bb21bc1
Myron Marston myronmarston 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")).
deec990
Aug 11, 2012
Myron Marston myronmarston 2.11.2 release. e7bd234
Aug 13, 2012
Myron Marston myronmarston Fix transfer_nested_constants option of stub_const.
My changes in deec990 caused it to blow up in the face of inherited constants.
39ae1f3
Aug 16, 2012
David Chelimsky dchelimsky Use pure doubles (Mock.new) in the middle of stub_chain
- was using Object.new
- Fixes #587
05741e9
Aug 19, 2012
David Chelimsky dchelimsky Merge pull request #151 from c42engineering/issue_134
Issue #134: Add deprecation warning for should_not_receive followed by and_return
5b36ea4
David Chelimsky dchelimsky Add caller info to deprecation warning
- See #151
dd90e89
David Chelimsky dchelimsky Changelog for #151 90f3ebb
Aug 24, 2012
Myron Marston myronmarston Fix serialization_spec to be able to run in isolation w/o bundler.
Fixes #174.
75fa447
Myron Marston myronmarston 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.
16313fb
Myron Marston myronmarston 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.
ca57991
Myron Marston myronmarston Print each command before running it.
This makes it easier to run one of them when we get a failure.
3e3e64d
Aug 25, 2012
Andy Lindeman alindeman any_instance is supported when a class overrides Object#method
* Fixes #180
* Closes #181
645b158
Sep 09, 2012
Andy Lindeman alindeman 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
a727464
Andy Lindeman alindeman Changelog for #167 and #182
[ci skip]
f890472
Andy Lindeman alindeman Adds travis build badge
[ci skip]
2c62796
Andy Lindeman alindeman Adds test to prevent regression of #69
* Bug fixed in a727464
* Closes #69
328bd5d
Sep 12, 2012
David Chelimsky update Gemfile-custom 4269862
Sep 15, 2012
Andy Lindeman alindeman 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!)
dcc92e9
Bas Vodde basvodde and_raise more closely matches Kernel#raise
* Closes #177
1bd602f
Sep 18, 2012
David Chelimsky dchelimsky whitespace and unnecessary refs to self e163390
Myron Marston myronmarston 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.
b03c2fb
Myron Marston myronmarston Refactor expectation-finding logic.
Besides the improved readability of this code, I think it should be
slightly faster in certain circumstances. The old version would scan
the full list twice; this only scans the list once.
431e255
Sep 19, 2012
Myron Marston myronmarston Updates to reflect that 2.11.3 has been released. 74c5f02
Sep 25, 2012
Erik Behrends behrends Fix typo 609e365
Myron Marston myronmarston Merge pull request #185 from behrends/patch-1
Fix typo
13fff0e
Sep 29, 2012
David Chelimsky dchelimsky whitespace 594e8f9
Oct 01, 2012
Myron Marston myronmarston Cleanup whitespace. da2a091
Myron Marston myronmarston Refactor before/ivar to let.
I'm planning on adding some more examples here that won't use this object,
so there's no need to waste cycles instantiating it for examples that
won't use it.
28b1649
Myron Marston myronmarston No need to send an ivar to do a local variable's job. 454fd67
Myron Marston myronmarston Use anonymous classes rather than leaking constants. 664bc24
Myron Marston myronmarston Support mocking on BasicObject-subclassed proxies. 1bfed86
Oct 02, 2012
Myron Marston myronmarston Config API: `add_stub_and_should_receive_to module`. 9c169b4
Oct 03, 2012
4r2r ArgumentError when using any_instance like this: klass.any_instance.n…
…ew.dup('boo')
a6a6cd9
Andy Lindeman alindeman Tests build on rbx 06d80ae
Oct 04, 2012
Andy Lindeman alindeman Merge pull request #189 from 4r2r/master
ArgumentError when calling dup with parameters
46bebac
Oct 05, 2012
Myron Marston myronmarston Merge pull request #188 from rspec/basic_object_support
Support mocking on BasicObject-subclassed proxies.
d1cb97f
Oct 07, 2012
Myron Marston myronmarston Allow rbx builds to fail.
We're getting weird sudden regressions on rbx, and given the frequency of RBX updates (and recent experience with failing rbx bulids in VCR and other
rspec repos), I think it's due to a bug in rbx.

While we're at it, let's enable JRuby builds, too.
0a3cfc2
Oct 08, 2012
goblin goblin add a small example to README
It may be obvious, but took me a while to figure out
56102c1
Myron Marston myronmarston Merge pull request #190 from digital-science/readme_yield_note
add a small example to README
a337af7
Oct 11, 2012
Andy Lindeman alindeman We are green under rbx again 3d9d860
Oct 12, 2012
Patrick Van Stee vanstee Identify ruby code for syntax highlighting
Fixes #191
80975a4
Andy Lindeman alindeman Merge pull request #192 from vanstee/ruby_file_doc_strings
Identify ruby code for syntax highlighting
df822fe
Myron Marston myronmarston Fix confusing code comment. 68f1d1c
Oct 15, 2012
Andy Lindeman alindeman Saves some Travis CPU cycles by skipping documentation-only gems 25030bc
Andy Lindeman alindeman Output matches correctly on JRuby a95947d
Andy Lindeman alindeman JRuby 1.8 mode is green 7a0b956
Andy Lindeman alindeman JRuby --1.9 responds with RUBY_VERSION == "1.9.2" but does not have t…
…his special case
4860270
Andy Lindeman alindeman JRuby --1.9 is green b82e1fe
Oct 19, 2012
Myron Marston myronmarston Nest StashedInstanceMethod under RSpec::Mocks.
We shouldn't grab any top level real-estate except for the `RSpec` constant itself.
eb931c1
Oct 20, 2012
Andy Lindeman alindeman Introduces `hide_const` 9f94f23
Andy Lindeman alindeman Terms APIs as mutators, which include objects that stub and hide cons…
…tants
5fca236
Andy Lindeman alindeman Adds scenario demonstrating that nested hidden constants are correctl…
…y restored
8ff25a8
Andy Lindeman alindeman Adds more test coverage for hide_const edge cases 2d6fc59
Andy Lindeman alindeman Hiding an undefined constant is a no-op 72f73a3
Andy Lindeman alindeman Removes usages of ConstantStubber in favor of ConstantMutator 545c2f0
Andy Lindeman alindeman Renames stub_const.rb -> mutate_const.rb c8552f9
Myron Marston myronmarston Add `and_call_original` which delegates to the original method. 2ab2776
Myron Marston myronmarston On 1.8, Symbol#=~ doesn't match regexes. 57d50ff
Myron Marston myronmarston Add snippet demonstrating a weird 1.8.7 bug. 61f78ce
Oct 21, 2012
Andy Lindeman alindeman Replaces more internal APIs with "mutated" instead of overly-specific…
… "stubbed"
0e45a25
Andy Lindeman alindeman Introduces Constant#mutated? and Constant#hidden?
* A constant is mutated if it has been either stubbed or hidden
33bf2a9
Andy Lindeman alindeman Adds additional documentation for mutating constants 0a9316f
Andy Lindeman alindeman Merge pull request #183 from alindeman/hide_const
Add support to temporarily remove constants
fd53183
Myron Marston myronmarston Silence `toplevel constant Hash referenced by TestClass::Hash` warning. b217232
Myron Marston myronmarston Use new `hide_const` API rather than manually hiding a constant. 22d18ce
Myron Marston myronmarston Ensure the method has the proper `self` for the case of a superclass …
…singleton method.
f881bdd
Myron Marston myronmarston Work around cases where objects may override #method. e642d51
Oct 22, 2012
Myron Marston myronmarston Remove `method_missing` inconsistency.
Based on conversations with @dchelimsky and others, we've decided it's best not
to raise an early error from `and_call_original` as that creates an
inconsistency since we sometimes don't know if `method_missing` will handle
the message or not.
98ca879
Myron Marston myronmarston Rename StashedInstanceMethod to InstanceMethodStasher.
The old name implied it always stashed a method (and made
`stashed_method.method_is_stashed?` read funny). The new
name makes it clear what role the object plays without
implying that it always stashes the method.
503c269
Myron Marston myronmarston Add additional yard private declarations. f6d03d5
Oct 23, 2012
Myron Marston myronmarston Clarify specs based on @dchelimsky's feedback. aff31ae
Oct 25, 2012
Myron Marston myronmarston Remove code that should have been removed in 98ca879.
I forgot to remove this code as part of that commit.
d221e27
Myron Marston myronmarston Deal with 1.8 shortcoming.
1.8 does not allow you to bind a singleton method from a class's superclass to the class, so our original code failed. This tries to work around the issue while alerting the user to the fact that it may not work correctly in all cases.
fafb085
Myron Marston myronmarston Merge pull request #23 from myronmarston/can_call_original
Add method to call_original method from a stub
3d278bc
Nov 05, 2012
David Chelimsky dchelimsky improve docs for double(), mock(), and stub() cddb5dc
Nov 09, 2012
Jeff Weiss jeffweiss fix receive spelling error
Prior to this commit several of the examples in the message expectation
documentation had the method as `should_recieve` when the proper
spelling is `should_receive`. This commit fixes those documentation
errors.
40b7b40
Andy Lindeman alindeman Merge pull request #194 from jeffweiss/fix_receive_spelling_error
fix receive spelling error
c3346b5
Nov 12, 2012
David Chelimsky dchelimsky prep for 2.12 [ci-skip] b194a64
Andy Lindeman alindeman Updates to rake 10 a9755d1
David Chelimsky dchelimsky bump version to 2.12 f8faced
Nov 13, 2012
Andy Lindeman alindeman Fixes changes link c1af6e8
Nov 24, 2012
Myron Marston myronmarston Fig line arg passed to class_eval so that it's correct.
There contents of the heredoc starts on the next line, hence the need for `+ 1`.
8b8d801
Myron Marston myronmarston Fix broken link. 0d6eea7
Myron Marston myronmarston Add support for #and_call_original to an #any_instance partial mock.
Fixes #197.
0f77e46
Myron Marston myronmarston Add explanatory comments for my last commit. d2ef056
Nov 25, 2012
Myron Marston myronmarston Handle additional any_instance / and_call_original edge cases.
For #197.
148db3c
Dec 02, 2012
Myron Marston myronmarston Fix stub_const/hide_const to work properly with a const like "::Foo".
It didn't work properly with names containing leading '::' before.

Fixes #200.
17daf44
Dec 10, 2012
Myron Marston myronmarston Merge pull request #204 from sanemat/fix/class-name
Use Kernel#inspect instead of #to_s
a209077
Dec 11, 2012
Murahashi Sanemat Kenichi sanemat Use Kernel#inspect instead of #to_s
Kernel#inspect does not call #to_s anymore, on Ruby2.0.0
394c14a
Dec 15, 2012
Myron Marston myronmarston Run travis builds against ruby 2.0. 2dcfb20
Dec 19, 2012
Myron Marston myronmarston Improve the way we run builds.
- No need for `find_path_to_rspec_exe`; I've discovered that `--standalone`
  and `--binstubs` together produce bins that don't load bundler.
- Add `-x` to `set -e` as that will cause the script to print each command
  as it runs.  No need for `print_and_run`.
- Add cucumber to test_all script, and use just that for the build.
63ae97f
Dec 20, 2012
Myron Marston myronmarston Stash and restore aliased methods when the owner is reported wrong.
Fixes #206.

While I was at it, I wanted to verify that `and_call_original` works
with this case, so I added a spec for it, too.
f86d02c
Andy Lindeman alindeman Merge pull request #207 from rspec/handle_aliased_methods
Stash and restore aliased methods when the owner is reported wrong.
ac90673
Dec 21, 2012
Myron Marston myronmarston Update Changelog. 5e41915
Myron Marston myronmarston Release 2.12.1. d7aac2c
Myron Marston myronmarston 1 more changelog entry I forgot.
[ci skip]
1ee14fc
Dec 25, 2012
Myron Marston myronmarston Cleanup whitespace. 11cccc4
Myron Marston myronmarston Simplify implementation of `and_raise`.
It can use an implementation block rather than needing to
maintain some extra state.
d9a7e36
Myron Marston myronmarston Simplify implementation of `and_throw`.
It can use an implementation block rather than needing to
maintain some extra state.
16d30dc
Myron Marston myronmarston Don't assume presence of rspec-core's `warn_deprecation` method.
rspec-mocks should be usable outside of rspec-core.
363406a
Myron Marston myronmarston Deprecate `spec/mocks` file (for rspec-1 compatibility). f9c5d6a
Dec 30, 2012
Myron Marston myronmarston Cleanup whitespace. eb6e30f
Myron Marston myronmarston Add missing require. 0db78bc
Myron Marston myronmarston Switch to new expect syntax. e5f11d7
Dec 31, 2012
Myron Marston myronmarston Convert one more example I missed to `expect` syntax.
This one isn't run on 1.8.7 (the version I was using
last night when doing the conversion).
352870a
Jan 01, 2013
Andy Lindeman alindeman Merge pull request #208 from rspec/new_expect_syntax
Switch to new expect syntax.
dd06392
Jan 03, 2013
Andy Lindeman alindeman Adds failing spec demonstrating #210 8825ed3
Andy Lindeman alindeman Adds a candidate fix for #210 763dda3
Jan 04, 2013
Myron Marston myronmarston Ignore .rspec-local. 6356c92
Jan 05, 2013
Myron Marston myronmarston Fix `and_call_original` so that it looks for the method in all ancestors
...including those mixed into the singleton class (i.e.
via a module extended onto an object instance).

Fixes #212.
14ae958
Myron Marston myronmarston Merge pull request #213 from rspec/issue-212
Fix `and_call_original` so that it looks for the method in all ancestors
80899f0
Jan 06, 2013
Andy Lindeman alindeman Cleans up the implementation after feedback from @myronmarston e3ab91c
Myron Marston myronmarston Merge pull request #211 from rspec/issue_210
Adds failing spec demonstrating #210
a0c8217
Jan 27, 2013
Myron Marston myronmarston Fix doc string typos.
[ci skip]
57543ba
Myron Marston 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.
1e3f431
Myron Marston myronmarston 2.12.2 release. bde69f0
Jan 31, 2013
Myron Marston 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.
6123c97
Feb 03, 2013
Myron Marston myronmarston Merge pull request #218 from rspec/remove_consecutive
Simplify implementation of consecutive return values.
d90f7f8
Myron Marston 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.
c454058
Feb 04, 2013
Myron Marston 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.
977dc00
Feb 07, 2013
Ryan Jones ryanjones disallow unstub! on any_instance a283324
Feb 09, 2013
Myron Marston myronmarston Merge pull request #221 from rspec/use_matching_parent_stub
Use the matching parent stub rather than just picking the first one.
6e89c7f
Myron Marston myronmarston MRI 2.0 is passing on travis, and we want to keep it that way. a6b052b
Feb 13, 2013
Pierre pjambet Use new Codeclimate badge, made by @olivierlacan ec9b5e5
Myron Marston myronmarston Merge pull request #225 from pjambet/use_new_codeclimate_shield
Use new Codeclimate badge, made by @olivierlacan
7f10451
Feb 14, 2013
Myron Marston myronmarston Do not call `#nil?` extra times.
...in case `nil?` is expected a set number of times.

Fixes #224.
962c5a0
Myron Marston myronmarston Update changelog [ci skip]. ae02d47
Feb 16, 2013
Myron Marston 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 :(.
0594c4f
Feb 17, 2013
Myron Marston 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.
8c58de8
Myron Marston myronmarston Add changelog entry for #226.
[ci skip]
5f842f3
Myron Marston myronmarston Refactoring: don't make `message_expectation` responsible for finding…
… a parent stub.

This was suggested by @dchelimsky:

#221 (comment)
958485c
Myron Marston myronmarston Rename MessageImplementation to Implementation.
See #221 (comment) for the surrounding discussion.
e6771ce
Myron Marston myronmarston Merge pull request #223 from RyanonRails/unstub_any_instance
disallow unstub! on any_instance
4695072
Myron Marston myronmarston Add changelog entry for #223.
[ci skip]
8e4015f
Myron Marston myronmarston Fix `any_instance` stubbing so that it works with `Delegator` subclas…
…ses.

Fixes #219.
aa3b226
Feb 18, 2013
David Chelimsky dchelimsky Only run example with BasicObject when BasicObject is defined.
It's not in Ruby < 1.9.
91b0259
Myron Marston 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.
5d0e6de
Feb 21, 2013
Myron Marston myronmarston Fix any_instance.should_not_receive when used w/ any_instance.should_…
…receive.

Fixes #228.
8dc2b1d
Feb 23, 2013
David Chelimsky dchelimsky add note about expecting same message multiple times with diff args t…
…o README
eea518f
David Chelimsky dchelimsky fix type in README (that I introduced in previous commit) d0df33c
David Chelimsky dchelimsky more about should_receive multiple times with args in README 42faffa
Myron Marston myronmarston Update changelog for release 88878d1
Myron Marston myronmarston 2.13.0 release e652a02
Feb 27, 2013
vfrride vfrride Uses secure RubyGems URL 5d3c41f
Myron Marston myronmarston Merge pull request #232 from vfrride/patch-1
Uses secure RubyGems URL
90f10df
Mar 01, 2013
Michi Huber michihuber instantiate TestDoubles with #double instead of #stub consistently 75a3505
Michi Huber michihuber output warning if #mock or #stub are used to instantiate test doubles 843a40f
Myron Marston myronmarston Merge pull request #233 from michihuber/deprecate_stub_mock
Deprecate stub mock
e7e72dd
Myron Marston myronmarston Update changelog for #233.
[ci skip]
73d7236
Mar 03, 2013
Jon Rowe JonRowe whitespace trim ac21e3c
Jon Rowe JonRowe move resetting the mock proxy to the duplicate object, this fixes the…
… bizare issue with dup and frozen
3e23efd
Mar 04, 2013
Jon Rowe JonRowe refactor back to one method and move spec e0eca44
Myron Marston myronmarston Merge pull request #234 from JonRowe/fix_issue_with_stubbing_any_inst…
…ance_and_dup

Fix issue #229 runtime error caused by duplicating an object which is frozen and stubbing with any_instance
12532f8
Myron Marston myronmarston Changelog for #234.
[ci skip]
9dfd530
Mar 06, 2013
Myron Marston myronmarston Move method comments above method def. 359ff6a
Mar 11, 2013
Myron Marston 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.
e7417e1
Mar 15, 2013
Myron Marston myronmarston Merge pull request #242 from JonRowe/deprectate_stub_bang_and_unstub_…
…bang

Deprecate #stub! and #unstub!
7b8a993
Myron Marston myronmarston This is a bug fix, not a deprecation.
[ci skip]
6f88317
Myron Marston myronmarston Changelog entry for #242.
[ci skip]
ee0ecbf
Myron Marston myronmarston Remove redundancy from doc string. 5ad011c
Myron Marston 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.
4ee01f5
Mar 16, 2013
Jon Rowe JonRowe deprecate stub! d1d46c0
Jon Rowe JonRowe deprecate unstub! b797760
Mar 17, 2013
Myron Marston 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.
5f0506e