diff options
author | Michael Koziarski <michael@koziarski.com> | 2008-06-04 11:05:46 +1200 |
---|---|---|
committer | Michael Koziarski <michael@koziarski.com> | 2008-06-04 11:05:46 +1200 |
commit | e3c26e9926948587efcc8d31c729395093407df6 (patch) | |
tree | 358f418791a56620c32a48776739b4fdf39d3cb0 /activerecord/test/cases/base_test.rb | |
parent | b9a9b91a3e3b892ab72ff5c618181747d6b4be04 (diff) | |
parent | 8afa725f4b98a6e0ceee4792e8ebaebb6189e5f6 (diff) | |
download | rails-e3c26e9926948587efcc8d31c729395093407df6.tar.gz rails-e3c26e9926948587efcc8d31c729395093407df6.tar.bz2 rails-e3c26e9926948587efcc8d31c729395093407df6.zip |
Merge branch 'master' into patches
Diffstat (limited to 'activerecord/test/cases/base_test.rb')
-rwxr-xr-x | activerecord/test/cases/base_test.rb | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/activerecord/test/cases/base_test.rb b/activerecord/test/cases/base_test.rb index e07ec50c46..a4be629fbd 100755 --- a/activerecord/test/cases/base_test.rb +++ b/activerecord/test/cases/base_test.rb @@ -133,19 +133,19 @@ class BasicsTest < ActiveRecord::TestCase category_attrs = {"name"=>"Test categoty", "type" => nil} assert_equal category_attrs , category.attributes_before_type_cast end - + if current_adapter?(:MysqlAdapter) def test_read_attributes_before_type_cast_on_boolean bool = Booleantest.create({ "value" => false }) assert_equal 0, bool.attributes_before_type_cast["value"] end end - + def test_read_attributes_before_type_cast_on_datetime developer = Developer.find(:first) assert_equal developer.created_at.to_s(:db) , developer.attributes_before_type_cast["created_at"] end - + def test_hash_content topic = Topic.new topic.content = { "one" => 1, "two" => 2 } @@ -251,7 +251,7 @@ class BasicsTest < ActiveRecord::TestCase topic = Topic.create("title" => "New Topic") topicReloaded = Topic.find(topic.id) assert_equal(topic, topicReloaded) - end + end def test_create_through_factory_with_block topic = Topic.create("title" => "New Topic") do |t| @@ -576,7 +576,7 @@ class BasicsTest < ActiveRecord::TestCase def test_destroy_all original_count = Topic.count topics_by_mary = Topic.count(:conditions => mary = "author_name = 'Mary'") - + Topic.destroy_all mary assert_equal original_count - topics_by_mary, Topic.count end @@ -665,7 +665,7 @@ class BasicsTest < ActiveRecord::TestCase def test_delete_all assert Topic.count > 0 - + assert_equal Topic.count, Topic.delete_all end @@ -970,7 +970,7 @@ class BasicsTest < ActiveRecord::TestCase topic.attributes = attributes assert_equal Time.local(2004, 6, 24, 16, 24, 0), topic.written_on end - + def test_multiparameter_attributes_on_time_with_old_date attributes = { "written_on(1i)" => "1850", "written_on(2i)" => "6", "written_on(3i)" => "24", @@ -998,7 +998,7 @@ class BasicsTest < ActiveRecord::TestCase def test_multiparameter_attributes_on_time_with_time_zone_aware_attributes ActiveRecord::Base.time_zone_aware_attributes = true ActiveRecord::Base.default_timezone = :utc - Time.zone = TimeZone[-28800] + Time.zone = ActiveSupport::TimeZone[-28800] attributes = { "written_on(1i)" => "2004", "written_on(2i)" => "6", "written_on(3i)" => "24", "written_on(4i)" => "16", "written_on(5i)" => "24", "written_on(6i)" => "00" @@ -1016,7 +1016,7 @@ class BasicsTest < ActiveRecord::TestCase def test_multiparameter_attributes_on_time_with_time_zone_aware_attributes_false ActiveRecord::Base.time_zone_aware_attributes = false - Time.zone = TimeZone[-28800] + Time.zone = ActiveSupport::TimeZone[-28800] attributes = { "written_on(1i)" => "2004", "written_on(2i)" => "6", "written_on(3i)" => "24", "written_on(4i)" => "16", "written_on(5i)" => "24", "written_on(6i)" => "00" @@ -1032,7 +1032,7 @@ class BasicsTest < ActiveRecord::TestCase def test_multiparameter_attributes_on_time_with_skip_time_zone_conversion_for_attributes ActiveRecord::Base.time_zone_aware_attributes = true ActiveRecord::Base.default_timezone = :utc - Time.zone = TimeZone[-28800] + Time.zone = ActiveSupport::TimeZone[-28800] Topic.skip_time_zone_conversion_for_attributes = [:written_on] attributes = { "written_on(1i)" => "2004", "written_on(2i)" => "6", "written_on(3i)" => "24", @@ -1647,7 +1647,7 @@ class BasicsTest < ActiveRecord::TestCase last = Developer.find :last assert_equal last, Developer.find(:first, :order => 'id desc') end - + def test_last assert_equal Developer.find(:first, :order => 'id desc'), Developer.last end @@ -1655,7 +1655,7 @@ class BasicsTest < ActiveRecord::TestCase def test_all_with_conditions assert_equal Developer.find(:all, :order => 'id desc'), Developer.all(:order => 'id desc') end - + def test_find_ordered_last last = Developer.find :last, :order => 'developers.salary ASC' assert_equal last, Developer.find(:all, :order => 'developers.salary ASC').last @@ -1670,14 +1670,14 @@ class BasicsTest < ActiveRecord::TestCase last = Developer.find :last, :order => 'developers.name, developers.salary DESC' assert_equal last, Developer.find(:all, :order => 'developers.name, developers.salary DESC').last end - + def test_find_scoped_ordered_last last_developer = Developer.with_scope(:find => { :order => 'developers.salary ASC' }) do Developer.find(:last) end assert_equal last_developer, Developer.find(:all, :order => 'developers.salary ASC').last end - + def test_abstract_class assert !ActiveRecord::Base.abstract_class? assert LoosePerson.abstract_class? |