Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: rspec/rspec-mocks
...
head fork: rspec/rspec-mocks
Commits on Jun 13, 2013
@pda pda Bypass RSpec::Mocks::Syntax when mass-assigning stubs via double().
When mock_with's `config.syntax = [:expect]`, the `#stub` method is not
available on the TestDouble.

This change bypasses the pluggable syntax layer, directly setting up
allowance for a Matcher::Receive instance.

Another option would be to use AcceptanceTarget.new(self).to(matcher)
however the `#to` DSL-like method feels out of place when not used with
the `allow(target)` receiver syntax, and also the AcceptanceTarget
delegation implementation complexity is not required for internals like
this.
c73cd35
@pda pda Spec double() stubs hash in different syntax modes.
This tests a regression referenced in #306 where disabling the :should
syntax raised errors when a stubs hash was passed to double().
62d49cb
@samphippen samphippen Add a changelog entry for #306.
Signed-off-by: Sam Phippen <samphippen@googlemail.com>

Conflicts:
	Changelog.md
b00b09b
Commits on Jun 20, 2013
@JonRowe JonRowe JRuby 1.7.4 in 1.9 mode is falsely reporting defined?(::BasicObject) …
…=> nil see jruby/jruby#814
7f644a9
@myronmarston 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.
c2c6b55
@myronmarston 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.
77f09c4
@JonRowe JonRowe Merge pull request #320 from rspec/apply_243_onto_299_maintenance
Apply 243 onto 299 maintenance
315edde
@JonRowe JonRowe allow lambdas to be passed with argument lists that dont match call b8e68ec
@JonRowe JonRowe rename method 4651154
Commits on Jun 21, 2013
@JonRowe JonRowe Merge pull request #321 from rspec/fix_lambdas_for_299
Allow lambdas to be passed with argument lists that dont match called method signature
c3bbddd
@JonRowe JonRowe Merge pull request #322 from rspec/refactor_jruby_fix
Refactor the workaround for JRuby 1.7.4
7b93f89
@JonRowe JonRowe deprecation message for missmatched lambda arguments a49a812
@JonRowe JonRowe work around jrubys stack trace being different 90ec477
Commits on Jun 22, 2013
@JonRowe JonRowe find the first non rspec file from caller 70ba587
@JonRowe JonRowe ws 471a400
@JonRowe JonRowe changelog 7b407b1
@JonRowe JonRowe fix issue where you couldn't use and_call_original on any_instance stuff a5443e1
@JonRowe JonRowe assert upon old syntax too 3bc662c
@JonRowe JonRowe pull backported lambda? method for 1.8.7 a076cb2
Commits on Jun 23, 2013
@JonRowe JonRowe convert lambda to proc to supress false warning d72347c
Commits on Jun 24, 2013
@JonRowe JonRowe work around 1.8.6 c46c4e4
@JonRowe JonRowe Merge pull request #323 from rspec/deprecation_message_for_missmatche…
…d_lambdas

Deprecation message for missmatched lambdas
963d7cd
Commits on Jun 25, 2013
@JonRowe JonRowe Merge pull request #312 from rspec/features_for_expect_any_instance_o…
…f.feature

Need better docs for `expect_any_instance_of` and `allow_any_instance_of`
5bf7437
@JonRowe JonRowe Merge pull request #328 from rspec/features_for_expect_any_instance_o…
…f_299

Better docs for `expect_any_instance_of` and `allow_any_instance_of`
eed2e99
Commits on Jun 28, 2013
@JonRowe JonRowe Merge pull request #326 from rspec/feature_for_allow
Documentation for allow (counterpart to stub in the expect syntax)
9515a2b
@JonRowe JonRowe Merge pull request #331 from rspec/feature_for_allow_299
Documentation for allow (#326 for 2.99)
c49d95e
@JonRowe JonRowe Merge pull request #333 from rspec/faster_jruby_builds
Run tests using the client mode JVM (or as close as we can get to it)
1de4f66
Commits on Jun 29, 2013
@JonRowe JonRowe lock to 2-99 on other repos 9ba8683
Commits on Jul 02, 2013
@alindeman alindeman Resolves rspec/rspec-core#950 and adds specs
* Hopefully the code clarity is improved here
* We also change the behavior by *not* duping an object if `space` is
  not yet initialized. This should have been the behavior from the
  beginning, but it was overlooked and did not have specs.
8efd5f1
@alindeman alindeman Improves clarity of nil check addc6a9
@alindeman alindeman Improves strength of assertions per @myronmarston's suggestions 367afbc
@alindeman alindeman Changelog entry 69c7c84
@alindeman alindeman Merge branch 'issue-950-with-specs' into 2-99-maintenance 22e50a2
Commits on Jul 03, 2013
@pda pda Creates syntax agnostic matchers for message expectations.
See pull: #311 and #334.

Signed-off-by: Sam Phippen <samphippen@googlemail.com>

Conflicts:
	Changelog.md
	lib/rspec/mocks/message_expectation.rb
	spec/rspec/mocks/mock_spec.rb
0b2e5b2
Commits on Jul 05, 2013
@myronmarston myronmarston Change an error back to a deprecation warning.
When we merged from a master-focused PR we accidentally change this for 2.14.
27fb506
@myronmarston myronmarston Merge pull request #346 from rspec/remove_breaking_2_99_change
Change an error back to a deprecation warning.
03f9722
Commits on Jul 06, 2013
@myronmarston myronmarston Reword a couple of confusing changelog entries.
[ci skip]
b1092e1
@myronmarston myronmarston Use new `allow_message` API. 7eea1e6
@myronmarston myronmarston Merge pull request #350 from rspec/allow_message_api_2_99
Use new `allow_message` API.
7993f92
Commits on Jul 07, 2013
@myronmarston myronmarston Update changelog to reflect 2.14.0 release.
[ci skip]
7785417
@myronmarston myronmarston This branch is 2.99.0.pre now.
[ci skip]
2a3b3c1
@alindeman alindeman Works around Rubinius bug 4953923
@alindeman alindeman rbx build is green; let us try to keep it that way 9ab4c1f
@myronmarston myronmarston Add missing 2.13.1 release notes.
[ci skip]
9fe3837
@myronmarston myronmarston Deprecate reliance on a double's null-ness persisting between examples. 0731ddf
Commits on Jul 08, 2013
@alindeman alindeman Revert "rbx build is green; let us try to keep it that way"
This reverts commit 9ab4c1f.
7687274
@alindeman alindeman Merge pull request #354 from rspec/deprecate_double_null_object_leakage
Deprecate reliance on a double's null-ness persisting between examples.
19bf85e
@myronmarston myronmarston Update changelog with 2.14.1 release notes.
[ci skip]
778998b
Commits on Jul 11, 2013
@JonRowe JonRowe ensure null objects behave correctly with to_a and to_ary
Conflicts:
	spec/rspec/mocks/mock_spec.rb
b2f3d4c
@JonRowe JonRowe 1.8.7 has a default implementation on top 81601ac
@JonRowe JonRowe more descriptive comment c4a2a40
@JonRowe JonRowe refactor to case statement d8e0082
@JonRowe JonRowe Merge pull request #361 from rspec/revisited_bugfix_for_doubles_in_ar…
…rays_299

Ensure null objects behave correctly with to_a and to_ary in 299
93f4b2c
Commits on Jul 28, 2013
@JonRowe JonRowe rspec-mocks is always loaded from source via `gemspec` command 70d1dab
Commits on Jul 30, 2013
@myronmarston myronmarston Split spec into two to specify each behavior individually. dec75de
@myronmarston myronmarston Fix `stub!` regression in 2.14.
Fixes #387.
eab4c5b
@myronmarston myronmarston Add missing changelog entry for #360. f078e2e
@myronmarston myronmarston Update changelog to reflect 2.14.2 release. 4a01273
Commits on Aug 01, 2013
@samphippen samphippen Pass the receiving instance to any instance stubs.
Signed-off-by: Sam Phippen <samphippen@googlemail.com>
ebd1cda
@samphippen samphippen Disable any_instance receiving the object by default.
Add specs and warnings.

Signed-off-by: Sam Phippen <samphippen@googlemail.com>
67fbe67
Commits on Aug 04, 2013
@soulcutter soulcutter Exhibit problem with stubbing and prepend
As described in #384 the way that original methods are stashed
breaks the ability to stub the non-prepended method.
88b62ed
@soulcutter soulcutter Allow stubbing instance methods on a prepended class
Conflicts:
	lib/rspec/mocks/instance_method_stasher.rb
0bbeebd
@soulcutter soulcutter Changelog entry 32b99eb
Commits on Aug 07, 2013
@samphippen samphippen Improve the warning message for any_instance block expectations.
Signed-off-by: Sam Phippen <samphippen@googlemail.com>
0902a18
@samphippen samphippen Add warn_deprecation to mocks.
Signed-off-by: Sam Phippen <samphippen@googlemail.com>
ba019c1
@samphippen samphippen Only warn if there is an expectation block.
Signed-off-by: Sam Phippen <samphippen@googlemail.com>
38ac076
Commits on Aug 09, 2013
@myronmarston myronmarston Update changelog to reflect 2.14.3 release.
[ci skip]
9788543
Commits on Aug 11, 2013
@samphippen samphippen Make any instance expectation warning work with more implementations.
Signed-off-by: Sam Phippen <samphippen@googlemail.com>
424590f
@samphippen samphippen Merge pull request #383 from samphippen/2-99-maintenance
Add the any_instance stubs receiving the instance to 2-99
fda665f
Commits on Aug 23, 2013
@myronmarston myronmarston Fix unstubing existing instances of any instance
* access proxies for any instance of klass
* remove stubs from "running" instances
* pass recorder into chains to register stubs
* reduce lookup cost of proxies by klass
* record stubs used
* remove just the stubs recorded by any instance
* switch from for..in to each
* allow unstubing of instances that are a sub class
* refactor lookup for subclass
* Improve doc string.
* "local instance" didn't really give me the right
* sense for what this was testing.
* Improve space spec.
    - The old spec only checked the number of proxies returned,
      and didn't actually check that it returned the right ones.
    - The old spec only tested who were instances of the given
      class, and did not check instances of subclasses.
84ae8d1
@myronmarston myronmarston Backport caller filter. 4194abd
Commits on Aug 26, 2013
@myronmarston myronmarston Pass __FILE__ and __LINE__ to `class_eval` properly.
This is important because w/o this, lines in the
eval'd code do not indicate what file or line
they are from when they are in a backtrace, and
that can cause CallerFilter to improperly consider
these lines to be non-rspec lines.
1d0028b
@myronmarston myronmarston Improve travis build.
- No need to install bundler twice.
- No need to bundle install twice.
- Skip one-by-one specs on JRuby.
- Bundler issue #2383 has been resolved,
  no need to work around it anymore.
277a105
@myronmarston myronmarston Update caller filter.
- Include additional libs.
- Don't put it at `rspec/caller_filter`.
- Ignore the "same content as rspec-core" spec for now.

The way I had this was brittle and is causing problems in rspec-core.
In rspec-core I'm trying to update the regex and add some specs but
the fact that the file is at the same path in all 3 libs (which seemed
like a simple way to ensure only one of them loads) is causing
the _wrong_ version to be loaded in rspec-core's specs, so that it's not
picking up the changes I've made.  Putting the file at the same
path in all 3 libs was a terrible idea in retrospect :(.
51d47ef
@myronmarston myronmarston Update caller filter once more... 2cdedfc
@myronmarston myronmarston be_true/be_false is deprecated. cee9366
@myronmarston myronmarston Refactor: reduce duplication by moving logic into super class. a3d52e4
@myronmarston myronmarston Refactor: eliminate unneeded superclass. 3f1cc33
@myronmarston myronmarston Fix source line in any_instance deprecation message.
Before, the printed line was from where a particular
instance got its `any_instance` recordings played back,
not from where the `any_instance` block originated.

This was very confusing :(.
6c997a3
@myronmarston myronmarston Ensure the line in the warning is the block's source location.
Note: on 1.8.7, we can't always make that work because
Proc does not have `source_location`, and even if we
define `source_location` on it manually, it loses that
when we forward it on using `&block`.
aab8dc9
@myronmarston myronmarston Don't warn if the block ignores arguments. 528d904
@myronmarston myronmarston Silence `any_number_of_times` deprecation warning. 19c1b85
@myronmarston myronmarston On 1.8 a block doesn't indicate if it ignores args.
Proc.new { }.arity # => -1
Proc.new { |*a| }.arity # => -1

The first one returns 0 on 1.9, allowing us to differentiate
these two cases, but returns -1 on 1.8 (as shown above).
Thus, we can't differentiate here and we have to err on
the side of printing the warning.
cd3208a
Commits on Aug 27, 2013
@myronmarston myronmarston Merge pull request #414 from rspec/address_warnings
Address warnings
c31542b
Commits on Oct 05, 2013
@xaviershay xaviershay Deprecate using a with block with arguments.
It is confusing to have different behaviour depending on whether the
block has arguments or not, and there are better ways to do this.
7349928
@myronmarston myronmarston Merge pull request #425 from rspec/issue-377-deprecation
Deprecate using a with block with arguments.
b7cae27
Commits on Oct 07, 2013
@JonRowe JonRowe Merge pull request #428 from rspec/handle_receive_do_end_block_chaining
Allow chaining receive modifications off do..end blocks
613a2ca
@JonRowe JonRowe changelog for #428 4393eb7
Commits on Oct 16, 2013
@myronmarston myronmarston Add release notes for 2.14.4.
[ci skip]
fed560b
Commits on Oct 24, 2013
@JonRowe JonRowe Merge pull request #442 from rspec/use_git_repos_env
Allow suppression of local repos
7a266cc
Commits on Nov 05, 2013
@xaviershay xaviershay Consistent formatting of changelog. 1afb695
@myronmarston myronmarston Merge pull request #451 from rspec/2-99-changelog
Consistent formatting of changelog.
cb6e59f
@myronmarston myronmarston Add specs for string vs symbol usage.
Each of these specs covers a case that was previously
uncovered. We use `to_sym` in a bunch of places to
normalize message names to a symbol. This is important,
but when I removed the `to_sym` calls, nothing was failing.

Without the `to_sym` calls, these specs fail, and they also
cause subsequent specs to fail because `reset` fails to
reset (since it winds up with two message doubles, `:foo`
and "foo", and resets the first and blows up on the second
since it already got reset -- that leaves the method double
around and it is attempted to be reset on reset for
subsequent specs).
8a7afc3
@myronmarston myronmarston Stop using deprecated `have` matchers. c882a41
@myronmarston myronmarston Silence deprecation about `with` with no args. 086b52b
Commits on Nov 06, 2013
@myronmarston myronmarston Merge pull request #453 from rspec/add-symbol-vs-string-specs
Add symbol vs string specs
332e27d
Commits on Nov 07, 2013
@myronmarston myronmarston Fix unused variable warning. a7e1f9d
@myronmarston myronmarston Update changelog for v2.99.0.beta1 [ci skip] 1b15437
@myronmarston myronmarston Release 2.99.0.beta1 6844df0