thoughtbot--shoulda-matchers/lib/shoulda/matchers/active_record
Elliot Winkler aff7bd7e2a Make `order` option Rails 4.0.1-compatible
The way that we figure out whether the value which is passed to `order`
is the same as the `order` that the association was defined with is by
creating an ActiveRecord::Relation object from the given `order` and
comparing it with the Relation stored under the association.
Specifically, every time you call `order` on a Relation, it appends the
value you've given to an internal `order_values` array, so we actually
access this array and compare the two between the two Relation objects.

Currently we assume that this `order_values` array is an array of
strings, so it's very easy to compare. That was valid pre-Rails 4.0.1,
but it looks like as per [these][1] [commits][2], it's now possible for
`order_values` to be an array of Arel nodes. So, to make a proper
comparison, we have to convert any Arel nodes to strings by calling
 #to_sql on them.

[1]: https://github.com/rails/rails/commit/d345ed4
[2]: f83c9b10b4
2013-12-18 22:32:28 -07:00
..
association_matchers Make `order` option Rails 4.0.1-compatible 2013-12-18 22:32:28 -07:00
accept_nested_attributes_for_matcher.rb Rename failure_message and negative_failure_message 2013-03-08 14:49:12 -05:00
association_matcher.rb Use ActiveSupport delegation over Ruby Forwardable 2013-12-13 11:34:53 -07:00
have_db_column_matcher.rb Rename failure_message and negative_failure_message 2013-03-08 14:49:12 -05:00
have_db_index_matcher.rb Rename failure_message and negative_failure_message 2013-03-08 14:49:12 -05:00
have_readonly_attribute_matcher.rb Rename failure_message and negative_failure_message 2013-03-08 14:49:12 -05:00
serialize_matcher.rb Rename failure_message and negative_failure_message 2013-03-08 14:49:12 -05:00