From: Toshi MARUYAMA Date: Wed, 22 Aug 2012 16:31:13 +0000 (+0000) Subject: add unit test that enumeration returns default in regardless of active or not X-Git-Tag: 2.1.0~111 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=3478a21c2fe598cb562d5f3d5387c5d6f8f6f4c4;p=redmine.git add unit test that enumeration returns default in regardless of active or not git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10231 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/test/unit/enumeration_test.rb b/test/unit/enumeration_test.rb index 56be566e7..8511fa255 100644 --- a/test/unit/enumeration_test.rb +++ b/test/unit/enumeration_test.rb @@ -41,9 +41,20 @@ class EnumerationTest < ActiveSupport::TestCase e = Enumeration.default assert e.is_a?(Enumeration) assert e.is_default? + assert e.active? assert_equal 'Default Enumeration', e.name end + def test_default_non_active + e = Enumeration.find(12) + assert e.is_a?(Enumeration) + assert e.is_default? + assert e.active? + e.update_attributes(:active => false) + assert e.is_default? + assert !e.active? + end + def test_create e = Enumeration.new(:name => 'Not default', :is_default => false) e.type = 'Enumeration'