thoughtbot/shoulda-matchers — pull request #428 by mcmire (2014-01-22 00:06:28+00:00)
Title: Handle ensure_inclusion_of for boolean columns

Currently, using `ensure_inclusion_of` against a boolean column doesn't
work. We can assert that the column allows boolean values, but what
about values that should be rejected? Well, it depends on what you give
to `ensure_inclusion_of`. Here's how it works now:

* `ensure_inclusion_of(:attr).in_array([true])` asserts that false is
rejected
* `ensure_inclusion_of(:attr).in_array([false])` asserts that true is
rejected
* `ensure_inclusion_of(:attr).in_array([true, false])` does not assert
that anything is rejected, instead informing the developer how
this sort of expectation is not fully testable (anything other than
true, false, or nil will be converted to false).
* `ensure_inclusion_of(:attr).in_array([nil])` does not assert that
anything is rejected, either, also printing a warning
* `ensure_inclusion_of(:attr).in_array([nil])` when the column is
non-nullable raises an error because this expectation is not testable
in any way, as setting a boolean column to nil this way will get
converted to false.