diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2009-02-15 13:33:09 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2009-02-15 13:33:09 +0000 |
commit | 4601ed2f3aebc545024287e318494ce32bc5803f (patch) | |
tree | 40f4bda265bbc92f9ddaed1bca6deb7769f2ccae /test/unit/enumeration_test.rb | |
parent | 13e2c727cfa7b3a9e3e9bd0563cda0a15ee3892d (diff) | |
download | redmine-4601ed2f3aebc545024287e318494ce32bc5803f.tar.gz redmine-4601ed2f3aebc545024287e318494ce32bc5803f.zip |
Replaces Enumeration.get_values and Enumeration.default with named scopes.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2472 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/enumeration_test.rb')
-rw-r--r-- | test/unit/enumeration_test.rb | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/test/unit/enumeration_test.rb b/test/unit/enumeration_test.rb index 4da3f094b..c192cee8f 100644 --- a/test/unit/enumeration_test.rb +++ b/test/unit/enumeration_test.rb @@ -38,7 +38,7 @@ class EnumerationTest < Test::Unit::TestCase end def test_default - e = Enumeration.default('IPRI') + e = Enumeration.priorities.default assert e.is_a?(Enumeration) assert e.is_default? assert_equal 'Normal', e.name @@ -47,31 +47,31 @@ class EnumerationTest < Test::Unit::TestCase def test_create e = Enumeration.new(:opt => 'IPRI', :name => 'Very urgent', :is_default => false) assert e.save - assert_equal 'Normal', Enumeration.default('IPRI').name + assert_equal 'Normal', Enumeration.priorities.default.name end def test_create_as_default e = Enumeration.new(:opt => 'IPRI', :name => 'Very urgent', :is_default => true) assert e.save - assert_equal e, Enumeration.default('IPRI') + assert_equal e, Enumeration.priorities.default end def test_update_default - e = Enumeration.default('IPRI') + e = Enumeration.priorities.default e.update_attributes(:name => 'Changed', :is_default => true) - assert_equal e, Enumeration.default('IPRI') + assert_equal e, Enumeration.priorities.default end def test_update_default_to_non_default - e = Enumeration.default('IPRI') + e = Enumeration.priorities.default e.update_attributes(:name => 'Changed', :is_default => false) - assert_nil Enumeration.default('IPRI') + assert_nil Enumeration.priorities.default end def test_change_default e = Enumeration.find_by_name('Urgent') e.update_attributes(:name => 'Urgent', :is_default => true) - assert_equal e, Enumeration.default('IPRI') + assert_equal e, Enumeration.priorities.default end def test_destroy_with_reassign |