diff options
Diffstat (limited to 'activerecord/test')
-rwxr-xr-x | activerecord/test/base_test.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/activerecord/test/base_test.rb b/activerecord/test/base_test.rb index 8b3a279287..7ea21156f1 100755 --- a/activerecord/test/base_test.rb +++ b/activerecord/test/base_test.rb @@ -1275,6 +1275,15 @@ class BasicsTest < Test::Unit::TestCase assert_equal 1, topics(:first).parent_id end + def test_increment_attribute_by + assert_equal 50, accounts(:signals37).credit_limit + accounts(:signals37).increment! :credit_limit, 5 + assert_equal 55, accounts(:signals37, :reload).credit_limit + + accounts(:signals37).increment(:credit_limit, 1).increment!(:credit_limit, 3) + assert_equal 59, accounts(:signals37, :reload).credit_limit + end + def test_decrement_attribute assert_equal 50, accounts(:signals37).credit_limit @@ -1285,6 +1294,15 @@ class BasicsTest < Test::Unit::TestCase assert_equal 47, accounts(:signals37, :reload).credit_limit end + def test_decrement_attribute_by + assert_equal 50, accounts(:signals37).credit_limit + accounts(:signals37).decrement! :credit_limit, 5 + assert_equal 45, accounts(:signals37, :reload).credit_limit + + accounts(:signals37).decrement(:credit_limit, 1).decrement!(:credit_limit, 3) + assert_equal 41, accounts(:signals37, :reload).credit_limit + end + def test_toggle_attribute assert !topics(:first).approved? topics(:first).toggle!(:approved) |