thoughtbot--shoulda-matchers/lib/shoulda/matchers
Elliot Winkler 1189934806 Add ignoring_interference_by_writer to all matchers
`allow_value` matcher is, of course, concerned with setting values on a
particular attribute on a particular record, and then checking that the
record is valid after doing so. That comes with a caveat: if the
attribute is overridden in such a way so that the same value going into
the attribute isn't the same value coming out of it, then `allow_value`
will balk -- it'll say, "I can't do that because that changes how I
work."

That's all well and good, but what the attribute intentionally changes
incoming values? ActiveRecord's typecasting behavior, for instance,
would trigger such an exception. What if the developer needs a way to
get around this? This is where `ignoring_interference_by_writer` comes
into play. You can tack it on to the end of the matcher, and you're free
to go on your way.

So, prior to this commit you could already apply it to `allow_value`,
but now in this commit it also works on any other matcher.

But, one little thing: sometimes using this qualifier isn't going to
work. Perhaps you or something else actually *is* overriding the
attribute to change incoming values in a specific way, and perhaps the
value that comes out makes the record fail validation, and there's
nothing you can do about it. So in this case, even if you're using
`ignoring_interference_by_writer`, we want to inform you about what the
attribute is doing -- what the input and output was. And so we do.
2016-01-05 00:58:16 -07:00
..
action_controller Remove unused methods 2015-11-19 23:42:49 -07:00
active_model Add ignoring_interference_by_writer to all matchers 2016-01-05 00:58:16 -07:00
active_record Add ignoring_interference_by_writer to all matchers 2016-01-05 00:58:16 -07:00
doublespeak Improve architecture for permit matcher 2015-09-29 18:42:08 -06:00
independent Make independent matchers really independent 2015-10-01 10:12:17 -06:00
integrations Add a new Routing module 2015-09-25 17:45:33 -06:00
util word_wrap: Add ability to indent wrapped text 2015-12-13 20:22:21 -07:00
action_controller.rb Rename StrongParametersMatcher to PermitMatcher 2015-02-28 19:30:33 -07:00
active_model.rb Add ignoring_interference_by_writer to all matchers 2016-01-05 00:58:16 -07:00
active_record.rb Move uniqueness validation to ActiveRecord module 2014-12-13 17:53:16 -05:00
configuration.rb Remove auto-detection of Rails / test framework 2015-02-09 10:52:51 -07:00
doublespeak.rb Permit matcher now supports subparameters 2015-03-01 01:32:00 -07:00
error.rb Tighten CouldNotSetAttributeError restriction 2015-09-27 14:56:59 -06:00
independent.rb Rename DelegateMatcher to DelegateMethodMatcher 2014-08-29 11:57:26 -06:00
integrations.rb Omit newest private modules from docs 2015-03-01 01:20:45 -07:00
matcher_context.rb Documentation updates 2014-12-25 01:13:30 -05:00
rails_shim.rb Remove Rails 3.x, Ruby 1.9.2, Ruby 1.9.3 2015-02-09 10:52:22 -07:00
routing.rb Hide Routing module in docs 2015-09-30 13:18:28 -06:00
util.rb uniqueness: Extract code to gen dummy values 2016-01-05 00:58:16 -07:00
version.rb Bump version to 3.0.1 2015-10-23 14:42:36 -06:00
warn.rb Improve the word_wrap utility method 2015-10-08 21:30:41 -06:00