Commit Graph

4 Commits

Author SHA1 Message Date
Elliot Winkler f67183ea59 Improve the word_wrap utility method
We use the word_wrap method right now to reformat warning messages so
that they fit within a 72-character space. We'd like to use this for
error messages too, but we want the word_wrap method to be smart when
reformatting bulleted or numbered lists, and also to ignore code blocks.
2015-10-08 21:30:41 -06:00
Elliot Winkler 15d0cee93b Deprecate ensure_inclusion_of 2014-07-23 19:35:20 -06:00
Elliot Winkler c22d7c89e0 Extract examples in README to inline documentation 2014-06-20 16:41:27 -06:00
Elliot Winkler 5b44edf8b3 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])`, when the column is
  nullable, 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.
2014-02-17 15:40:18 -07:00