From b451de0d6de4df6bc66b274cec73b919f823d5ae Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Sat, 14 Aug 2010 02:13:00 -0300 Subject: Deletes trailing whitespaces (over text files only find * -type f -exec sed 's/[ \t]*$//' -i {} \;) --- .../has_many_through_associations_test.rb | 4 ++-- .../has_one_through_associations_test.rb | 14 +++++------ .../test/cases/associations/join_model_test.rb | 10 ++++---- activerecord/test/cases/associations_test.rb | 6 ++--- activerecord/test/cases/attribute_methods_test.rb | 8 +++---- .../test/cases/autosave_association_test.rb | 2 +- activerecord/test/cases/counter_cache_test.rb | 2 +- activerecord/test/cases/defaults_test.rb | 6 ++--- activerecord/test/cases/dirty_test.rb | 14 +++++------ activerecord/test/cases/fixtures_test.rb | 16 ++++++------- activerecord/test/cases/i18n_test.rb | 4 ++-- activerecord/test/cases/json_serialization_test.rb | 2 +- activerecord/test/cases/migration_test.rb | 4 ++-- activerecord/test/cases/modules_test.rb | 4 ++-- activerecord/test/cases/nested_attributes_test.rb | 20 ++++++++-------- activerecord/test/cases/persistence_test.rb | 4 ++-- activerecord/test/cases/reflection_test.rb | 2 +- activerecord/test/cases/relation_scoping_test.rb | 4 ++-- activerecord/test/cases/relations_test.rb | 4 ++-- activerecord/test/cases/serialization_test.rb | 2 +- activerecord/test/cases/timestamp_test.rb | 28 +++++++++++----------- 21 files changed, 80 insertions(+), 80 deletions(-) (limited to 'activerecord/test/cases') diff --git a/activerecord/test/cases/associations/has_many_through_associations_test.rb b/activerecord/test/cases/associations/has_many_through_associations_test.rb index 0eaadac5ae..45f8bd64eb 100644 --- a/activerecord/test/cases/associations/has_many_through_associations_test.rb +++ b/activerecord/test/cases/associations/has_many_through_associations_test.rb @@ -19,8 +19,8 @@ require 'models/book' require 'models/subscription' class HasManyThroughAssociationsTest < ActiveRecord::TestCase - fixtures :posts, :readers, :people, :comments, :authors, - :owners, :pets, :toys, :jobs, :references, :companies, + fixtures :posts, :readers, :people, :comments, :authors, + :owners, :pets, :toys, :jobs, :references, :companies, :subscribers, :books, :subscriptions, :developers # Dummies to force column loads so query counts are clean. diff --git a/activerecord/test/cases/associations/has_one_through_associations_test.rb b/activerecord/test/cases/associations/has_one_through_associations_test.rb index 3fcd150422..5d153147f5 100644 --- a/activerecord/test/cases/associations/has_one_through_associations_test.rb +++ b/activerecord/test/cases/associations/has_one_through_associations_test.rb @@ -12,7 +12,7 @@ require 'models/speedometer' class HasOneThroughAssociationsTest < ActiveRecord::TestCase fixtures :member_types, :members, :clubs, :memberships, :sponsors, :organizations, :minivans, :dashboards, :speedometers - + def setup @member = members(:groucho) end @@ -24,7 +24,7 @@ class HasOneThroughAssociationsTest < ActiveRecord::TestCase def test_has_one_through_with_has_many assert_equal clubs(:moustache_club), @member.favourite_club end - + def test_creating_association_creates_through_record new_member = Member.create(:name => "Chris") new_member.club = Club.create(:name => "LRUG") @@ -41,19 +41,19 @@ class HasOneThroughAssociationsTest < ActiveRecord::TestCase assert new_member.save assert_equal clubs(:moustache_club), new_member.club end - + def test_replace_target_record new_club = Club.create(:name => "Marx Bros") @member.club = new_club @member.reload assert_equal new_club, @member.club end - + def test_replacing_target_record_deletes_old_association assert_no_difference "Membership.count" do new_club = Club.create(:name => "Bananarama") @member.club = new_club - @member.reload + @member.reload end end @@ -81,7 +81,7 @@ class HasOneThroughAssociationsTest < ActiveRecord::TestCase Member.find(:all, :include => :sponsor_club, :conditions => ["name = ?", "Groucho Marx"]) end assert_equal 1, members.size - assert_not_nil assert_no_queries {members[0].sponsor_club} + assert_not_nil assert_no_queries {members[0].sponsor_club} end def test_has_one_through_polymorphic_with_source_type @@ -205,7 +205,7 @@ class HasOneThroughAssociationsTest < ActiveRecord::TestCase Club.find(@club.id, :include => :sponsored_member).save! end end - + def test_value_is_properly_quoted minivan = Minivan.find('m1') assert_nothing_raised do diff --git a/activerecord/test/cases/associations/join_model_test.rb b/activerecord/test/cases/associations/join_model_test.rb index 447fe4d275..fcdb81e92e 100644 --- a/activerecord/test/cases/associations/join_model_test.rb +++ b/activerecord/test/cases/associations/join_model_test.rb @@ -43,11 +43,11 @@ class AssociationsJoinModelTest < ActiveRecord::TestCase assert_queries(1) { assert_equal 0, author.unique_categorized_posts.count(:title, :conditions => "title is NULL") } assert !authors(:mary).unique_categorized_posts.loaded? end - + def test_has_many_uniq_through_find assert_equal 1, authors(:mary).unique_categorized_posts.find(:all).size end - + def test_has_many_uniq_through_dynamic_find assert_equal 1, authors(:mary).unique_categorized_posts.find_all_by_title("So I was thinking").size end @@ -297,7 +297,7 @@ class AssociationsJoinModelTest < ActiveRecord::TestCase assert_equal [], posts(:thinking).authors assert_equal [authors(:mary)], posts(:authorless).authors end - + def test_both_scoped_and_explicit_joins_should_be_respected assert_nothing_raised do Post.send(:with_scope, :find => {:joins => "left outer join comments on comments.id = posts.id"}) do @@ -575,7 +575,7 @@ class AssociationsJoinModelTest < ActiveRecord::TestCase def test_calculations_on_has_many_through_should_disambiguate_fields assert_nothing_raised { authors(:david).categories.maximum(:id) } end - + def test_calculations_on_has_many_through_should_not_disambiguate_fields_unless_necessary assert_nothing_raised { authors(:david).categories.maximum("categories.id") } end @@ -675,7 +675,7 @@ class AssociationsJoinModelTest < ActiveRecord::TestCase end assert ! david.categories.loaded? end - + def test_has_many_through_include_returns_false_for_non_matching_record_to_verify_scoping david = authors(:david) category = Category.create!(:name => 'Not Associated') diff --git a/activerecord/test/cases/associations_test.rb b/activerecord/test/cases/associations_test.rb index b31611e27a..dd8152b219 100644 --- a/activerecord/test/cases/associations_test.rb +++ b/activerecord/test/cases/associations_test.rb @@ -70,7 +70,7 @@ class AssociationsTest < ActiveRecord::TestCase ship.parts.send(:load_target) assert_equal 'Deck', ship.parts[0].name end - + def test_include_with_order_works assert_nothing_raised {Account.find(:first, :order => 'id', :include => :firm)} @@ -107,7 +107,7 @@ class AssociationsTest < ActiveRecord::TestCase assert !firm.clients(true).empty?, "New firm should have reloaded client objects" assert_equal 1, firm.clients(true).size, "New firm should have reloaded clients count" end - + def test_using_limitable_reflections_helper using_limitable_reflections = lambda { |reflections| Tagging.scoped.send :using_limitable_reflections?, reflections } belongs_to_reflections = [Tagging.reflect_on_association(:tag), Tagging.reflect_on_association(:super_tag)] @@ -117,7 +117,7 @@ class AssociationsTest < ActiveRecord::TestCase assert !using_limitable_reflections.call(has_many_reflections), "All has many style associations are not limitable" assert !using_limitable_reflections.call(mixed_reflections), "No collection associations (has many style) should pass" end - + def test_force_reload_is_uncached firm = Firm.create!("name" => "A New Firm, Inc") client = Client.create!("name" => "TheClient.com", :firm => firm) diff --git a/activerecord/test/cases/attribute_methods_test.rb b/activerecord/test/cases/attribute_methods_test.rb index 2c069cd8a5..d9e5efa8da 100644 --- a/activerecord/test/cases/attribute_methods_test.rb +++ b/activerecord/test/cases/attribute_methods_test.rb @@ -10,7 +10,7 @@ require 'models/reply' class AttributeMethodsTest < ActiveRecord::TestCase fixtures :topics, :developers, :companies, :computers - + def setup @old_matchers = ActiveRecord::Base.send(:attribute_method_matchers).dup @target = Class.new(ActiveRecord::Base) @@ -534,9 +534,9 @@ class AttributeMethodsTest < ActiveRecord::TestCase def test_setting_time_zone_conversion_for_attributes_should_write_value_on_class_variable Topic.skip_time_zone_conversion_for_attributes = [:field_a] Minimalistic.skip_time_zone_conversion_for_attributes = [:field_b] - - assert_equal [:field_a], Topic.skip_time_zone_conversion_for_attributes - assert_equal [:field_b], Minimalistic.skip_time_zone_conversion_for_attributes + + assert_equal [:field_a], Topic.skip_time_zone_conversion_for_attributes + assert_equal [:field_b], Minimalistic.skip_time_zone_conversion_for_attributes end def test_read_attributes_respect_access_control diff --git a/activerecord/test/cases/autosave_association_test.rb b/activerecord/test/cases/autosave_association_test.rb index 49e7147773..4693cb45fc 100644 --- a/activerecord/test/cases/autosave_association_test.rb +++ b/activerecord/test/cases/autosave_association_test.rb @@ -685,7 +685,7 @@ class TestDestroyAsPartOfAutosaveAssociation < ActiveRecord::TestCase end assert_difference("#{association_name.classify}.count", -2) { @pirate.save! } end - + define_method("test_should_skip_validation_on_the_#{association_name}_association_if_destroyed") do @pirate.send(association_name).create!(:name => "#{association_name}_1") children = @pirate.send(association_name) diff --git a/activerecord/test/cases/counter_cache_test.rb b/activerecord/test/cases/counter_cache_test.rb index 137236255d..3ed96a3ec8 100644 --- a/activerecord/test/cases/counter_cache_test.rb +++ b/activerecord/test/cases/counter_cache_test.rb @@ -43,7 +43,7 @@ class CounterCacheTest < ActiveRecord::TestCase Topic.reset_counters(@topic.id, :replies) end end - + test "reset counters with string argument" do Topic.increment_counter('replies_count', @topic.id) diff --git a/activerecord/test/cases/defaults_test.rb b/activerecord/test/cases/defaults_test.rb index 0e90128907..deaf5252db 100644 --- a/activerecord/test/cases/defaults_test.rb +++ b/activerecord/test/cases/defaults_test.rb @@ -29,7 +29,7 @@ class DefaultTest < ActiveRecord::TestCase assert_equal BigDecimal.new("2.78"), default.decimal_number end end - + if current_adapter?(:PostgreSQLAdapter) def test_multiline_default_text # older postgres versions represent the default with escapes ("\\012" for a newline) @@ -50,7 +50,7 @@ if current_adapter?(:MysqlAdapter) or current_adapter?(:Mysql2Adapter) # # We don't want that to happen, so we disable transactional fixtures here. self.use_transactional_fixtures = false - + # MySQL 5 and higher is quirky with not null text/blob columns. # With MySQL Text/blob columns cannot have defaults. If the column is not # null MySQL will report that the column has a null default @@ -80,7 +80,7 @@ if current_adapter?(:MysqlAdapter) or current_adapter?(:Mysql2Adapter) ensure klass.connection.drop_table(klass.table_name) rescue nil end - + # MySQL uses an implicit default 0 rather than NULL unless in strict mode. # We use an implicit NULL so schema.rb is compatible with other databases. def test_mysql_integer_not_null_defaults diff --git a/activerecord/test/cases/dirty_test.rb b/activerecord/test/cases/dirty_test.rb index 75f7453aa9..bde93d1c85 100644 --- a/activerecord/test/cases/dirty_test.rb +++ b/activerecord/test/cases/dirty_test.rb @@ -408,11 +408,11 @@ class DirtyTest < ActiveRecord::TestCase def test_previous_changes # original values should be in previous_changes pirate = Pirate.new - + assert_equal Hash.new, pirate.previous_changes pirate.catchphrase = "arrr" pirate.save! - + assert_equal 4, pirate.previous_changes.size assert_equal [nil, "arrr"], pirate.previous_changes['catchphrase'] assert_equal [nil, pirate.id], pirate.previous_changes['id'] @@ -421,21 +421,21 @@ class DirtyTest < ActiveRecord::TestCase assert_nil pirate.previous_changes['created_on'][0] assert_not_nil pirate.previous_changes['created_on'][1] assert !pirate.previous_changes.key?('parrot_id') - + # original values should be in previous_changes pirate = Pirate.new - + assert_equal Hash.new, pirate.previous_changes pirate.catchphrase = "arrr" pirate.save - + assert_equal 4, pirate.previous_changes.size assert_equal [nil, "arrr"], pirate.previous_changes['catchphrase'] assert_equal [nil, pirate.id], pirate.previous_changes['id'] assert pirate.previous_changes.include?('updated_on') assert pirate.previous_changes.include?('created_on') assert !pirate.previous_changes.key?('parrot_id') - + pirate.catchphrase = "Yar!!" pirate.reload assert_equal Hash.new, pirate.previous_changes @@ -480,7 +480,7 @@ class DirtyTest < ActiveRecord::TestCase assert_not_nil pirate.previous_changes['updated_on'][0] assert_not_nil pirate.previous_changes['updated_on'][1] assert !pirate.previous_changes.key?('parrot_id') - assert !pirate.previous_changes.key?('created_on') + assert !pirate.previous_changes.key?('created_on') end private diff --git a/activerecord/test/cases/fixtures_test.rb b/activerecord/test/cases/fixtures_test.rb index a8c1c04f8b..d5ef30e137 100644 --- a/activerecord/test/cases/fixtures_test.rb +++ b/activerecord/test/cases/fixtures_test.rb @@ -101,7 +101,7 @@ class FixturesTest < ActiveRecord::TestCase second_row = ActiveRecord::Base.connection.select_one("SELECT * FROM prefix_topics_suffix WHERE author_name = 'Mary'") assert_nil(second_row["author_email_address"]) - # This checks for a caching problem which causes a bug in the fixtures + # This checks for a caching problem which causes a bug in the fixtures # class-level configuration helper. assert_not_nil topics, "Fixture data inserted, but fixture objects not returned from create" ensure @@ -267,7 +267,7 @@ class FixturesWithoutInstantiationTest < ActiveRecord::TestCase def test_fixtures_from_root_yml_without_instantiation assert !defined?(@unknown), "@unknown is not defined" end - + def test_visibility_of_accessor_method assert_equal false, respond_to?(:topics, false), "should be private method" assert_equal true, respond_to?(:topics, true), "confirm to respond surely" @@ -382,7 +382,7 @@ end class CheckSetTableNameFixturesTest < ActiveRecord::TestCase set_fixture_class :funny_jokes => 'Joke' fixtures :funny_jokes - # Set to false to blow away fixtures cache and ensure our fixtures are loaded + # Set to false to blow away fixtures cache and ensure our fixtures are loaded # and thus takes into account our set_fixture_class self.use_transactional_fixtures = false @@ -394,7 +394,7 @@ end class FixtureNameIsNotTableNameFixturesTest < ActiveRecord::TestCase set_fixture_class :items => Book fixtures :items - # Set to false to blow away fixtures cache and ensure our fixtures are loaded + # Set to false to blow away fixtures cache and ensure our fixtures are loaded # and thus takes into account our set_fixture_class self.use_transactional_fixtures = false @@ -406,7 +406,7 @@ end class FixtureNameIsNotTableNameMultipleFixturesTest < ActiveRecord::TestCase set_fixture_class :items => Book, :funny_jokes => Joke fixtures :items, :funny_jokes - # Set to false to blow away fixtures cache and ensure our fixtures are loaded + # Set to false to blow away fixtures cache and ensure our fixtures are loaded # and thus takes into account our set_fixture_class self.use_transactional_fixtures = false @@ -422,7 +422,7 @@ end class CustomConnectionFixturesTest < ActiveRecord::TestCase set_fixture_class :courses => Course fixtures :courses - # Set to false to blow away fixtures cache and ensure our fixtures are loaded + # Set to false to blow away fixtures cache and ensure our fixtures are loaded # and thus takes into account our set_fixture_class self.use_transactional_fixtures = false @@ -434,7 +434,7 @@ end class InvalidTableNameFixturesTest < ActiveRecord::TestCase fixtures :funny_jokes - # Set to false to blow away fixtures cache and ensure our fixtures are loaded + # Set to false to blow away fixtures cache and ensure our fixtures are loaded # and thus takes into account our lack of set_fixture_class self.use_transactional_fixtures = false @@ -448,7 +448,7 @@ end class CheckEscapedYamlFixturesTest < ActiveRecord::TestCase set_fixture_class :funny_jokes => 'Joke' fixtures :funny_jokes - # Set to false to blow away fixtures cache and ensure our fixtures are loaded + # Set to false to blow away fixtures cache and ensure our fixtures are loaded # and thus takes into account our set_fixture_class self.use_transactional_fixtures = false diff --git a/activerecord/test/cases/i18n_test.rb b/activerecord/test/cases/i18n_test.rb index 3287626378..469f513e68 100644 --- a/activerecord/test/cases/i18n_test.rb +++ b/activerecord/test/cases/i18n_test.rb @@ -7,12 +7,12 @@ class ActiveRecordI18nTests < ActiveRecord::TestCase def setup I18n.backend = I18n::Backend::Simple.new end - + def test_translated_model_attributes I18n.backend.store_translations 'en', :activerecord => {:attributes => {:topic => {:title => 'topic title attribute'} } } assert_equal 'topic title attribute', Topic.human_attribute_name('title') end - + def test_translated_model_attributes_with_symbols I18n.backend.store_translations 'en', :activerecord => {:attributes => {:topic => {:title => 'topic title attribute'} } } assert_equal 'topic title attribute', Topic.human_attribute_name(:title) diff --git a/activerecord/test/cases/json_serialization_test.rb b/activerecord/test/cases/json_serialization_test.rb index 2bc746c0b8..a5736b227d 100644 --- a/activerecord/test/cases/json_serialization_test.rb +++ b/activerecord/test/cases/json_serialization_test.rb @@ -204,7 +204,7 @@ class DatabaseConnectedJsonEncodingTest < ActiveRecord::TestCase def test_should_be_able_to_encode_relation authors_relation = Author.where(:id => [@david.id, @mary.id]) - + json = ActiveSupport::JSON.encode authors_relation, :only => :name assert_equal '[{"author":{"name":"David"}},{"author":{"name":"Mary"}}]', json end diff --git a/activerecord/test/cases/migration_test.rb b/activerecord/test/cases/migration_test.rb index 0cf3979694..8d35f26b30 100644 --- a/activerecord/test/cases/migration_test.rb +++ b/activerecord/test/cases/migration_test.rb @@ -1358,10 +1358,10 @@ if ActiveRecord::Base.connection.supports_migrations? ActiveRecord::Migrator.forward(MIGRATIONS_ROOT + "/valid") assert_equal(3, ActiveRecord::Migrator.current_version) end - + def test_get_all_versions ActiveRecord::Migrator.migrate(MIGRATIONS_ROOT + "/valid") - assert_equal([1,2,3], ActiveRecord::Migrator.get_all_versions) + assert_equal([1,2,3], ActiveRecord::Migrator.get_all_versions) ActiveRecord::Migrator.rollback(MIGRATIONS_ROOT + "/valid") assert_equal([1,2], ActiveRecord::Migrator.get_all_versions) diff --git a/activerecord/test/cases/modules_test.rb b/activerecord/test/cases/modules_test.rb index 4b635792c7..14870cb0e2 100644 --- a/activerecord/test/cases/modules_test.rb +++ b/activerecord/test/cases/modules_test.rb @@ -13,7 +13,7 @@ class ModulesTest < ActiveRecord::TestCase [:Firm, :Client].each do |const| @undefined_consts.merge! const => Object.send(:remove_const, const) if Object.const_defined?(const) end - + ActiveRecord::Base.store_full_sti_class = false end @@ -22,7 +22,7 @@ class ModulesTest < ActiveRecord::TestCase @undefined_consts.each do |constant, value| Object.send :const_set, constant, value unless value.nil? end - + ActiveRecord::Base.store_full_sti_class = true end diff --git a/activerecord/test/cases/nested_attributes_test.rb b/activerecord/test/cases/nested_attributes_test.rb index dbe17a187f..01152b074f 100644 --- a/activerecord/test/cases/nested_attributes_test.rb +++ b/activerecord/test/cases/nested_attributes_test.rb @@ -39,7 +39,7 @@ class TestNestedAttributesInGeneral < ActiveRecord::TestCase def test_should_add_a_proc_to_nested_attributes_options assert_equal ActiveRecord::NestedAttributes::ClassMethods::REJECT_ALL_BLANK_PROC, Pirate.nested_attributes_options[:birds_with_reject_all_blank][:reject_if] - + [:parrots, :birds].each do |name| assert_instance_of Proc, Pirate.nested_attributes_options[name][:reject_if] end @@ -817,29 +817,29 @@ class TestHasOneAutosaveAssociationWhichItselfHasAutosaveAssociations < ActiveRe @part = @ship.parts.create!(:name => "Mast") @trinket = @part.trinkets.create!(:name => "Necklace") end - + test "when great-grandchild changed in memory, saving parent should save great-grandchild" do @trinket.name = "changed" @pirate.save assert_equal "changed", @trinket.reload.name end - + test "when great-grandchild changed via attributes, saving parent should save great-grandchild" do @pirate.attributes = {:ship_attributes => {:id => @ship.id, :parts_attributes => [{:id => @part.id, :trinkets_attributes => [{:id => @trinket.id, :name => "changed"}]}]}} @pirate.save assert_equal "changed", @trinket.reload.name end - + test "when great-grandchild marked_for_destruction via attributes, saving parent should destroy great-grandchild" do @pirate.attributes = {:ship_attributes => {:id => @ship.id, :parts_attributes => [{:id => @part.id, :trinkets_attributes => [{:id => @trinket.id, :_destroy => true}]}]}} assert_difference('@part.trinkets.count', -1) { @pirate.save } end - + test "when great-grandchild added via attributes, saving parent should create great-grandchild" do @pirate.attributes = {:ship_attributes => {:id => @ship.id, :parts_attributes => [{:id => @part.id, :trinkets_attributes => [{:name => "created"}]}]}} assert_difference('@part.trinkets.count', 1) { @pirate.save } end - + test "when extra records exist for associations, validate (which calls nested_records_changed_for_autosave?) should not load them up" do @trinket.name = "changed" Ship.create!(:pirate => @pirate, :name => "The Black Rock") @@ -880,23 +880,23 @@ class TestHasManyAutosaveAssociationWhichItselfHasAutosaveAssociations < ActiveR @ship.save assert_equal "changed", @trinket.reload.name end - + test "when grandchild changed via attributes, saving parent should save grandchild" do @ship.attributes = {:parts_attributes => [{:id => @part.id, :trinkets_attributes => [{:id => @trinket.id, :name => "changed"}]}]} @ship.save assert_equal "changed", @trinket.reload.name end - + test "when grandchild marked_for_destruction via attributes, saving parent should destroy grandchild" do @ship.attributes = {:parts_attributes => [{:id => @part.id, :trinkets_attributes => [{:id => @trinket.id, :_destroy => true}]}]} assert_difference('@part.trinkets.count', -1) { @ship.save } end - + test "when grandchild added via attributes, saving parent should create grandchild" do @ship.attributes = {:parts_attributes => [{:id => @part.id, :trinkets_attributes => [{:name => "created"}]}]} assert_difference('@part.trinkets.count', 1) { @ship.save } end - + test "when extra records exist for associations, validate (which calls nested_records_changed_for_autosave?) should not load them up" do @trinket.name = "changed" Ship.create!(:name => "The Black Rock") diff --git a/activerecord/test/cases/persistence_test.rb b/activerecord/test/cases/persistence_test.rb index c90c787950..13efd2576c 100644 --- a/activerecord/test/cases/persistence_test.rb +++ b/activerecord/test/cases/persistence_test.rb @@ -334,7 +334,7 @@ class PersistencesTest < ActiveRecord::TestCase end # This test is correct, but it is hard to fix it since - # update_attribute trigger simply call save! that triggers + # update_attribute trigger simply call save! that triggers # all callbacks. # def test_update_attribute_with_one_changed_and_one_updated # t = Topic.order('id').limit(1).first @@ -348,7 +348,7 @@ class PersistencesTest < ActiveRecord::TestCase # assert !t.title_changed?, "title should not have changed" # assert_nil t.title_change, 'title change should be nil' # assert_equal ['author_name'], t.changed - # + # # t.reload # assert_equal 'David', t.author_name # assert_equal 'super_title', t.title diff --git a/activerecord/test/cases/reflection_test.rb b/activerecord/test/cases/reflection_test.rb index 03c4fc4e80..eeb619ac2f 100644 --- a/activerecord/test/cases/reflection_test.rb +++ b/activerecord/test/cases/reflection_test.rb @@ -135,7 +135,7 @@ class ReflectionTest < ActiveRecord::TestCase def test_association_reflection_in_modules ActiveRecord::Base.store_full_sti_class = false - + assert_reflection MyApplication::Business::Firm, :clients_of_firm, :klass => MyApplication::Business::Client, diff --git a/activerecord/test/cases/relation_scoping_test.rb b/activerecord/test/cases/relation_scoping_test.rb index a50a4d4165..9494990b04 100644 --- a/activerecord/test/cases/relation_scoping_test.rb +++ b/activerecord/test/cases/relation_scoping_test.rb @@ -339,7 +339,7 @@ class DefaultScopingTest < ActiveRecord::TestCase def test_default_scoping_with_inheritance # Inherit a class having a default scope and define a new default scope klass = Class.new(DeveloperOrderedBySalary) - klass.send :default_scope, :limit => 1 + klass.send :default_scope, :limit => 1 # Scopes added on children should append to parent scope assert_equal 1, klass.scoped.limit_value @@ -413,7 +413,7 @@ class DefaultScopingTest < ActiveRecord::TestCase assert_equal 'David', PoorDeveloperCalledJamis.create!(:name => 'David').name assert_equal 200000, PoorDeveloperCalledJamis.create!(:name => 'David', :salary => 200000).salary end - + def test_create_attribute_overwrites_default_values assert_equal nil, PoorDeveloperCalledJamis.create!(:salary => nil).salary assert_equal 50000, PoorDeveloperCalledJamis.create!(:name => 'David').salary diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb index bcc36d79be..bd6e216c62 100644 --- a/activerecord/test/cases/relations_test.rb +++ b/activerecord/test/cases/relations_test.rb @@ -21,8 +21,8 @@ class RelationTest < ActiveRecord::TestCase def test_two_named_scopes_with_includes_should_not_drop_any_include car = Car.incl_engines.incl_tyres.first - assert_no_queries { car.tyres.length } - assert_no_queries { car.engines.length } + assert_no_queries { car.tyres.length } + assert_no_queries { car.engines.length } end def test_apply_relation_as_where_id diff --git a/activerecord/test/cases/serialization_test.rb b/activerecord/test/cases/serialization_test.rb index dab81530af..25dbcc9fc2 100644 --- a/activerecord/test/cases/serialization_test.rb +++ b/activerecord/test/cases/serialization_test.rb @@ -5,7 +5,7 @@ require 'models/reply' require 'models/company' class SerializationTest < ActiveRecord::TestCase - + fixtures :topics, :companies, :accounts FORMATS = [ :xml, :json ] diff --git a/activerecord/test/cases/timestamp_test.rb b/activerecord/test/cases/timestamp_test.rb index 401439994d..597b954d84 100644 --- a/activerecord/test/cases/timestamp_test.rb +++ b/activerecord/test/cases/timestamp_test.rb @@ -15,21 +15,21 @@ class TimestampTest < ActiveRecord::TestCase def test_saving_a_changed_record_updates_its_timestamp @developer.name = "Jack Bauer" @developer.save! - + assert_not_equal @previously_updated_at, @developer.updated_at end - + def test_saving_a_unchanged_record_doesnt_update_its_timestamp @developer.save! - + assert_equal @previously_updated_at, @developer.updated_at end - + def test_touching_a_record_updates_its_timestamp previous_salary = @developer.salary @developer.salary = previous_salary + 10000 @developer.touch - + assert_not_equal @previously_updated_at, @developer.updated_at assert_equal previous_salary + 10000, @developer.salary assert @developer.salary_changed?, 'developer salary should have changed' @@ -37,7 +37,7 @@ class TimestampTest < ActiveRecord::TestCase @developer.reload assert_equal previous_salary, @developer.salary end - + def test_touching_a_different_attribute previously_created_at = @developer.created_at @developer.touch(:created_at) @@ -47,15 +47,15 @@ class TimestampTest < ActiveRecord::TestCase assert_not_equal previously_created_at, @developer.created_at assert_not_equal @previously_updated_at, @developer.updated_at end - + def test_saving_a_record_with_a_belongs_to_that_specifies_touching_the_parent_should_update_the_parent_updated_at pet = Pet.first owner = pet.owner previously_owner_updated_at = owner.updated_at - + pet.name = "Fluffy the Third" pet.save - + assert_not_equal previously_owner_updated_at, pet.owner.updated_at end @@ -63,22 +63,22 @@ class TimestampTest < ActiveRecord::TestCase pet = Pet.first owner = pet.owner previously_owner_updated_at = owner.updated_at - + pet.destroy - + assert_not_equal previously_owner_updated_at, pet.owner.updated_at end - + def test_saving_a_record_with_a_belongs_to_that_specifies_touching_a_specific_attribute_the_parent_should_update_that_attribute Pet.belongs_to :owner, :touch => :happy_at pet = Pet.first owner = pet.owner previously_owner_happy_at = owner.happy_at - + pet.name = "Fluffy the Third" pet.save - + assert_not_equal previously_owner_happy_at, pet.owner.happy_at ensure Pet.belongs_to :owner, :touch => true -- cgit v1.2.3