fix doc typo for validate_uniqueness_of
Update NEWS wrt Rails 4.1 compatibility
Do not permanently overwrite Parameters#[]

When stubbing the `ActionController::Parameters#[]` method, do not
permanently overwrite it. Restore the method after verifying simulating
the controller action.
Add missing entries to NEWS
Fix `belong_to` used with polymorphic association

For a polymorphic belongs_to association, the association doesn't
actually point to a class, it points to a concept, so we can't check
that the model it points to exists.
Bump to version 2.6.0
Fix thoughtbot/shoulda-matchers#483 by using a less precise `diff_to_compare` value for large numbers in `ComparisonMatcher`.
Only include ActiveRecord matchers if AR is defined

Fixes cases where you may be using ActiveModel without ActiveRecord.

Also add a test for loading without ActiveRecord.

The Cucumber feature creates a Gemfile containing ActiveModel and
shoulda-matchers, and then asserts that both can be loaded without any
errors.

The ActiveModel version used will match that of the Rails version
specified in the Appraisal Gemfile; and if no such version can be
determined, the latest will be used.

Closes #480.
Raise CouldNotSetPasswordError more safely

It seems that adding a restriction to allow_value to raise
CouldNotClearAttribute if nil cannot be set on the attribute in question
broke a lot of people's tests. Really the only reason we added this was
for validate_presence_of -- it rescued CouldNotClearAttribute and
re-raised it as CouldNotSetPasswordError, but only for passwords and
only if has_secure_password was being used. So, I've figured out another
way of performing this check inside of validate_presence_of only to
prevent tests that have nothing to do with from breaking unnecessarily.
Add instructions for Spring users to README
Fix callback matchers to take controller instances

Controller matchers operate on instances of controllers, not controller
classes themselves.
Fix the `permit` matcher to be less intrusive

Within the `permit` matcher, we need to keep track of when #permit was
called and which arguments it was called with. Previously we did this by
overriding ActionController::Parameters#[] to return an instance of
StubbedParameters (which, when #permit was called on it, would then
track the call).

This has three problems:

* We're overriding something in a global class. We can simply override
  something on the controller that's being tested instead.
* Overriding #[] is kind of magical. How does this even end up doing
  what we want? Really we should just replace the entire params hash.
* Controller tests involve hitting actions on real controllers. Those
  actions may need to access the params hash. Completely changing how
  the params hash works prevents them from being able to do that.

To solve this, we override the params hash on the controller under test
with an instance of StubbedParameters, which decorates the original
params hash. We then override #permit to track the call, but then we let
it do its thing.
Add missing NEWS entry for callback matchers fix
Rewrite tests for ensure_inclusion_of

ensure_inclusion_of is pretty complex. Not only does it support two ways
of specifying valid values (in_array, in_range), but it also supports
multiple column types (string, integer, float, decimal, boolean).

When it comes to handling numbers and strings, ensure_inclusion_of has
very similar logic, and we can test these cases similarly.

We also do not have tests for handling regular Ruby attributes as
opposed to database columns (validates_inclusion_of works with both).
Those tests will be added in a future commit, this commit lays the
groundwork for that.
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.
Fix several issues with strong parameters matcher

* Instead of decorating controller params, use our "Doublespeak"
  mini-library to stub ActionController::Parameters. This prevents from
  interfering with the params object if it is used in various ways, i.e.
  if `params.fetch(...).permit(...)` is used instead of
  `params.require(...).permit(...)`.
* Fix compat with Rails 4.1, where the verb for #update is PATCH not
  PUT
* Track multiple calls to #permit within a given controller action
* Fix so that if the route for your action requires params (such as
  :id) then you can specify those params
Fix delegate_method to double objects properly

Use our Doublespeak mini-library to stub the target method on the object
in question, ensuring that the stubs we create during matching get
reversed when the match ends.

Also:

* Make it possible to negate the matcher, and use negation in tests
  rather than !matches?
* If the matcher fails, add more information to the failure message as
  to what was actually called on the target object
Fix ensure_inclusion_of to support plain attrs

Also add missing tests to confirm this behavior.
Fix NonNullableBooleanError so it contains attribute name
Bump to version 2.6.1.rc1