aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r--activerecord/test/cases/associations/eager_test.rb2
-rw-r--r--activerecord/test/cases/associations/has_many_through_associations_test.rb4
-rw-r--r--activerecord/test/cases/associations/inner_join_association_test.rb4
-rwxr-xr-xactiverecord/test/cases/base_test.rb18
-rw-r--r--activerecord/test/cases/defaults_test.rb4
-rw-r--r--activerecord/test/cases/log_subscriber_test.rb10
-rw-r--r--activerecord/test/cases/method_scoping_test.rb2
-rw-r--r--activerecord/test/cases/migration_test.rb4
-rw-r--r--activerecord/test/cases/named_scope_test.rb4
9 files changed, 26 insertions, 26 deletions
diff --git a/activerecord/test/cases/associations/eager_test.rb b/activerecord/test/cases/associations/eager_test.rb
index ffa6d45948..42a891bc3b 100644
--- a/activerecord/test/cases/associations/eager_test.rb
+++ b/activerecord/test/cases/associations/eager_test.rb
@@ -805,7 +805,7 @@ class EagerAssociationTest < ActiveRecord::TestCase
end
def test_include_has_many_using_primary_key
- expected = Firm.find(1).clients_using_primary_key.sort_by &:name
+ expected = Firm.find(1).clients_using_primary_key.sort_by(&:name)
# Oracle adapter truncates alias to 30 characters
if current_adapter?(:OracleAdapter)
firm = Firm.find 1, :include => :clients_using_primary_key, :order => 'clients_using_primary_keys_companies'[0,30]+'.name'
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 d47c8bba7d..ff799191c2 100644
--- a/activerecord/test/cases/associations/has_many_through_associations_test.rb
+++ b/activerecord/test/cases/associations/has_many_through_associations_test.rb
@@ -291,7 +291,7 @@ class HasManyThroughAssociationsTest < ActiveRecord::TestCase
], log.last(2)
post.people_with_callbacks = [people(:michael),people(:david), Person.new(:first_name => "Julian"), Person.create!(:first_name => "Roger")]
- assert_equal (%w(Ted Bob Sam Lary) * 2).sort, log[-12..-5].collect(&:last).sort
+ assert_equal((%w(Ted Bob Sam Lary) * 2).sort, log[-12..-5].collect(&:last).sort)
assert_equal [
[:added, :before, "Julian"],
[:added, :after, "Julian"],
@@ -300,7 +300,7 @@ class HasManyThroughAssociationsTest < ActiveRecord::TestCase
], log.last(4)
post.people_with_callbacks.clear
- assert_equal (%w(Michael David Julian Roger) * 2).sort, log.last(8).collect(&:last).sort
+ assert_equal((%w(Michael David Julian Roger) * 2).sort, log.last(8).collect(&:last).sort)
end
def test_dynamic_find_should_respect_association_include
diff --git a/activerecord/test/cases/associations/inner_join_association_test.rb b/activerecord/test/cases/associations/inner_join_association_test.rb
index 43abcae75e..4ba867dc7c 100644
--- a/activerecord/test/cases/associations/inner_join_association_test.rb
+++ b/activerecord/test/cases/associations/inner_join_association_test.rb
@@ -15,12 +15,12 @@ class InnerJoinAssociationTest < ActiveRecord::TestCase
def test_construct_finder_sql_ignores_empty_joins_hash
sql = Author.joins({}).to_sql
- assert_no_match /JOIN/i, sql
+ assert_no_match(/JOIN/i, sql)
end
def test_construct_finder_sql_ignores_empty_joins_array
sql = Author.joins([]).to_sql
- assert_no_match /JOIN/i, sql
+ assert_no_match(/JOIN/i, sql)
end
def test_find_with_implicit_inner_joins_honors_readonly_without_select
diff --git a/activerecord/test/cases/base_test.rb b/activerecord/test/cases/base_test.rb
index e3047fe873..8774ed58aa 100755
--- a/activerecord/test/cases/base_test.rb
+++ b/activerecord/test/cases/base_test.rb
@@ -674,10 +674,10 @@ class BasicsTest < ActiveRecord::TestCase
def test_decrement_counter
Topic.decrement_counter("replies_count", 2)
- assert_equal -1, Topic.find(2).replies_count
+ assert_equal(-1, Topic.find(2).replies_count)
Topic.decrement_counter("replies_count", 2)
- assert_equal -2, Topic.find(2).replies_count
+ assert_equal(-2, Topic.find(2).replies_count)
end
def test_reset_counters
@@ -1533,7 +1533,7 @@ class BasicsTest < ActiveRecord::TestCase
def test_auto_id
auto = AutoId.new
auto.save
- assert (auto.id > 0)
+ assert(auto.id > 0)
end
def quote_column_name(name)
@@ -2181,7 +2181,7 @@ class BasicsTest < ActiveRecord::TestCase
end
def test_inspect_new_instance
- assert_match /Topic id: nil/, Topic.new.inspect
+ assert_match(/Topic id: nil/, Topic.new.inspect)
end
def test_inspect_limited_select_instance
@@ -2240,9 +2240,9 @@ class BasicsTest < ActiveRecord::TestCase
ActiveRecord::Base.benchmark("Debug Topic Count", :level => :debug) { Topic.count }
ActiveRecord::Base.benchmark("Warn Topic Count", :level => :warn) { Topic.count }
ActiveRecord::Base.benchmark("Error Topic Count", :level => :error) { Topic.count }
- assert_no_match /Debug Topic Count/, log.string
- assert_match /Warn Topic Count/, log.string
- assert_match /Error Topic Count/, log.string
+ assert_no_match(/Debug Topic Count/, log.string)
+ assert_match(/Warn Topic Count/, log.string)
+ assert_match(/Error Topic Count/, log.string)
ensure
ActiveRecord::Base.logger = original_logger
end
@@ -2253,8 +2253,8 @@ class BasicsTest < ActiveRecord::TestCase
ActiveRecord::Base.logger = Logger.new(log)
ActiveRecord::Base.benchmark("Logging", :level => :debug, :silence => true) { ActiveRecord::Base.logger.debug "Loud" }
ActiveRecord::Base.benchmark("Logging", :level => :debug, :silence => false) { ActiveRecord::Base.logger.debug "Quiet" }
- assert_no_match /Loud/, log.string
- assert_match /Quiet/, log.string
+ assert_no_match(/Loud/, log.string)
+ assert_match(/Quiet/, log.string)
ensure
ActiveRecord::Base.logger = original_logger
end
diff --git a/activerecord/test/cases/defaults_test.rb b/activerecord/test/cases/defaults_test.rb
index b4032c23e6..bba216ae19 100644
--- a/activerecord/test/cases/defaults_test.rb
+++ b/activerecord/test/cases/defaults_test.rb
@@ -24,7 +24,7 @@ class DefaultTest < ActiveRecord::TestCase
assert_instance_of Fixnum, default.positive_integer
assert_equal 1, default.positive_integer
assert_instance_of Fixnum, default.negative_integer
- assert_equal -1, default.negative_integer
+ assert_equal(-1, default.negative_integer)
assert_instance_of BigDecimal, default.decimal_number
assert_equal BigDecimal.new("2.78"), default.decimal_number
end
@@ -33,7 +33,7 @@ class DefaultTest < ActiveRecord::TestCase
if current_adapter?(:PostgreSQLAdapter)
def test_multiline_default_text
# older postgres versions represent the default with escapes ("\\012" for a newline)
- assert ( "--- []\n\n" == Default.columns_hash['multiline_default'].default ||
+ assert( "--- []\n\n" == Default.columns_hash['multiline_default'].default ||
"--- []\\012\\012" == Default.columns_hash['multiline_default'].default)
end
end
diff --git a/activerecord/test/cases/log_subscriber_test.rb b/activerecord/test/cases/log_subscriber_test.rb
index f3b94eb829..6ba84fa57b 100644
--- a/activerecord/test/cases/log_subscriber_test.rb
+++ b/activerecord/test/cases/log_subscriber_test.rb
@@ -26,8 +26,8 @@ class LogSubscriberTest < ActiveSupport::TestCase
Developer.all
wait
assert_equal 1, @logger.logged(:debug).size
- assert_match /Developer Load/, @logger.logged(:debug).last
- assert_match /SELECT .*?FROM .?developers.?/, @logger.logged(:debug).last
+ assert_match(/Developer Load/, @logger.logged(:debug).last)
+ assert_match(/SELECT .*?FROM .?developers.?/, @logger.logged(:debug).last)
end
def test_cached_queries
@@ -37,7 +37,7 @@ class LogSubscriberTest < ActiveSupport::TestCase
end
wait
assert_equal 2, @logger.logged(:debug).size
- assert_match /CACHE/, @logger.logged(:debug).last
- assert_match /SELECT .*?FROM .?developers.?/, @logger.logged(:debug).last
+ assert_match(/CACHE/, @logger.logged(:debug).last)
+ assert_match(/SELECT .*?FROM .?developers.?/, @logger.logged(:debug).last)
end
-end \ No newline at end of file
+end
diff --git a/activerecord/test/cases/method_scoping_test.rb b/activerecord/test/cases/method_scoping_test.rb
index 3151457440..a3b496a0e6 100644
--- a/activerecord/test/cases/method_scoping_test.rb
+++ b/activerecord/test/cases/method_scoping_test.rb
@@ -382,7 +382,7 @@ class NestedScopingTest < ActiveRecord::TestCase
Developer.send(:with_scope, :find => { :conditions => "salary < 100000" }) do
Developer.send(:with_scope, :find => { :offset => 1, :order => 'id asc' }) do
# Oracle adapter does not generated space after asc therefore trailing space removed from regex
- assert_sql /ORDER BY id asc/ do
+ assert_sql(/ORDER BY id asc/) do
assert_equal(poor_jamis, Developer.find(:first, :order => 'id asc'))
end
end
diff --git a/activerecord/test/cases/migration_test.rb b/activerecord/test/cases/migration_test.rb
index dd32eeeff2..3181f27bc2 100644
--- a/activerecord/test/cases/migration_test.rb
+++ b/activerecord/test/cases/migration_test.rb
@@ -477,7 +477,7 @@ if ActiveRecord::Base.connection.supports_migrations?
assert_not_equal "Z", bob.moment_of_truth.zone
# US/Eastern is -5 hours from GMT
assert_equal Rational(-5, 24), bob.moment_of_truth.offset
- assert_match /\A-05:?00\Z/, bob.moment_of_truth.zone #ruby 1.8.6 uses HH:MM, prior versions use HHMM
+ assert_match(/\A-05:?00\Z/, bob.moment_of_truth.zone) #ruby 1.8.6 uses HH:MM, prior versions use HHMM
assert_equal DateTime::ITALY, bob.moment_of_truth.start
end
end
@@ -493,7 +493,7 @@ if ActiveRecord::Base.connection.supports_migrations?
ActiveRecord::Migration.add_column :people, :intelligence_quotient, :tinyint
Person.reset_column_information
- assert_match /tinyint/, Person.columns_hash['intelligence_quotient'].sql_type
+ assert_match(/tinyint/, Person.columns_hash['intelligence_quotient'].sql_type)
ensure
ActiveRecord::Migration.remove_column :people, :intelligence_quotient rescue nil
end
diff --git a/activerecord/test/cases/named_scope_test.rb b/activerecord/test/cases/named_scope_test.rb
index 894d96346e..6c2b4fa3a7 100644
--- a/activerecord/test/cases/named_scope_test.rb
+++ b/activerecord/test/cases/named_scope_test.rb
@@ -83,8 +83,8 @@ class NamedScopeTest < ActiveRecord::TestCase
end
def test_scopes_are_composable
- assert_equal (approved = Topic.find(:all, :conditions => {:approved => true})), Topic.approved
- assert_equal (replied = Topic.find(:all, :conditions => 'replies_count > 0')), Topic.replied
+ assert_equal((approved = Topic.find(:all, :conditions => {:approved => true})), Topic.approved)
+ assert_equal((replied = Topic.find(:all, :conditions => 'replies_count > 0')), Topic.replied)
assert !(approved == replied)
assert !(approved & replied).empty?