removing many unused variables
This commit is contained in:
parent
08c64bbd39
commit
2738ec891b
@ -551,8 +551,8 @@ class InverseMultipleHasManyInversesForSameModel < ActiveRecord::TestCase
|
||||
def test_that_we_can_load_associations_that_have_the_same_reciprocal_name_from_different_models
|
||||
assert_nothing_raised(ActiveRecord::AssociationTypeMismatch) do
|
||||
i = Interest.find(:first)
|
||||
z = i.zine
|
||||
m = i.man
|
||||
i.zine
|
||||
i.man
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -120,7 +120,7 @@ def test_using_limitable_reflections_helper
|
||||
|
||||
def test_force_reload_is_uncached
|
||||
firm = Firm.create!("name" => "A New Firm, Inc")
|
||||
client = Client.create!("name" => "TheClient.com", :firm => firm)
|
||||
Client.create!("name" => "TheClient.com", :firm => firm)
|
||||
ActiveRecord::Base.cache do
|
||||
firm.clients.each {}
|
||||
assert_queries(0) { assert_not_nil firm.clients.each {} }
|
||||
|
@ -568,7 +568,7 @@ def test_question_attributes_respect_access_control
|
||||
def test_bulk_update_respects_access_control
|
||||
privatize("title=(value)")
|
||||
|
||||
assert_raise(ActiveRecord::UnknownAttributeError) { topic = @target.new(:title => "Rants about pants") }
|
||||
assert_raise(ActiveRecord::UnknownAttributeError) { @target.new(:title => "Rants about pants") }
|
||||
assert_raise(ActiveRecord::UnknownAttributeError) { @target.new.attributes = { :title => "Ants in pants" } }
|
||||
end
|
||||
|
||||
|
@ -355,8 +355,6 @@ def test_invalid_adding
|
||||
end
|
||||
|
||||
def test_invalid_adding_before_save
|
||||
no_of_firms = Firm.count
|
||||
no_of_clients = Client.count
|
||||
new_firm = Firm.new("name" => "A New Firm, Inc")
|
||||
new_firm.clients_of_firm.concat([c = Client.new, Client.new("name" => "Apple")])
|
||||
assert !c.persisted?
|
||||
@ -461,7 +459,7 @@ def test_build_before_save
|
||||
|
||||
def test_build_many_before_save
|
||||
company = companies(:first_firm)
|
||||
new_clients = assert_no_queries { company.clients_of_firm.build([{"name" => "Another Client"}, {"name" => "Another Client II"}]) }
|
||||
assert_no_queries { company.clients_of_firm.build([{"name" => "Another Client"}, {"name" => "Another Client II"}]) }
|
||||
|
||||
company.name += '-changed'
|
||||
assert_queries(3) { assert company.save }
|
||||
@ -481,7 +479,7 @@ def test_build_via_block_before_save
|
||||
|
||||
def test_build_many_via_block_before_save
|
||||
company = companies(:first_firm)
|
||||
new_clients = assert_no_queries do
|
||||
assert_no_queries do
|
||||
company.clients_of_firm.build([{"name" => "Another Client"}, {"name" => "Another Client II"}]) do |client|
|
||||
client.name = "changed"
|
||||
end
|
||||
|
@ -182,7 +182,7 @@ def test_initialize_with_attributes
|
||||
|
||||
def test_initialize_with_invalid_attribute
|
||||
begin
|
||||
topic = Topic.new({ "title" => "test",
|
||||
Topic.new({ "title" => "test",
|
||||
"last_read(1i)" => "2005", "last_read(2i)" => "2", "last_read(3i)" => "31"})
|
||||
rescue ActiveRecord::MultiparameterAssignmentErrors => ex
|
||||
assert_equal(1, ex.errors.size)
|
||||
@ -972,7 +972,6 @@ def test_serialized_string_attribute
|
||||
end
|
||||
|
||||
def test_nil_serialized_attribute_with_class_constraint
|
||||
myobj = MyObject.new('value1', 'value2')
|
||||
topic = Topic.new
|
||||
assert_nil topic.content
|
||||
end
|
||||
|
@ -949,7 +949,7 @@ def test_find_by_id_with_conditions_with_or
|
||||
|
||||
# http://dev.rubyonrails.org/ticket/6778
|
||||
def test_find_ignores_previously_inserted_record
|
||||
post = Post.create!(:title => 'test', :body => 'it out')
|
||||
Post.create!(:title => 'test', :body => 'it out')
|
||||
assert_equal [], Post.find_all_by_id(nil)
|
||||
end
|
||||
|
||||
|
@ -58,7 +58,7 @@ def test_attributes
|
||||
end
|
||||
|
||||
def test_inserts
|
||||
topics = create_fixtures("topics")
|
||||
create_fixtures("topics")
|
||||
first_row = ActiveRecord::Base.connection.select_one("SELECT * FROM topics WHERE author_name = 'David'")
|
||||
assert_equal("The First Topic", first_row["title"])
|
||||
|
||||
@ -114,7 +114,7 @@ def test_inserts_with_pre_and_suffix
|
||||
end
|
||||
|
||||
def test_insert_with_datetime
|
||||
topics = create_fixtures("tasks")
|
||||
create_fixtures("tasks")
|
||||
first = Task.find(1)
|
||||
assert first
|
||||
end
|
||||
@ -240,7 +240,7 @@ def test_resets_to_min_pk_with_default_pk_and_sequence
|
||||
|
||||
def test_create_fixtures_resets_sequences_when_not_cached
|
||||
@instances.each do |instance|
|
||||
max_id = create_fixtures(instance.class.table_name).inject(0) do |_max_id, (name, fixture)|
|
||||
max_id = create_fixtures(instance.class.table_name).inject(0) do |_max_id, (_, fixture)|
|
||||
fixture_id = fixture['id'].to_i
|
||||
fixture_id > _max_id ? fixture_id : _max_id
|
||||
end
|
||||
|
@ -1947,7 +1947,7 @@ def test_copying_migrations_with_timestamps
|
||||
@migrations_path = MIGRATIONS_ROOT + "/valid_with_timestamps"
|
||||
@existing_migrations = Dir[@migrations_path + "/*.rb"]
|
||||
|
||||
Time.travel_to(created_at = Time.utc(2010, 7, 26, 10, 10, 10)) do
|
||||
Time.travel_to(Time.utc(2010, 7, 26, 10, 10, 10)) do
|
||||
copied = ActiveRecord::Migration.copy(@migrations_path, {:bukkits => MIGRATIONS_ROOT + "/to_copy_with_timestamps"})
|
||||
assert File.exists?(@migrations_path + "/20100726101010_people_have_hobbies.rb")
|
||||
assert File.exists?(@migrations_path + "/20100726101011_people_have_descriptions.rb")
|
||||
@ -1972,7 +1972,7 @@ def test_copying_migrations_with_timestamps_from_2_sources
|
||||
sources[:bukkits] = MIGRATIONS_ROOT + "/to_copy_with_timestamps"
|
||||
sources[:omg] = MIGRATIONS_ROOT + "/to_copy_with_timestamps2"
|
||||
|
||||
Time.travel_to(created_at = Time.utc(2010, 7, 26, 10, 10, 10)) do
|
||||
Time.travel_to(Time.utc(2010, 7, 26, 10, 10, 10)) do
|
||||
copied = ActiveRecord::Migration.copy(@migrations_path, sources)
|
||||
assert File.exists?(@migrations_path + "/20100726101010_people_have_hobbies.rb")
|
||||
assert File.exists?(@migrations_path + "/20100726101011_people_have_descriptions.rb")
|
||||
@ -1992,7 +1992,7 @@ def test_copying_migrations_with_timestamps_to_destination_with_timestamps_in_fu
|
||||
@migrations_path = MIGRATIONS_ROOT + "/valid_with_timestamps"
|
||||
@existing_migrations = Dir[@migrations_path + "/*.rb"]
|
||||
|
||||
Time.travel_to(created_at = Time.utc(2010, 2, 20, 10, 10, 10)) do
|
||||
Time.travel_to(Time.utc(2010, 2, 20, 10, 10, 10)) do
|
||||
ActiveRecord::Migration.copy(@migrations_path, {:bukkits => MIGRATIONS_ROOT + "/to_copy_with_timestamps"})
|
||||
assert File.exists?(@migrations_path + "/20100301010102_people_have_hobbies.rb")
|
||||
assert File.exists?(@migrations_path + "/20100301010103_people_have_descriptions.rb")
|
||||
@ -2028,7 +2028,7 @@ def test_copying_migrations_to_non_existing_directory
|
||||
@migrations_path = MIGRATIONS_ROOT + "/non_existing"
|
||||
@existing_migrations = []
|
||||
|
||||
Time.travel_to(created_at = Time.utc(2010, 7, 26, 10, 10, 10)) do
|
||||
Time.travel_to(Time.utc(2010, 7, 26, 10, 10, 10)) do
|
||||
copied = ActiveRecord::Migration.copy(@migrations_path, {:bukkits => MIGRATIONS_ROOT + "/to_copy_with_timestamps"})
|
||||
assert File.exists?(@migrations_path + "/20100726101010_people_have_hobbies.rb")
|
||||
assert File.exists?(@migrations_path + "/20100726101011_people_have_descriptions.rb")
|
||||
@ -2043,7 +2043,7 @@ def test_copying_migrations_to_empty_directory
|
||||
@migrations_path = MIGRATIONS_ROOT + "/empty"
|
||||
@existing_migrations = []
|
||||
|
||||
Time.travel_to(created_at = Time.utc(2010, 7, 26, 10, 10, 10)) do
|
||||
Time.travel_to(Time.utc(2010, 7, 26, 10, 10, 10)) do
|
||||
copied = ActiveRecord::Migration.copy(@migrations_path, {:bukkits => MIGRATIONS_ROOT + "/to_copy_with_timestamps"})
|
||||
assert File.exists?(@migrations_path + "/20100726101010_people_have_hobbies.rb")
|
||||
assert File.exists?(@migrations_path + "/20100726101011_people_have_descriptions.rb")
|
||||
|
@ -192,7 +192,6 @@ def test_create_through_factory_with_block
|
||||
topic = Topic.create("title" => "New Topic") do |t|
|
||||
t.author_name = "David"
|
||||
end
|
||||
topicReloaded = Topic.find(topic.id)
|
||||
assert_equal("New Topic", topic.title)
|
||||
assert_equal("David", topic.author_name)
|
||||
end
|
||||
@ -270,7 +269,7 @@ def test_destroy
|
||||
end
|
||||
|
||||
def test_record_not_found_exception
|
||||
assert_raise(ActiveRecord::RecordNotFound) { topicReloaded = Topic.find(99999) }
|
||||
assert_raise(ActiveRecord::RecordNotFound) { Topic.find(99999) }
|
||||
end
|
||||
|
||||
def test_update_all
|
||||
|
@ -133,7 +133,6 @@ def test_cache_is_expired_by_habtm_update
|
||||
def test_cache_is_expired_by_habtm_delete
|
||||
ActiveRecord::Base.connection.expects(:clear_query_cache).times(2)
|
||||
ActiveRecord::Base.cache do
|
||||
c = Category.find(1)
|
||||
p = Post.find(1)
|
||||
assert p.categories.any?
|
||||
p.categories.delete_all
|
||||
|
@ -254,13 +254,11 @@ def test_nested_scope_finder
|
||||
end
|
||||
|
||||
def test_should_maintain_default_scope_on_associations
|
||||
person = people(:michael)
|
||||
magician = BadReference.find(1)
|
||||
assert_equal [magician], people(:michael).bad_references
|
||||
end
|
||||
|
||||
def test_should_default_scope_on_associations_is_overriden_by_association_conditions
|
||||
person = people(:michael)
|
||||
assert_equal [], people(:michael).fixed_bad_references
|
||||
end
|
||||
|
||||
|
@ -113,7 +113,7 @@ def test_touching_a_record_with_a_belongs_to_that_uses_a_counter_cache_should_up
|
||||
|
||||
pet = Pet.first
|
||||
owner = pet.owner
|
||||
owner.update_attribute(:happy_at, (time = 3.days.ago))
|
||||
owner.update_attribute(:happy_at, 3.days.ago)
|
||||
previously_owner_updated_at = owner.updated_at
|
||||
|
||||
pet.name = "I'm a parrot"
|
||||
|
@ -163,7 +163,7 @@ def test_cancellation_from_before_filters_rollbacks_in_save!
|
||||
@first.author_name += '_this_should_not_end_up_in_the_db'
|
||||
@first.save!
|
||||
flunk
|
||||
rescue => e
|
||||
rescue
|
||||
assert_equal original_author_name, @first.reload.author_name
|
||||
assert_equal nbooks_before_save, Book.count
|
||||
ensure
|
||||
|
@ -17,7 +17,7 @@ def test_validates_size_of_association
|
||||
o = Owner.new('name' => 'nopets')
|
||||
assert !o.save
|
||||
assert o.errors[:pets].any?
|
||||
pet = o.pets.build('name' => 'apet')
|
||||
o.pets.build('name' => 'apet')
|
||||
assert o.valid?
|
||||
end
|
||||
|
||||
@ -27,7 +27,7 @@ def test_validates_size_of_association_using_within
|
||||
assert !o.save
|
||||
assert o.errors[:pets].any?
|
||||
|
||||
pet = o.pets.build('name' => 'apet')
|
||||
o.pets.build('name' => 'apet')
|
||||
assert o.valid?
|
||||
|
||||
2.times { o.pets.build('name' => 'apet') }
|
||||
|
@ -60,7 +60,7 @@ def test_validate_uniqueness
|
||||
|
||||
def test_validates_uniqueness_with_validates
|
||||
Topic.validates :title, :uniqueness => true
|
||||
t = Topic.create!('title' => 'abc')
|
||||
Topic.create!('title' => 'abc')
|
||||
|
||||
t2 = Topic.new('title' => 'abc')
|
||||
assert !t2.valid?
|
||||
@ -201,7 +201,7 @@ def test_validate_case_sensitive_uniqueness
|
||||
|
||||
def test_validate_case_sensitive_uniqueness_with_attribute_passed_as_integer
|
||||
Topic.validates_uniqueness_of(:title, :case_sensitve => true)
|
||||
t = Topic.create!('title' => 101)
|
||||
Topic.create!('title' => 101)
|
||||
|
||||
t2 = Topic.new('title' => 101)
|
||||
assert !t2.valid?
|
||||
|
Loading…
Reference in New Issue
Block a user