aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases
diff options
context:
space:
mode:
authorGodfrey Chan <godfreykfc@gmail.com>2014-01-14 03:58:22 -0800
committerGodfrey Chan <godfreykfc@gmail.com>2014-01-14 04:00:34 -0800
commitb242b2dbe75f0b5e86e2ce9ef7c2c5ee96e17862 (patch)
treef561de8b6785ddc09b00f3c8eae116acc82a9e0b /activerecord/test/cases
parent028029c1b622f326f254f09e76d2b618f578cd79 (diff)
downloadrails-b242b2dbe75f0b5e86e2ce9ef7c2c5ee96e17862.tar.gz
rails-b242b2dbe75f0b5e86e2ce9ef7c2c5ee96e17862.tar.bz2
rails-b242b2dbe75f0b5e86e2ce9ef7c2c5ee96e17862.zip
Enum mappings are now exposed via class methods instead of constants.
Example: class Conversation < ActiveRecord::Base enum status: [ :active, :archived ] end Before: Conversation::STATUS # => { "active" => 0, "archived" => 1 } After: Conversation.statuses # => { "active" => 0, "archived" => 1 }
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r--activerecord/test/cases/enum_test.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/activerecord/test/cases/enum_test.rb b/activerecord/test/cases/enum_test.rb
index 0075df8b8d..1f98801e93 100644
--- a/activerecord/test/cases/enum_test.rb
+++ b/activerecord/test/cases/enum_test.rb
@@ -74,9 +74,9 @@ class EnumTest < ActiveRecord::TestCase
end
test "constant to access the mapping" do
- assert_equal 0, Book::STATUS[:proposed]
- assert_equal 1, Book::STATUS["written"]
- assert_equal 2, Book::STATUS[:published]
+ assert_equal 0, Book.statuses[:proposed]
+ assert_equal 1, Book.statuses["written"]
+ assert_equal 2, Book.statuses[:published]
end
test "building new objects with enum scopes" do