diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2016-01-13 01:13:18 -0200 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2016-01-13 01:13:18 -0200 |
commit | f466cd7fc466ad7b602508b255e1de41074c7df8 (patch) | |
tree | 1a78e4dedffa03f58a802811b070e32e2d0e4532 /activerecord/test | |
parent | 7b7b12f5983fd0c48e4a8dad909d3388b72f046c (diff) | |
download | rails-f466cd7fc466ad7b602508b255e1de41074c7df8.tar.gz rails-f466cd7fc466ad7b602508b255e1de41074c7df8.tar.bz2 rails-f466cd7fc466ad7b602508b255e1de41074c7df8.zip |
Improve error message for #or when it is structurally incompatible
When you are using scopes and you chaining these scopes it is hard to
know which are the values that are incompatible. This way you can read
the message and know for which values you need to look for.
[Herminio Torres]
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/relation/or_test.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/activerecord/test/cases/relation/or_test.rb b/activerecord/test/cases/relation/or_test.rb index 2006fc9611..28a0862f91 100644 --- a/activerecord/test/cases/relation/or_test.rb +++ b/activerecord/test/cases/relation/or_test.rb @@ -52,9 +52,11 @@ module ActiveRecord end def test_or_with_incompatible_relations - assert_raises ArgumentError do + error = assert_raises ArgumentError do Post.order('body asc').where('id = 1').or(Post.order('id desc').where(:id => [2, 3])).to_a end + + assert_equal "Relation passed to #or must be structurally compatible. Incompatible values: [:order]", error.message end def test_or_when_grouping |