aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorSantiago Pastorino <santiago@wyeworks.com>2010-08-14 02:13:00 -0300
committerSantiago Pastorino <santiago@wyeworks.com>2010-08-14 04:12:33 -0300
commitb451de0d6de4df6bc66b274cec73b919f823d5ae (patch)
treef252c4143a0adb3be7d36d543282539cca0fb971 /activerecord/test
parent1590377886820e00b1a786616518a32f3b61ec0f (diff)
downloadrails-b451de0d6de4df6bc66b274cec73b919f823d5ae.tar.gz
rails-b451de0d6de4df6bc66b274cec73b919f823d5ae.tar.bz2
rails-b451de0d6de4df6bc66b274cec73b919f823d5ae.zip
Deletes trailing whitespaces (over text files only find * -type f -exec sed 's/[ \t]*$//' -i {} \;)
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/associations/has_many_through_associations_test.rb4
-rw-r--r--activerecord/test/cases/associations/has_one_through_associations_test.rb14
-rw-r--r--activerecord/test/cases/associations/join_model_test.rb10
-rw-r--r--activerecord/test/cases/associations_test.rb6
-rw-r--r--activerecord/test/cases/attribute_methods_test.rb8
-rw-r--r--activerecord/test/cases/autosave_association_test.rb2
-rw-r--r--activerecord/test/cases/counter_cache_test.rb2
-rw-r--r--activerecord/test/cases/defaults_test.rb6
-rw-r--r--activerecord/test/cases/dirty_test.rb14
-rw-r--r--activerecord/test/cases/fixtures_test.rb16
-rw-r--r--activerecord/test/cases/i18n_test.rb4
-rw-r--r--activerecord/test/cases/json_serialization_test.rb2
-rw-r--r--activerecord/test/cases/migration_test.rb4
-rw-r--r--activerecord/test/cases/modules_test.rb4
-rw-r--r--activerecord/test/cases/nested_attributes_test.rb20
-rw-r--r--activerecord/test/cases/persistence_test.rb4
-rw-r--r--activerecord/test/cases/reflection_test.rb2
-rw-r--r--activerecord/test/cases/relation_scoping_test.rb4
-rw-r--r--activerecord/test/cases/relations_test.rb4
-rw-r--r--activerecord/test/cases/serialization_test.rb2
-rw-r--r--activerecord/test/cases/timestamp_test.rb28
-rw-r--r--activerecord/test/fixtures/comments.yml4
-rw-r--r--activerecord/test/fixtures/companies.yml10
-rw-r--r--activerecord/test/fixtures/items.yml1
-rw-r--r--activerecord/test/fixtures/memberships.yml2
-rw-r--r--activerecord/test/fixtures/mixins.yml2
-rw-r--r--activerecord/test/fixtures/taggings.yml2
-rw-r--r--activerecord/test/fixtures/tags.yml2
-rw-r--r--activerecord/test/models/developer.rb2
-rw-r--r--activerecord/test/models/minivan.rb4
-rw-r--r--activerecord/test/models/post.rb2
-rw-r--r--activerecord/test/models/shop.rb2
-rw-r--r--activerecord/test/models/topic.rb2
-rw-r--r--activerecord/test/schema/postgresql_specific_schema.rb2
-rw-r--r--activerecord/test/schema/schema.rb6
35 files changed, 101 insertions, 102 deletions
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
diff --git a/activerecord/test/fixtures/comments.yml b/activerecord/test/fixtures/comments.yml
index 236bdb2e36..97d77f8b9a 100644
--- a/activerecord/test/fixtures/comments.yml
+++ b/activerecord/test/fixtures/comments.yml
@@ -9,7 +9,7 @@ more_greetings:
post_id: 1
body: Thank you again for the welcome
type: Comment
-
+
does_it_hurt:
id: 3
post_id: 2
@@ -37,7 +37,7 @@ eager_sti_on_associations_s_comment2:
eager_sti_on_associations_comment:
id: 8
post_id: 4
- body: Normal type
+ body: Normal type
type: Comment
check_eager_sti_on_associations:
diff --git a/activerecord/test/fixtures/companies.yml b/activerecord/test/fixtures/companies.yml
index 9ad68fbe11..ffaa097686 100644
--- a/activerecord/test/fixtures/companies.yml
+++ b/activerecord/test/fixtures/companies.yml
@@ -44,17 +44,17 @@ a_third_client:
ruby_type: Client
rails_core:
- id: 6
+ id: 6
name: RailsCore
type: DependentFirm
-
+
leetsoft:
- id: 7
+ id: 7
name: Leetsoft
client_of: 6
-
+
jadedpixel:
- id: 8
+ id: 8
name: Jadedpixel
client_of: 6
diff --git a/activerecord/test/fixtures/items.yml b/activerecord/test/fixtures/items.yml
index 31fd657df9..94e3821445 100644
--- a/activerecord/test/fixtures/items.yml
+++ b/activerecord/test/fixtures/items.yml
@@ -1,4 +1,3 @@
dvd:
id: 1
name: Godfather
- \ No newline at end of file
diff --git a/activerecord/test/fixtures/memberships.yml b/activerecord/test/fixtures/memberships.yml
index 99fbe46d9b..b9722dbc8a 100644
--- a/activerecord/test/fixtures/memberships.yml
+++ b/activerecord/test/fixtures/memberships.yml
@@ -4,7 +4,7 @@ membership_of_boring_club:
member: groucho
favourite: false
type: CurrentMembership
-
+
membership_of_favourite_club:
joined_on: <%= 3.weeks.ago.to_s(:db) %>
club: moustache_club
diff --git a/activerecord/test/fixtures/mixins.yml b/activerecord/test/fixtures/mixins.yml
index 0f60e92c2f..f0009cc5f0 100644
--- a/activerecord/test/fixtures/mixins.yml
+++ b/activerecord/test/fixtures/mixins.yml
@@ -1,6 +1,6 @@
# Nested set mixins
-<% (1..10).each do |counter| %>
+<% (1..10).each do |counter| %>
set_<%= counter %>:
id: <%= counter+3000 %>
<% end %>
diff --git a/activerecord/test/fixtures/taggings.yml b/activerecord/test/fixtures/taggings.yml
index 1e3d5965b8..3db6a4c079 100644
--- a/activerecord/test/fixtures/taggings.yml
+++ b/activerecord/test/fixtures/taggings.yml
@@ -11,7 +11,7 @@ thinking_general:
taggable_id: 2
taggable_type: Post
-fake:
+fake:
id: 3
tag_id: 1
taggable_id: 1
diff --git a/activerecord/test/fixtures/tags.yml b/activerecord/test/fixtures/tags.yml
index 471b96f362..7610fd38b9 100644
--- a/activerecord/test/fixtures/tags.yml
+++ b/activerecord/test/fixtures/tags.yml
@@ -1,7 +1,7 @@
general:
id: 1
name: General
-
+
misc:
id: 2
name: Misc \ No newline at end of file
diff --git a/activerecord/test/models/developer.rb b/activerecord/test/models/developer.rb
index c61c583c1d..a140fb8e57 100644
--- a/activerecord/test/models/developer.rb
+++ b/activerecord/test/models/developer.rb
@@ -56,7 +56,7 @@ class Developer < ActiveRecord::Base
audit_logs.build :message => message
end
- def self.all_johns
+ def self.all_johns
self.with_exclusive_scope :find => where(:name => 'John') do
self.all
end
diff --git a/activerecord/test/models/minivan.rb b/activerecord/test/models/minivan.rb
index 602438d16f..830cdb5796 100644
--- a/activerecord/test/models/minivan.rb
+++ b/activerecord/test/models/minivan.rb
@@ -1,9 +1,9 @@
class Minivan < ActiveRecord::Base
set_primary_key :minivan_id
-
+
belongs_to :speedometer
has_one :dashboard, :through => :speedometer
-
+
attr_readonly :color
end
diff --git a/activerecord/test/models/post.rb b/activerecord/test/models/post.rb
index 6c7b93be87..a3cb9c724a 100644
--- a/activerecord/test/models/post.rb
+++ b/activerecord/test/models/post.rb
@@ -87,7 +87,7 @@ class Post < ActiveRecord::Base
def self.reset_log
@log = []
end
-
+
def self.log(message=nil, side=nil, new_record=nil)
return @log if message.nil?
@log << [message, side, new_record]
diff --git a/activerecord/test/models/shop.rb b/activerecord/test/models/shop.rb
index b232185693..81414227ea 100644
--- a/activerecord/test/models/shop.rb
+++ b/activerecord/test/models/shop.rb
@@ -6,7 +6,7 @@ module Shop
class Product < ActiveRecord::Base
has_many :variants, :dependent => :delete_all
end
-
+
class Variant < ActiveRecord::Base
end
end
diff --git a/activerecord/test/models/topic.rb b/activerecord/test/models/topic.rb
index 617f01b47d..ba2fe1987b 100644
--- a/activerecord/test/models/topic.rb
+++ b/activerecord/test/models/topic.rb
@@ -9,7 +9,7 @@ class Topic < ActiveRecord::Base
scope :rejected, :conditions => {:approved => false}
scope :by_lifo, :conditions => {:author_name => 'lifo'}
-
+
scope :approved_as_hash_condition, :conditions => {:topics => {:approved => true}}
scope 'approved_as_string', :conditions => {:approved => true}
scope :replied, :conditions => ['replies_count > 0']
diff --git a/activerecord/test/schema/postgresql_specific_schema.rb b/activerecord/test/schema/postgresql_specific_schema.rb
index 065d8cfe98..f38f4f3b44 100644
--- a/activerecord/test/schema/postgresql_specific_schema.rb
+++ b/activerecord/test/schema/postgresql_specific_schema.rb
@@ -100,7 +100,7 @@ _SQL
obj_id OID
);
_SQL
-
+
execute <<_SQL
CREATE TABLE postgresql_timestamp_with_zones (
id SERIAL PRIMARY KEY,
diff --git a/activerecord/test/schema/schema.rb b/activerecord/test/schema/schema.rb
index c72f7b25ca..ce7ee78aea 100644
--- a/activerecord/test/schema/schema.rb
+++ b/activerecord/test/schema/schema.rb
@@ -164,7 +164,7 @@ ActiveRecord::Schema.define do
t.string :address_country
t.string :gps_location
end
-
+
create_table :dashboards, :force => true, :id => false do |t|
t.string :dashboard_id
t.string :name
@@ -299,7 +299,7 @@ ActiveRecord::Schema.define do
t.boolean :favourite
t.integer :lock_version, :default => 0
end
-
+
create_table :minivans, :force => true, :id => false do |t|
t.string :minivan_id
t.string :name
@@ -469,7 +469,7 @@ ActiveRecord::Schema.define do
t.string :name
t.integer :ship_id
end
-
+
create_table :speedometers, :force => true, :id => false do |t|
t.string :speedometer_id
t.string :name