diff options
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/base_test.rb | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/activerecord/test/cases/base_test.rb b/activerecord/test/cases/base_test.rb index 934f0c8f74..5a64a1163b 100644 --- a/activerecord/test/cases/base_test.rb +++ b/activerecord/test/cases/base_test.rb @@ -261,26 +261,18 @@ class BasicsTest < ActiveRecord::TestCase end end - def test_create_with_after_initialize - wp1 = WholesaleProduct.create(:msrp => 10) - assert_equal(10, wp1.msrp) - assert_equal(5, wp1.wholesale) - - wp2 = WholesaleProduct.create(:wholesale => 10) - assert_equal(20, wp2.msrp) - assert_equal(10, wp2.wholesale) - - wp3 = WholesaleProduct.create do |wp| - wp.msrp = 10 - end - assert_equal(10, wp3.msrp) - assert_equal(5, wp3.wholesale) + def test_create_after_initialize_without_block + wp = WholesaleProduct.create(:wholesale => 10) + assert_equal(20, wp.msrp) + assert_equal(10, wp.wholesale) + end - wp4 = WholesaleProduct.create do |wp| - wp.wholesale = 10 + def test_create_after_initialize_with_block + wp = WholesaleProduct.create do |w| + w.wholesale = 10 end - assert_equal(20, wp4.msrp) - assert_equal(10, wp4.wholesale) + assert_equal(20, wp.msrp) + assert_equal(10, wp.wholesale) end def test_load |