aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/finder_test.rb2
-rw-r--r--activerecord/test/cases/inheritance_test.rb14
-rw-r--r--activerecord/test/cases/method_scoping_test.rb2
-rw-r--r--activerecord/test/cases/migration_test.rb2
-rw-r--r--activerecord/test/cases/pk_test.rb4
-rw-r--r--activerecord/test/cases/query_cache_test.rb2
-rw-r--r--activerecord/test/cases/relations_test.rb6
-rw-r--r--activerecord/test/cases/reserved_word_test_mysql.rb2
-rw-r--r--activerecord/test/cases/timestamp_test.rb16
9 files changed, 25 insertions, 25 deletions
diff --git a/activerecord/test/cases/finder_test.rb b/activerecord/test/cases/finder_test.rb
index c73ad50a71..860d330a7f 100644
--- a/activerecord/test/cases/finder_test.rb
+++ b/activerecord/test/cases/finder_test.rb
@@ -255,7 +255,7 @@ class FinderTest < ActiveRecord::TestCase
assert !topic.attribute_present?("title")
#assert !topic.respond_to?("title")
assert topic.attribute_present?("author_name")
- assert topic.respond_to?("author_name")
+ assert_respond_to topic, "author_name"
end
def test_find_on_blank_conditions
diff --git a/activerecord/test/cases/inheritance_test.rb b/activerecord/test/cases/inheritance_test.rb
index 0672fb938b..c1c8f01e46 100644
--- a/activerecord/test/cases/inheritance_test.rb
+++ b/activerecord/test/cases/inheritance_test.rb
@@ -72,10 +72,10 @@ class InheritanceTest < ActiveRecord::TestCase
end
def test_inheritance_find
- assert Company.find(1).kind_of?(Firm), "37signals should be a firm"
- assert Firm.find(1).kind_of?(Firm), "37signals should be a firm"
- assert Company.find(2).kind_of?(Client), "Summit should be a client"
- assert Client.find(2).kind_of?(Client), "Summit should be a client"
+ assert_kind_of Firm, Company.find(1), "37signals should be a firm"
+ assert_kind_of Firm, Firm.find(1), "37signals should be a firm"
+ assert_kind_of Client, Company.find(2), "Summit should be a client"
+ assert_kind_of Client, Client.find(2), "Summit should be a client"
end
def test_alt_inheritance_find
@@ -86,8 +86,8 @@ class InheritanceTest < ActiveRecord::TestCase
def test_inheritance_find_all
companies = Company.find(:all, :order => 'id')
- assert companies[0].kind_of?(Firm), "37signals should be a firm"
- assert companies[1].kind_of?(Client), "Summit should be a client"
+ assert_kind_of Firm, companies[0], "37signals should be a firm"
+ assert_kind_of Client, companies[1], "Summit should be a client"
end
def test_alt_inheritance_find_all
@@ -102,7 +102,7 @@ class InheritanceTest < ActiveRecord::TestCase
firm.save
next_angle = Company.find(firm.id)
- assert next_angle.kind_of?(Firm), "Next Angle should be a firm"
+ assert_kind_of Firm, next_angle, "Next Angle should be a firm"
end
def test_alt_inheritance_save
diff --git a/activerecord/test/cases/method_scoping_test.rb b/activerecord/test/cases/method_scoping_test.rb
index cb599e363f..e93f22bede 100644
--- a/activerecord/test/cases/method_scoping_test.rb
+++ b/activerecord/test/cases/method_scoping_test.rb
@@ -622,7 +622,7 @@ class DefaultScopingTest < ActiveRecord::TestCase
assert_equal ['salary DESC'], klass.scoped.order_values
# Parent should still have the original scope
- assert_equal nil, DeveloperOrderedBySalary.scoped.limit_value
+ assert_nil DeveloperOrderedBySalary.scoped.limit_value
assert_equal ['salary DESC'], DeveloperOrderedBySalary.scoped.order_values
end
diff --git a/activerecord/test/cases/migration_test.rb b/activerecord/test/cases/migration_test.rb
index 692e4b207f..b5fa258f7b 100644
--- a/activerecord/test/cases/migration_test.rb
+++ b/activerecord/test/cases/migration_test.rb
@@ -525,7 +525,7 @@ if ActiveRecord::Base.connection.supports_migrations?
end
end
- assert_equal TrueClass, bob.male?.class
+ assert_instance_of TrueClass, bob.male?
assert_kind_of BigDecimal, bob.wealth
end
diff --git a/activerecord/test/cases/pk_test.rb b/activerecord/test/cases/pk_test.rb
index 33ad5992de..73f4b3848c 100644
--- a/activerecord/test/cases/pk_test.rb
+++ b/activerecord/test/cases/pk_test.rb
@@ -18,7 +18,7 @@ class PrimaryKeysTest < ActiveRecord::TestCase
def test_to_key_with_customized_primary_key
keyboard = Keyboard.new
- assert keyboard.to_key.nil?
+ assert_nil keyboard.to_key
keyboard.save
assert_equal keyboard.to_key, [keyboard.id]
end
@@ -37,7 +37,7 @@ class PrimaryKeysTest < ActiveRecord::TestCase
topic = Topic.new
topic.title = "New Topic"
- assert_equal(nil, topic.id)
+ assert_nil topic.id
assert_nothing_raised { topic.save! }
id = topic.id
diff --git a/activerecord/test/cases/query_cache_test.rb b/activerecord/test/cases/query_cache_test.rb
index 91349689bc..68abca70b3 100644
--- a/activerecord/test/cases/query_cache_test.rb
+++ b/activerecord/test/cases/query_cache_test.rb
@@ -58,7 +58,7 @@ class QueryCacheTest < ActiveRecord::TestCase
Task.cache do
# Oracle adapter returns count() as Fixnum or Float
if current_adapter?(:OracleAdapter)
- assert Task.connection.select_value("SELECT count(*) AS count_all FROM tasks").is_a?(Numeric)
+ assert_kind_of Numeric, Task.connection.select_value("SELECT count(*) AS count_all FROM tasks")
elsif current_adapter?(:SQLite3Adapter) && SQLite3::Version::VERSION > '1.2.5'
# Future versions of the sqlite3 adapter will return numeric
assert_instance_of Fixnum,
diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb
index 7b9e680c02..b6815af67e 100644
--- a/activerecord/test/cases/relations_test.rb
+++ b/activerecord/test/cases/relations_test.rb
@@ -145,7 +145,7 @@ class RelationTest < ActiveRecord::TestCase
relation = Topic.scoped
["map", "uniq", "sort", "insert", "delete", "update"].each do |method|
- assert relation.respond_to?(method), "Topic.scoped should respond to #{method.inspect}"
+ assert_respond_to relation, method, "Topic.scoped should respond to #{method.inspect}"
end
end
@@ -160,7 +160,7 @@ class RelationTest < ActiveRecord::TestCase
relation = Topic.scoped
["find_by_title", "find_by_title_and_author_name", "find_or_create_by_title", "find_or_initialize_by_title_and_author_name"].each do |method|
- assert relation.respond_to?(method), "Topic.scoped should respond to #{method.inspect}"
+ assert_respond_to relation, method, "Topic.scoped should respond to #{method.inspect}"
end
end
@@ -238,7 +238,7 @@ class RelationTest < ActiveRecord::TestCase
def test_default_scope_with_conditions_string
assert_equal Developer.find_all_by_name('David').map(&:id).sort, DeveloperCalledDavid.scoped.map(&:id).sort
- assert_equal nil, DeveloperCalledDavid.create!.name
+ assert_nil DeveloperCalledDavid.create!.name
end
def test_default_scope_with_conditions_hash
diff --git a/activerecord/test/cases/reserved_word_test_mysql.rb b/activerecord/test/cases/reserved_word_test_mysql.rb
index ce1622bb20..90d8b0d923 100644
--- a/activerecord/test/cases/reserved_word_test_mysql.rb
+++ b/activerecord/test/cases/reserved_word_test_mysql.rb
@@ -115,7 +115,7 @@ class MysqlReservedWordTest < ActiveRecord::TestCase
create_test_fixtures :select, :distinct, :group, :values, :distincts_selects
v = nil
assert_nothing_raised { v = Group.find(1).values }
- assert_equal v.id, 2
+ assert_equal 2, v.id
end
# belongs_to association with reserved-word table name
diff --git a/activerecord/test/cases/timestamp_test.rb b/activerecord/test/cases/timestamp_test.rb
index 24b237a72b..549c4af6b1 100644
--- a/activerecord/test/cases/timestamp_test.rb
+++ b/activerecord/test/cases/timestamp_test.rb
@@ -15,26 +15,26 @@ class TimestampTest < ActiveRecord::TestCase
@developer.name = "Jack Bauer"
@developer.save!
- assert @previously_updated_at != @developer.updated_at
+ assert_not_equal @previously_updated_at, @developer.updated_at
end
def test_saving_a_unchanged_record_doesnt_update_its_timestamp
@developer.save!
- assert @previously_updated_at == @developer.updated_at
+ assert_equal @previously_updated_at, @developer.updated_at
end
def test_touching_a_record_updates_its_timestamp
@developer.touch
- assert @previously_updated_at != @developer.updated_at
+ assert_not_equal @previously_updated_at, @developer.updated_at
end
def test_touching_a_different_attribute
previously_created_at = @developer.created_at
@developer.touch(:created_at)
- assert previously_created_at != @developer.created_at
+ assert_not_equal previously_created_at, @developer.created_at
end
def test_saving_a_record_with_a_belongs_to_that_specifies_touching_the_parent_should_update_the_parent_updated_at
@@ -45,7 +45,7 @@ class TimestampTest < ActiveRecord::TestCase
pet.name = "Fluffy the Third"
pet.save
- assert previously_owner_updated_at != pet.owner.updated_at
+ assert_not_equal previously_owner_updated_at, pet.owner.updated_at
end
def test_destroying_a_record_with_a_belongs_to_that_specifies_touching_the_parent_should_update_the_parent_updated_at
@@ -55,7 +55,7 @@ class TimestampTest < ActiveRecord::TestCase
pet.destroy
- assert previously_owner_updated_at != pet.owner.updated_at
+ 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
@@ -68,8 +68,8 @@ class TimestampTest < ActiveRecord::TestCase
pet.name = "Fluffy the Third"
pet.save
- assert previously_owner_happy_at != pet.owner.happy_at
+ assert_not_equal previously_owner_happy_at, pet.owner.happy_at
ensure
Pet.belongs_to :owner, :touch => true
end
-end \ No newline at end of file
+end