aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorGodfrey Chan <godfreykfc@gmail.com>2015-02-14 00:04:16 -0800
committerGodfrey Chan <godfreykfc@gmail.com>2015-02-14 00:04:16 -0800
commit698afe1173c6501d29b98389204d3ac70aaea910 (patch)
tree739c202bbd2f595a43fb6d7c3711f258f71d5dfd /activerecord/test
parente076d7290d523759900ee1ba3c9843c7f324adc7 (diff)
downloadrails-698afe1173c6501d29b98389204d3ac70aaea910.tar.gz
rails-698afe1173c6501d29b98389204d3ac70aaea910.tar.bz2
rails-698afe1173c6501d29b98389204d3ac70aaea910.zip
Mention `where.not` in the example
...so it doesn't look like you *have* to use SQL strings for that case (not anymore!). Would like to replace the SQL string example with something that you cannot do with the "normal" query API, but I could not come up with a short, realistic example. Suggestions welcome!
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/enum_test.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/activerecord/test/cases/enum_test.rb b/activerecord/test/cases/enum_test.rb
index 025e39c02d..e70d492efd 100644
--- a/activerecord/test/cases/enum_test.rb
+++ b/activerecord/test/cases/enum_test.rb
@@ -42,6 +42,8 @@ class EnumTest < ActiveRecord::TestCase
refute_equal @book, Book.where(status: :written).first
assert_equal @book, Book.where(status: [:proposed]).first
refute_equal @book, Book.where(status: [:written]).first
+ refute_equal @book, Book.where.not(status: :proposed).first
+ assert_equal @book, Book.where.not(status: :written).first
end
test "find via where with strings" do
@@ -49,6 +51,8 @@ class EnumTest < ActiveRecord::TestCase
refute_equal @book, Book.where(status: "written").first
assert_equal @book, Book.where(status: ["proposed"]).first
refute_equal @book, Book.where(status: ["written"]).first
+ refute_equal @book, Book.where.not(status: "proposed").first
+ assert_equal @book, Book.where.not(status: "written").first
end
test "build from scope" do