1
0
Fork 0
mirror of https://github.com/thoughtbot/shoulda-matchers.git synced 2022-11-09 12:01:38 -05:00
Commit graph

4 commits

Author SHA1 Message Date
Elliot Winkler
5e67a8305b Doublespeak: Introduce a better MethodCall
MethodCall is used to represent a method call made on a double. It
stores the object the call was made on, the name of the method, any
arguments or block sent to the method, and the double itself. There were
quite a few places where we were using an (args, block) or (object,
args, block) tuple. We also already had a MethodCall class, and
additionally a MethodCallWithName class, and the two were basically the
same. These usages have all been collapsed.
2015-03-01 00:39:50 -07:00
Doug Orleans
f81add5117 Allow multiple StrongParametersMatchers to exist at once.
The provided RSpec example looks a bit contrived, but it corresponds to
this perfectly reasonable Minitest test case that was not working:

  class UserControllerTest < ActionController::TestCase
    should permit(:name).for(:create)
    should_not permit(:admin).for(:create)
  end

This instantiates two matchers at class load time, which resulted in the
second one overriding the double collection of the first one. Then when
the tests are executed, the first matcher would fail, because its double
is not listening to ActionController::Parameters#permit -- only the
second matcher's double collection gets activated.

This is fixed in Doublespeak by only creating one double collection per
class.
2014-06-21 21:56:47 -06:00
Elliot Winkler
c22d7c89e0 Extract examples in README to inline documentation 2014-06-20 16:41:27 -06:00
Elliot Winkler
dfebd81af0 Add a small stubbing library
This provides a robust solution for temporarily stubbing (and
unstubbing) methods. It will be internally by the strong parameters and
delegation matchers.
2014-04-22 09:37:27 -05:00