aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/test')
-rw-r--r--activesupport/test/callbacks_test.rb2
-rw-r--r--activesupport/test/core_ext/class/attribute_accessor_test.rb8
-rw-r--r--activesupport/test/core_ext/class/class_inheritable_attributes_test.rb4
-rw-r--r--activesupport/test/core_ext/class/delegating_attributes_test.rb8
-rw-r--r--activesupport/test/core_ext/date_time_ext_test.rb4
-rw-r--r--activesupport/test/core_ext/duration_test.rb4
-rw-r--r--activesupport/test/core_ext/module/attribute_accessor_test.rb8
-rw-r--r--activesupport/test/core_ext/module/synchronization_test.rb6
-rw-r--r--activesupport/test/core_ext/module_test.rb10
-rw-r--r--activesupport/test/core_ext/string_ext_test.rb14
-rw-r--r--activesupport/test/core_ext/time_with_zone_test.rb12
-rw-r--r--activesupport/test/multibyte_chars_test.rb6
-rw-r--r--activesupport/test/time_zone_test.rb2
13 files changed, 44 insertions, 44 deletions
diff --git a/activesupport/test/callbacks_test.rb b/activesupport/test/callbacks_test.rb
index 49d9de63b0..70a2950f9b 100644
--- a/activesupport/test/callbacks_test.rb
+++ b/activesupport/test/callbacks_test.rb
@@ -521,7 +521,7 @@ module CallbacksTest
def test_save
obj = HyphenatedCallbacks.new
obj.save
- assert_equal obj.stuff, "ACTION"
+ assert_equal "ACTION", obj.stuff
end
end
end
diff --git a/activesupport/test/core_ext/class/attribute_accessor_test.rb b/activesupport/test/core_ext/class/attribute_accessor_test.rb
index 0f579d12e5..2c896d0cdb 100644
--- a/activesupport/test/core_ext/class/attribute_accessor_test.rb
+++ b/activesupport/test/core_ext/class/attribute_accessor_test.rb
@@ -25,14 +25,14 @@ class ClassAttributeAccessorTest < Test::Unit::TestCase
end
def test_should_not_create_instance_writer
- assert @class.respond_to?(:foo)
- assert @class.respond_to?(:foo=)
- assert @object.respond_to?(:bar)
+ assert_respond_to @class, :foo
+ assert_respond_to @class, :foo=
+ assert_respond_to @object, :bar
assert !@object.respond_to?(:bar=)
end
def test_should_not_create_instance_reader
- assert @class.respond_to?(:shaq)
+ assert_respond_to @class, :shaq
assert !@object.respond_to?(:shaq)
end
end
diff --git a/activesupport/test/core_ext/class/class_inheritable_attributes_test.rb b/activesupport/test/core_ext/class/class_inheritable_attributes_test.rb
index eeda468d9c..63ea46b564 100644
--- a/activesupport/test/core_ext/class/class_inheritable_attributes_test.rb
+++ b/activesupport/test/core_ext/class/class_inheritable_attributes_test.rb
@@ -219,7 +219,7 @@ class ClassInheritableAttributesTest < Test::Unit::TestCase
@klass.reset_inheritable_attributes
@sub = eval("class NotInheriting < @klass; end; NotInheriting")
- assert_equal nil, @klass.a
- assert_equal nil, @sub.a
+ assert_nil @klass.a
+ assert_nil @sub.a
end
end
diff --git a/activesupport/test/core_ext/class/delegating_attributes_test.rb b/activesupport/test/core_ext/class/delegating_attributes_test.rb
index 6d6cb61571..cbfb290c48 100644
--- a/activesupport/test/core_ext/class/delegating_attributes_test.rb
+++ b/activesupport/test/core_ext/class/delegating_attributes_test.rb
@@ -32,16 +32,16 @@ class DelegatingAttributesTest < Test::Unit::TestCase
single_class.superclass_delegating_accessor :both
# Class should have accessor and mutator
# the instance should have an accessor only
- assert single_class.respond_to?(:both)
- assert single_class.respond_to?(:both=)
+ assert_respond_to single_class, :both
+ assert_respond_to single_class, :both=
assert single_class.public_instance_methods.map(&:to_s).include?("both")
assert !single_class.public_instance_methods.map(&:to_s).include?("both=")
end
def test_simple_accessor_declaration_with_instance_reader_false
single_class.superclass_delegating_accessor :no_instance_reader, :instance_reader => false
- assert single_class.respond_to?(:no_instance_reader)
- assert single_class.respond_to?(:no_instance_reader=)
+ assert_respond_to single_class, :no_instance_reader
+ assert_respond_to single_class, :no_instance_reader=
assert !single_class.public_instance_methods.map(&:to_s).include?("no_instance_reader")
end
diff --git a/activesupport/test/core_ext/date_time_ext_test.rb b/activesupport/test/core_ext/date_time_ext_test.rb
index 4780760a19..eba8170cda 100644
--- a/activesupport/test/core_ext/date_time_ext_test.rb
+++ b/activesupport/test/core_ext/date_time_ext_test.rb
@@ -275,12 +275,12 @@ class DateTimeExtCalculationsTest < Test::Unit::TestCase
end
def test_current_without_time_zone
- assert DateTime.current.is_a?(DateTime)
+ assert_kind_of DateTime, DateTime.current
end
def test_current_with_time_zone
with_env_tz 'US/Eastern' do
- assert DateTime.current.is_a?(DateTime)
+ assert_kind_of DateTime, DateTime.current
end
end
diff --git a/activesupport/test/core_ext/duration_test.rb b/activesupport/test/core_ext/duration_test.rb
index 6530de1ef4..05f529dc7d 100644
--- a/activesupport/test/core_ext/duration_test.rb
+++ b/activesupport/test/core_ext/duration_test.rb
@@ -5,8 +5,8 @@ class DurationTest < ActiveSupport::TestCase
def test_is_a
d = 1.day
assert d.is_a?(ActiveSupport::Duration)
- assert d.is_a?(Numeric)
- assert d.is_a?(Fixnum)
+ assert_kind_of Numeric, d
+ assert_kind_of Fixnum, d
assert !d.is_a?(Hash)
k = Class.new
diff --git a/activesupport/test/core_ext/module/attribute_accessor_test.rb b/activesupport/test/core_ext/module/attribute_accessor_test.rb
index 263e78feaa..67fcd437d0 100644
--- a/activesupport/test/core_ext/module/attribute_accessor_test.rb
+++ b/activesupport/test/core_ext/module/attribute_accessor_test.rb
@@ -27,14 +27,14 @@ class ModuleAttributeAccessorTest < Test::Unit::TestCase
end
def test_should_not_create_instance_writer
- assert @module.respond_to?(:foo)
- assert @module.respond_to?(:foo=)
- assert @object.respond_to?(:bar)
+ assert_respond_to @module, :foo
+ assert_respond_to @module, :foo=
+ assert_respond_to @object, :bar
assert !@object.respond_to?(:bar=)
end
def test_should_not_create_instance_reader
- assert @module.respond_to?(:shaq)
+ assert_respond_to @module, :shaq
assert !@object.respond_to?(:shaq)
end
end
diff --git a/activesupport/test/core_ext/module/synchronization_test.rb b/activesupport/test/core_ext/module/synchronization_test.rb
index 43d65ab249..eb850893f0 100644
--- a/activesupport/test/core_ext/module/synchronization_test.rb
+++ b/activesupport/test/core_ext/module/synchronization_test.rb
@@ -16,8 +16,8 @@ class SynchronizationTest < Test::Unit::TestCase
attr_accessor :value
synchronize :value, :with => :mutex
end
- assert @instance.respond_to?(:value_with_synchronization)
- assert @instance.respond_to?(:value_without_synchronization)
+ assert_respond_to @instance, :value_with_synchronization
+ assert_respond_to @instance, :value_without_synchronization
end
def test_synchronize_does_not_change_behavior
@@ -81,7 +81,7 @@ class SynchronizationTest < Test::Unit::TestCase
class << @target
synchronize :to_s, :with => :mutex
end
- assert @target.respond_to?(:to_s_without_synchronization)
+ assert_respond_to @target, :to_s_without_synchronization
assert_nothing_raised { @target.to_s; @target.to_s }
assert_equal 2, @target.mutex.sync_count
end
diff --git a/activesupport/test/core_ext/module_test.rb b/activesupport/test/core_ext/module_test.rb
index 1712b0649b..39ee0ac748 100644
--- a/activesupport/test/core_ext/module_test.rb
+++ b/activesupport/test/core_ext/module_test.rb
@@ -225,7 +225,7 @@ class MethodAliasingTest < Test::Unit::TestCase
FooClassWithBarMethod.class_eval { include BarMethodAliaser }
feature_aliases.each do |method|
- assert @instance.respond_to?(method)
+ assert_respond_to @instance, method
end
assert_equal 'bar_with_baz', @instance.bar
@@ -242,7 +242,7 @@ class MethodAliasingTest < Test::Unit::TestCase
include BarMethodAliaser
alias_method_chain :quux!, :baz
end
- assert @instance.respond_to?(:quux_with_baz!)
+ assert_respond_to @instance, :quux_with_baz!
assert_equal 'quux_with_baz', @instance.quux!
assert_equal 'quux', @instance.quux_without_baz!
@@ -260,9 +260,9 @@ class MethodAliasingTest < Test::Unit::TestCase
assert !@instance.respond_to?(:quux_with_baz=)
FooClassWithBarMethod.class_eval { include BarMethodAliaser }
- assert @instance.respond_to?(:quux_with_baz!)
- assert @instance.respond_to?(:quux_with_baz?)
- assert @instance.respond_to?(:quux_with_baz=)
+ assert_respond_to @instance, :quux_with_baz!
+ assert_respond_to @instance, :quux_with_baz?
+ assert_respond_to @instance, :quux_with_baz=
FooClassWithBarMethod.alias_method_chain :quux!, :baz
diff --git a/activesupport/test/core_ext/string_ext_test.rb b/activesupport/test/core_ext/string_ext_test.rb
index 09ce39bae2..ea21e445e2 100644
--- a/activesupport/test/core_ext/string_ext_test.rb
+++ b/activesupport/test/core_ext/string_ext_test.rb
@@ -117,7 +117,7 @@ class StringInflectionsTest < Test::Unit::TestCase
assert_equal Time.local(2005, 2, 27, 23, 50, 19, 275038), "2005-02-27T23:50:19.275038".to_time(:local)
assert_equal DateTime.civil(2039, 2, 27, 23, 50), "2039-02-27 23:50".to_time
assert_equal Time.local_time(2039, 2, 27, 23, 50), "2039-02-27 23:50".to_time(:local)
- assert_equal nil, "".to_time
+ assert_nil "".to_time
end
def test_string_to_datetime
@@ -125,12 +125,12 @@ class StringInflectionsTest < Test::Unit::TestCase
assert_equal 0, "2039-02-27 23:50".to_datetime.offset # use UTC offset
assert_equal ::Date::ITALY, "2039-02-27 23:50".to_datetime.start # use Ruby's default start value
assert_equal DateTime.civil(2039, 2, 27, 23, 50, 19 + Rational(275038, 1000000), "-04:00"), "2039-02-27T23:50:19.275038-04:00".to_datetime
- assert_equal nil, "".to_datetime
+ assert_nil "".to_datetime
end
def test_string_to_date
assert_equal Date.new(2005, 2, 27), "2005-02-27".to_date
- assert_equal nil, "".to_date
+ assert_nil "".to_date
end
def test_access
@@ -224,7 +224,7 @@ class CoreExtStringMultibyteTest < ActiveSupport::TestCase
BYTE_STRING = "\270\236\010\210\245"
def test_core_ext_adds_mb_chars
- assert UNICODE_STRING.respond_to?(:mb_chars)
+ assert_respond_to UNICODE_STRING, :mb_chars
end
def test_string_should_recognize_utf8_strings
@@ -236,20 +236,20 @@ class CoreExtStringMultibyteTest < ActiveSupport::TestCase
if RUBY_VERSION < '1.9'
def test_mb_chars_returns_self_when_kcode_not_set
with_kcode('none') do
- assert UNICODE_STRING.mb_chars.kind_of?(String)
+ assert_kind_of String, UNICODE_STRING.mb_chars
end
end
def test_mb_chars_returns_an_instance_of_the_chars_proxy_when_kcode_utf8
with_kcode('UTF8') do
- assert UNICODE_STRING.mb_chars.kind_of?(ActiveSupport::Multibyte.proxy_class)
+ assert_kind_of ActiveSupport::Multibyte.proxy_class, UNICODE_STRING.mb_chars
end
end
end
if RUBY_VERSION >= '1.9'
def test_mb_chars_returns_string
- assert UNICODE_STRING.mb_chars.kind_of?(String)
+ assert_kind_of String, UNICODE_STRING.mb_chars
end
end
end
diff --git a/activesupport/test/core_ext/time_with_zone_test.rb b/activesupport/test/core_ext/time_with_zone_test.rb
index a808a25821..77b1893f77 100644
--- a/activesupport/test/core_ext/time_with_zone_test.rb
+++ b/activesupport/test/core_ext/time_with_zone_test.rb
@@ -279,13 +279,13 @@ class TimeWithZoneTest < Test::Unit::TestCase
def test_to_f
result = ActiveSupport::TimeWithZone.new( Time.utc(2000, 1, 1), ActiveSupport::TimeZone['Hawaii'] ).to_f
assert_equal 946684800.0, result
- assert result.is_a?(Float)
+ assert_kind_of Float, result
end
def test_to_i
result = ActiveSupport::TimeWithZone.new( Time.utc(2000, 1, 1), ActiveSupport::TimeZone['Hawaii'] ).to_i
assert_equal 946684800, result
- assert result.is_a?(Integer)
+ assert_kind_of Integer, result
end
def test_to_i_with_wrapped_datetime
@@ -324,9 +324,9 @@ class TimeWithZoneTest < Test::Unit::TestCase
end
def test_is_a
- assert @twz.is_a?(Time)
- assert @twz.kind_of?(Time)
- assert @twz.is_a?(ActiveSupport::TimeWithZone)
+ assert_kind_of Time, @twz
+ assert_kind_of Time, @twz
+ assert ActiveSupport::TimeWithZone, @twz
end
def test_class_name
@@ -830,7 +830,7 @@ class TimeWithZoneMethodsForTimeAndDateTimeTest < Test::Unit::TestCase
assert_raise(TZInfo::InvalidTimezoneIdentifier) { Time.zone.utc_offset }
Time.zone = -15.hours
- assert_equal nil, Time.zone
+ assert_nil Time.zone
end
def test_current_returns_time_now_when_zone_default_not_set
diff --git a/activesupport/test/multibyte_chars_test.rb b/activesupport/test/multibyte_chars_test.rb
index caf50aa1c9..f15b1351f7 100644
--- a/activesupport/test/multibyte_chars_test.rb
+++ b/activesupport/test/multibyte_chars_test.rb
@@ -31,12 +31,12 @@ class MultibyteCharsTest < Test::Unit::TestCase
end
def test_forwarded_method_calls_should_return_new_chars_instance
- assert @chars.__method_for_multibyte_testing.kind_of?(@proxy_class)
+ assert_kind_of @proxy_class, @chars.__method_for_multibyte_testing
assert_not_equal @chars.object_id, @chars.__method_for_multibyte_testing.object_id
end
def test_forwarded_bang_method_calls_should_return_the_original_chars_instance
- assert @chars.__method_for_multibyte_testing!.kind_of?(@proxy_class)
+ assert_kind_of @proxy_class, @chars.__method_for_multibyte_testing!
assert_equal @chars.object_id, @chars.__method_for_multibyte_testing!.object_id
end
@@ -114,7 +114,7 @@ class MultibyteCharsUTF8BehaviourTest < Test::Unit::TestCase
if RUBY_VERSION < '1.9'
def test_split_should_return_an_array_of_chars_instances
@chars.split(//).each do |character|
- assert character.kind_of?(ActiveSupport::Multibyte.proxy_class)
+ assert_kind_of ActiveSupport::Multibyte.proxy_class, character
end
end
diff --git a/activesupport/test/time_zone_test.rb b/activesupport/test/time_zone_test.rb
index 516da7a14c..620623b389 100644
--- a/activesupport/test/time_zone_test.rb
+++ b/activesupport/test/time_zone_test.rb
@@ -22,7 +22,7 @@ class TimeZoneTest < Test::Unit::TestCase
ActiveSupport::TimeZone::MAPPING.keys.each do |name|
define_method("test_map_#{name.downcase.gsub(/[^a-z]/, '_')}_to_tzinfo") do
zone = ActiveSupport::TimeZone[name]
- assert zone.tzinfo.respond_to?(:period_for_local)
+ assert_respond_to zone.tzinfo, :period_for_local
end
end