aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/test')
-rw-r--r--activesupport/test/autoloading_fixtures/class_folder/nested_class.rb2
-rw-r--r--activesupport/test/clean_backtrace_test.rb14
-rw-r--r--activesupport/test/clean_logger_test.rb4
-rw-r--r--activesupport/test/core_ext/array_ext_test.rb12
-rw-r--r--activesupport/test/core_ext/class/attribute_accessor_test.rb10
-rw-r--r--activesupport/test/core_ext/class/class_inheritable_attributes_test.rb22
-rw-r--r--activesupport/test/core_ext/date_ext_test.rb16
-rw-r--r--activesupport/test/core_ext/date_time_ext_test.rb2
-rw-r--r--activesupport/test/core_ext/duration_test.rb4
-rw-r--r--activesupport/test/core_ext/enumerable_test.rb2
-rw-r--r--activesupport/test/core_ext/hash_ext_test.rb42
-rw-r--r--activesupport/test/core_ext/kernel_test.rb2
-rw-r--r--activesupport/test/core_ext/module/anonymous_test.rb2
-rw-r--r--activesupport/test/core_ext/module/attr_accessor_with_default_test.rb8
-rw-r--r--activesupport/test/core_ext/module/attribute_accessor_test.rb2
-rw-r--r--activesupport/test/core_ext/module/attribute_aliasing_test.rb6
-rw-r--r--activesupport/test/core_ext/module/reachable_test.rb16
-rw-r--r--activesupport/test/core_ext/numeric_ext_test.rb24
-rw-r--r--activesupport/test/core_ext/object_and_class_ext_test.rb2
-rw-r--r--activesupport/test/core_ext/string_ext_test.rb2
-rw-r--r--activesupport/test/core_ext/time_ext_test.rb20
-rw-r--r--activesupport/test/core_ext/time_with_zone_test.rb6
-rw-r--r--activesupport/test/i18n_test.rb34
-rw-r--r--activesupport/test/message_encryptor_test.rb14
-rw-r--r--activesupport/test/multibyte_conformance.rb30
-rw-r--r--activesupport/test/option_merger_test.rb2
-rw-r--r--activesupport/test/rescuable_test.rb8
-rw-r--r--activesupport/test/test_test.rb20
-rw-r--r--activesupport/test/time_zone_test.rb2
29 files changed, 165 insertions, 165 deletions
diff --git a/activesupport/test/autoloading_fixtures/class_folder/nested_class.rb b/activesupport/test/autoloading_fixtures/class_folder/nested_class.rb
index 77ea230d2c..57a13d89ea 100644
--- a/activesupport/test/autoloading_fixtures/class_folder/nested_class.rb
+++ b/activesupport/test/autoloading_fixtures/class_folder/nested_class.rb
@@ -1,7 +1,7 @@
class ClassFolder
class NestedClass
end
-
+
class SiblingClass
end
end
diff --git a/activesupport/test/clean_backtrace_test.rb b/activesupport/test/clean_backtrace_test.rb
index 86838a7f9a..32e346bb48 100644
--- a/activesupport/test/clean_backtrace_test.rb
+++ b/activesupport/test/clean_backtrace_test.rb
@@ -5,7 +5,7 @@ class BacktraceCleanerFilterTest < ActiveSupport::TestCase
@bc = ActiveSupport::BacktraceCleaner.new
@bc.add_filter { |line| line.gsub("/my/prefix", '') }
end
-
+
test "backtrace should not contain prefix when it has been filtered out" do
assert_equal "/my/class.rb", @bc.clean([ "/my/prefix/my/class.rb" ]).first
end
@@ -14,14 +14,14 @@ class BacktraceCleanerFilterTest < ActiveSupport::TestCase
@bc.remove_filters!
assert_equal "/my/prefix/my/class.rb", @bc.clean(["/my/prefix/my/class.rb"]).first
end
-
+
test "backtrace should contain unaltered lines if they dont match a filter" do
assert_equal "/my/other_prefix/my/class.rb", @bc.clean([ "/my/other_prefix/my/class.rb" ]).first
end
-
+
test "backtrace should filter all lines in a backtrace" do
assert_equal \
- ["/my/class.rb", "/my/module.rb"],
+ ["/my/class.rb", "/my/module.rb"],
@bc.clean([ "/my/prefix/my/class.rb", "/my/prefix/my/module.rb" ])
end
end
@@ -31,10 +31,10 @@ class BacktraceCleanerSilencerTest < ActiveSupport::TestCase
@bc = ActiveSupport::BacktraceCleaner.new
@bc.add_silencer { |line| line =~ /mongrel/ }
end
-
+
test "backtrace should not contain lines that match the silencer" do
assert_equal \
- [ "/other/class.rb" ],
+ [ "/other/class.rb" ],
@bc.clean([ "/mongrel/class.rb", "/other/class.rb", "/mongrel/stuff.rb" ])
end
end
@@ -45,7 +45,7 @@ class BacktraceCleanerFilterAndSilencerTest < ActiveSupport::TestCase
@bc.add_filter { |line| line.gsub("/mongrel", "") }
@bc.add_silencer { |line| line =~ /mongrel/ }
end
-
+
test "backtrace should not silence lines that has first had their silence hook filtered out" do
assert_equal [ "/class.rb" ], @bc.clean([ "/mongrel/class.rb" ])
end
diff --git a/activesupport/test/clean_logger_test.rb b/activesupport/test/clean_logger_test.rb
index 6c4ec5ac46..2cc46904b4 100644
--- a/activesupport/test/clean_logger_test.rb
+++ b/activesupport/test/clean_logger_test.rb
@@ -41,7 +41,7 @@ class CleanLoggerTest < Test::Unit::TestCase
assert_equal "error\nfatal\nerror\nfatal\nunsilenced\n", @out.string
end
-
+
def test_datetime_format
@logger.formatter = Logger::Formatter.new
@logger.datetime_format = "%Y-%m-%d"
@@ -49,7 +49,7 @@ class CleanLoggerTest < Test::Unit::TestCase
assert_equal "%Y-%m-%d", @logger.datetime_format
assert_match(/D, \[\d\d\d\d-\d\d-\d\d#\d+\] DEBUG -- : debug/, @out.string)
end
-
+
def test_nonstring_formatting
an_object = [1, 2, 3, 4, 5]
@logger.debug an_object
diff --git a/activesupport/test/core_ext/array_ext_test.rb b/activesupport/test/core_ext/array_ext_test.rb
index 009a254c64..d14ae39737 100644
--- a/activesupport/test/core_ext/array_ext_test.rb
+++ b/activesupport/test/core_ext/array_ext_test.rb
@@ -18,10 +18,10 @@ class ArrayExtAccessTests < Test::Unit::TestCase
assert_equal %w( a b c ), %w( a b c d ).to(2)
assert_equal %w( a b c d ), %w( a b c d ).to(10)
end
-
+
def test_second_through_tenth
array = (1..42).to_a
-
+
assert_equal array[1], array.second
assert_equal array[2], array.third
assert_equal array[3], array.fourth
@@ -319,7 +319,7 @@ class ArrayExtractOptionsTests < Test::Unit::TestCase
assert_equal({}, options)
assert_equal [hash], array
end
-
+
def test_extract_options_extracts_extractable_subclass
hash = ExtractableHashSubclass.new
hash[:foo] = 1
@@ -370,14 +370,14 @@ class ArrayExtRandomTests < ActiveSupport::TestCase
assert_equal 2, s.size
assert_equal 1, (a-s).size
assert_equal [], a-(0..20).sum{a.sample(2)}
-
+
o = Object.new
def o.to_int; 1; end
assert_equal [0], [0].sample(o)
-
+
o = Object.new
assert_raises(TypeError) { [0].sample(o) }
-
+
o = Object.new
def o.to_int; ''; end
assert_raises(TypeError) { [0].sample(o) }
diff --git a/activesupport/test/core_ext/class/attribute_accessor_test.rb b/activesupport/test/core_ext/class/attribute_accessor_test.rb
index 2c896d0cdb..456f4b7948 100644
--- a/activesupport/test/core_ext/class/attribute_accessor_test.rb
+++ b/activesupport/test/core_ext/class/attribute_accessor_test.rb
@@ -10,27 +10,27 @@ class ClassAttributeAccessorTest < Test::Unit::TestCase
end
@object = @class.new
end
-
+
def test_should_use_mattr_default
assert_nil @class.foo
assert_nil @object.foo
end
-
+
def test_should_set_mattr_value
@class.foo = :test
assert_equal :test, @object.foo
-
+
@object.foo = :test2
assert_equal :test2, @class.foo
end
-
+
def test_should_not_create_instance_writer
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_respond_to @class, :shaq
assert !@object.respond_to?(:shaq)
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 63ea46b564..b284e5ee1c 100644
--- a/activesupport/test/core_ext/class/class_inheritable_attributes_test.rb
+++ b/activesupport/test/core_ext/class/class_inheritable_attributes_test.rb
@@ -21,7 +21,7 @@ class ClassInheritableAttributesTest < Test::Unit::TestCase
assert_respond_to @klass.new, :a=
end
end
-
+
def test_writer_declaration_without_instance_writer
assert_nothing_raised do
@klass.class_inheritable_writer :a, :instance_writer => false
@@ -39,7 +39,7 @@ class ClassInheritableAttributesTest < Test::Unit::TestCase
assert_respond_to @klass.new, :a=
end
end
-
+
def test_accessor_declaration_without_instance_writer
assert_nothing_raised do
@klass.class_inheritable_accessor :a, :instance_writer => false
@@ -176,37 +176,37 @@ class ClassInheritableAttributesTest < Test::Unit::TestCase
assert_equal 'b', @klass.b
assert_equal 'B', @sub.b
end
-
+
def test_array_inheritance
@klass.class_inheritable_accessor :a
@klass.a = []
@sub = eval("class SubbyArray < @klass; end; SubbyArray")
-
+
assert_equal [], @klass.a
assert_equal [], @sub.a
-
+
@sub.a << :first
-
+
assert_equal [:first], @sub.a
assert_equal [], @klass.a
end
-
+
def test_array_inheritance_
@klass.class_inheritable_accessor :a
@klass.a = {}
@sub = eval("class SubbyHash < @klass; end; SubbyHash")
-
+
assert_equal Hash.new, @klass.a
assert_equal Hash.new, @sub.a
-
+
@sub.a[:first] = :first
-
+
assert_equal 1, @sub.a.keys.size
assert_equal 0, @klass.a.keys.size
end
-
+
def test_reset_inheritable_attributes
@klass.class_inheritable_accessor :a
@klass.a = 'a'
diff --git a/activesupport/test/core_ext/date_ext_test.rb b/activesupport/test/core_ext/date_ext_test.rb
index 59c168d33d..3141e895e6 100644
--- a/activesupport/test/core_ext/date_ext_test.rb
+++ b/activesupport/test/core_ext/date_ext_test.rb
@@ -26,7 +26,7 @@ class DateExtCalculationsTest < ActiveSupport::TestCase
assert_equal year, Date.new(year).to_time(format).year
end
end
- end
+ end
end
def test_to_datetime
@@ -242,7 +242,7 @@ class DateExtCalculationsTest < ActiveSupport::TestCase
def test_yesterday_constructor
assert_equal Date.current - 1, Date.yesterday
end
-
+
def test_yesterday_constructor_when_zone_default_is_not_set
with_env_tz 'UTC' do
with_tz_default do
@@ -286,7 +286,7 @@ class DateExtCalculationsTest < ActiveSupport::TestCase
def test_since
assert_equal Time.local(2005,2,21,0,0,45), Date.new(2005,2,21).since(45)
end
-
+
def test_since_when_zone_default_is_set
zone = ActiveSupport::TimeZone['Eastern Time (US & Canada)']
with_env_tz 'UTC' do
@@ -300,7 +300,7 @@ class DateExtCalculationsTest < ActiveSupport::TestCase
def test_ago
assert_equal Time.local(2005,2,20,23,59,15), Date.new(2005,2,21).ago(45)
end
-
+
def test_ago_when_zone_default_is_set
zone = ActiveSupport::TimeZone['Eastern Time (US & Canada)']
with_env_tz 'UTC' do
@@ -314,7 +314,7 @@ class DateExtCalculationsTest < ActiveSupport::TestCase
def test_beginning_of_day
assert_equal Time.local(2005,2,21,0,0,0), Date.new(2005,2,21).beginning_of_day
end
-
+
def test_beginning_of_day_when_zone_default_is_set
zone = ActiveSupport::TimeZone['Eastern Time (US & Canada)']
with_env_tz 'UTC' do
@@ -328,7 +328,7 @@ class DateExtCalculationsTest < ActiveSupport::TestCase
def test_end_of_day
assert_equal Time.local(2005,2,21,23,59,59,999999.999), Date.new(2005,2,21).end_of_day
end
-
+
def test_end_of_day_when_zone_default_is_set
zone = ActiveSupport::TimeZone['Eastern Time (US & Canada)']
with_env_tz 'UTC' do
@@ -338,7 +338,7 @@ class DateExtCalculationsTest < ActiveSupport::TestCase
end
end
end
-
+
def test_xmlschema
with_env_tz 'US/Eastern' do
assert_match(/^1980-02-28T00:00:00-05:?00$/, Date.new(1980, 2, 28).xmlschema)
@@ -350,7 +350,7 @@ class DateExtCalculationsTest < ActiveSupport::TestCase
end
end
end
-
+
def test_xmlschema_when_zone_default_is_set
with_env_tz 'UTC' do
with_tz_default ActiveSupport::TimeZone['Eastern Time (US & Canada)'] do # UTC -5
diff --git a/activesupport/test/core_ext/date_time_ext_test.rb b/activesupport/test/core_ext/date_time_ext_test.rb
index e8506f5222..cb290c541b 100644
--- a/activesupport/test/core_ext/date_time_ext_test.rb
+++ b/activesupport/test/core_ext/date_time_ext_test.rb
@@ -242,7 +242,7 @@ class DateTimeExtCalculationsTest < Test::Unit::TestCase
assert_equal false, DateTime.civil(2005,2,10,15,30,45, Rational(-18000, 86400)).past?
assert_equal false, DateTime.civil(2005,2,10,15,30,46, Rational(-18000, 86400)).past?
end
-
+
def test_past_without_offset
DateTime.stubs(:current).returns(DateTime.civil(2005,2,10,15,30,45, Rational(-18000, 86400)))
assert_equal true, DateTime.civil(2005,2,10,20,30,44).past?
diff --git a/activesupport/test/core_ext/duration_test.rb b/activesupport/test/core_ext/duration_test.rb
index 710c221fac..8469f78566 100644
--- a/activesupport/test/core_ext/duration_test.rb
+++ b/activesupport/test/core_ext/duration_test.rb
@@ -117,13 +117,13 @@ class DurationTest < ActiveSupport::TestCase
ensure
Time.zone_default = nil
end
-
+
def test_adding_hours_across_dst_boundary
with_env_tz 'CET' do
assert_equal Time.local(2009,3,29,0,0,0) + 24.hours, Time.local(2009,3,30,1,0,0)
end
end
-
+
def test_adding_day_across_dst_boundary
with_env_tz 'CET' do
assert_equal Time.local(2009,3,29,0,0,0) + 1.day, Time.local(2009,3,30,0,0,0)
diff --git a/activesupport/test/core_ext/enumerable_test.rb b/activesupport/test/core_ext/enumerable_test.rb
index 4650b796b6..4655bfe519 100644
--- a/activesupport/test/core_ext/enumerable_test.rb
+++ b/activesupport/test/core_ext/enumerable_test.rb
@@ -89,7 +89,7 @@ class EnumerableTests < Test::Unit::TestCase
assert ![ 1, 2 ].many? {|x| x > 1 }
assert [ 1, 2, 2 ].many? {|x| x > 1 }
end
-
+
def test_exclude?
assert [ 1 ].exclude?(2)
assert ![ 1 ].exclude?(1)
diff --git a/activesupport/test/core_ext/hash_ext_test.rb b/activesupport/test/core_ext/hash_ext_test.rb
index 5d9846a216..fc8d8170a1 100644
--- a/activesupport/test/core_ext/hash_ext_test.rb
+++ b/activesupport/test/core_ext/hash_ext_test.rb
@@ -640,12 +640,12 @@ class HashToXmlTest < Test::Unit::TestCase
EOT
expected_topic_hash = {
- :title => nil,
+ :title => nil,
:id => nil,
:approved => nil,
:written_on => nil,
:viewed_at => nil,
- :content => nil,
+ :content => nil,
:parent_id => nil
}.stringify_keys
@@ -723,7 +723,7 @@ class HashToXmlTest < Test::Unit::TestCase
assert_equal expected_topic_hash, Hash.from_xml(topic_xml)["rsp"]["photos"]["photo"]
end
-
+
def test_all_caps_key_from_xml
test_xml = <<-EOT
<ABC3XYZ>
@@ -839,13 +839,13 @@ class HashToXmlTest < Test::Unit::TestCase
assert_equal expected_bacon_hash, Hash.from_xml(bacon_xml)["bacon"]
end
-
+
def test_type_trickles_through_when_unknown
product_xml = <<-EOT
<product>
<weight type="double">0.5</weight>
<image type="ProductImage"><filename>image.gif</filename></image>
-
+
</product>
EOT
@@ -854,7 +854,7 @@ class HashToXmlTest < Test::Unit::TestCase
:image => {'type' => 'ProductImage', 'filename' => 'image.gif' },
}.stringify_keys
- assert_equal expected_product_hash, Hash.from_xml(product_xml)["product"]
+ assert_equal expected_product_hash, Hash.from_xml(product_xml)["product"]
end
def test_should_use_default_value_for_unknown_key
@@ -888,41 +888,41 @@ class HashToXmlTest < Test::Unit::TestCase
assert_equal expected, hash.to_xml(@xml_options)
end
end
-
- def test_empty_string_works_for_typecast_xml_value
+
+ def test_empty_string_works_for_typecast_xml_value
assert_nothing_raised do
Hash.__send__(:typecast_xml_value, "")
end
end
-
+
def test_escaping_to_xml
- hash = {
- :bare_string => 'First & Last Name',
+ hash = {
+ :bare_string => 'First & Last Name',
:pre_escaped_string => 'First &amp; Last Name'
}.stringify_keys
-
+
expected_xml = '<person><bare-string>First &amp; Last Name</bare-string><pre-escaped-string>First &amp;amp; Last Name</pre-escaped-string></person>'
assert_equal expected_xml, hash.to_xml(@xml_options)
end
-
+
def test_unescaping_from_xml
xml_string = '<person><bare-string>First &amp; Last Name</bare-string><pre-escaped-string>First &amp;amp; Last Name</pre-escaped-string></person>'
- expected_hash = {
- :bare_string => 'First & Last Name',
+ expected_hash = {
+ :bare_string => 'First & Last Name',
:pre_escaped_string => 'First &amp; Last Name'
}.stringify_keys
assert_equal expected_hash, Hash.from_xml(xml_string)['person']
end
-
+
def test_roundtrip_to_xml_from_xml
- hash = {
- :bare_string => 'First & Last Name',
+ hash = {
+ :bare_string => 'First & Last Name',
:pre_escaped_string => 'First &amp; Last Name'
}.stringify_keys
assert_equal hash, Hash.from_xml(hash.to_xml(@xml_options))['person']
end
-
+
def test_datetime_xml_type_with_utc_time
alert_xml = <<-XML
<alert>
@@ -933,7 +933,7 @@ class HashToXmlTest < Test::Unit::TestCase
assert alert_at.utc?
assert_equal Time.utc(2008, 2, 10, 15, 30, 45), alert_at
end
-
+
def test_datetime_xml_type_with_non_utc_time
alert_xml = <<-XML
<alert>
@@ -944,7 +944,7 @@ class HashToXmlTest < Test::Unit::TestCase
assert alert_at.utc?
assert_equal Time.utc(2008, 2, 10, 15, 30, 45), alert_at
end
-
+
def test_datetime_xml_type_with_far_future_date
alert_xml = <<-XML
<alert>
diff --git a/activesupport/test/core_ext/kernel_test.rb b/activesupport/test/core_ext/kernel_test.rb
index c22af89918..228b644c1a 100644
--- a/activesupport/test/core_ext/kernel_test.rb
+++ b/activesupport/test/core_ext/kernel_test.rb
@@ -46,7 +46,7 @@ class KernelTest < Test::Unit::TestCase
o = Object.new
assert_equal class << o; self end, o.singleton_class
end
-
+
def test_class_eval
o = Object.new
class << o; @x = 1; end
diff --git a/activesupport/test/core_ext/module/anonymous_test.rb b/activesupport/test/core_ext/module/anonymous_test.rb
index 7a78a3b012..cb556af772 100644
--- a/activesupport/test/core_ext/module/anonymous_test.rb
+++ b/activesupport/test/core_ext/module/anonymous_test.rb
@@ -6,7 +6,7 @@ class AnonymousTest < ActiveSupport::TestCase
assert Module.new.anonymous?
assert Class.new.anonymous?
end
-
+
test "a named class or module are not anonymous" do
assert !Kernel.anonymous?
assert !Object.anonymous?
diff --git a/activesupport/test/core_ext/module/attr_accessor_with_default_test.rb b/activesupport/test/core_ext/module/attr_accessor_with_default_test.rb
index 7c0d0bb242..9494ca9ef6 100644
--- a/activesupport/test/core_ext/module/attr_accessor_with_default_test.rb
+++ b/activesupport/test/core_ext/module/attr_accessor_with_default_test.rb
@@ -7,24 +7,24 @@ class AttrAccessorWithDefaultTest < Test::Unit::TestCase
def helper
'helper'
end
- end
+ end
@instance = @target.new
end
-
+
def test_default_arg
@target.attr_accessor_with_default :foo, :bar
assert_equal(:bar, @instance.foo)
@instance.foo = nil
assert_nil(@instance.foo)
end
-
+
def test_default_proc
@target.attr_accessor_with_default(:foo) {helper.upcase}
assert_equal('HELPER', @instance.foo)
@instance.foo = nil
assert_nil(@instance.foo)
end
-
+
def test_invalid_args
assert_raise(RuntimeError) {@target.attr_accessor_with_default :foo}
end
diff --git a/activesupport/test/core_ext/module/attribute_accessor_test.rb b/activesupport/test/core_ext/module/attribute_accessor_test.rb
index 67fcd437d0..118fb070a0 100644
--- a/activesupport/test/core_ext/module/attribute_accessor_test.rb
+++ b/activesupport/test/core_ext/module/attribute_accessor_test.rb
@@ -32,7 +32,7 @@ class ModuleAttributeAccessorTest < Test::Unit::TestCase
assert_respond_to @object, :bar
assert !@object.respond_to?(:bar=)
end
-
+
def test_should_not_create_instance_reader
assert_respond_to @module, :shaq
assert !@object.respond_to?(:shaq)
diff --git a/activesupport/test/core_ext/module/attribute_aliasing_test.rb b/activesupport/test/core_ext/module/attribute_aliasing_test.rb
index f17d031662..065c3531e0 100644
--- a/activesupport/test/core_ext/module/attribute_aliasing_test.rb
+++ b/activesupport/test/core_ext/module/attribute_aliasing_test.rb
@@ -44,14 +44,14 @@ class AttributeAliasingTest < Test::Unit::TestCase
# upper-case attributes, and when people want to alias those names
# to more sensible ones, everything goes *foof*.
e = AttributeAliasing::Email.new
-
+
assert !e.body?
assert !e.Data?
-
+
e.body = "No, really, this is not a joke."
assert_equal "No, really, this is not a joke.", e.Data
assert e.Data?
-
+
e.Data = "Uppercased methods are teh suck"
assert_equal "Uppercased methods are teh suck", e.body
assert e.body?
diff --git a/activesupport/test/core_ext/module/reachable_test.rb b/activesupport/test/core_ext/module/reachable_test.rb
index 72892b77d5..80eb31a5c4 100644
--- a/activesupport/test/core_ext/module/reachable_test.rb
+++ b/activesupport/test/core_ext/module/reachable_test.rb
@@ -6,33 +6,33 @@ class AnonymousTest < ActiveSupport::TestCase
assert !Module.new.reachable?
assert !Class.new.reachable?
end
-
+
test "ordinary named classes or modules are reachable" do
assert Kernel.reachable?
assert Object.reachable?
end
-
+
test "a named class or module whose constant has gone is not reachable" do
c = eval "class C; end; C"
m = eval "module M; end; M"
-
+
self.class.send(:remove_const, :C)
self.class.send(:remove_const, :M)
-
+
assert !c.reachable?
assert !m.reachable?
end
-
+
test "a named class or module whose constants store different objects are not reachable" do
c = eval "class C; end; C"
m = eval "module M; end; M"
-
+
self.class.send(:remove_const, :C)
- self.class.send(:remove_const, :M)
+ self.class.send(:remove_const, :M)
eval "class C; end"
eval "module M; end"
-
+
assert C.reachable?
assert M.reachable?
assert !c.reachable?
diff --git a/activesupport/test/core_ext/numeric_ext_test.rb b/activesupport/test/core_ext/numeric_ext_test.rb
index 992ec60302..e40b487753 100644
--- a/activesupport/test/core_ext/numeric_ext_test.rb
+++ b/activesupport/test/core_ext/numeric_ext_test.rb
@@ -38,7 +38,7 @@ class NumericExtTimeAndDateTimeTest < Test::Unit::TestCase
assert seconds.from_now >= now + seconds
end
end
-
+
def test_irregular_durations
assert_equal @now.advance(:days => 3000), 3000.days.since(@now)
assert_equal @now.advance(:months => 1), 1.month.since(@now)
@@ -49,16 +49,16 @@ class NumericExtTimeAndDateTimeTest < Test::Unit::TestCase
assert_equal @dtnow.advance(:months => -1), 1.month.until(@dtnow)
assert_equal @dtnow.advance(:years => 20), 20.years.since(@dtnow)
end
-
+
def test_duration_addition
assert_equal @now.advance(:days => 1).advance(:months => 1), (1.day + 1.month).since(@now)
assert_equal @now.advance(:days => 7), (1.week + 5.seconds - 5.seconds).since(@now)
assert_equal @now.advance(:years => 2), (4.years - 2.years).since(@now)
assert_equal @dtnow.advance(:days => 1).advance(:months => 1), (1.day + 1.month).since(@dtnow)
assert_equal @dtnow.advance(:days => 7), (1.week + 5.seconds - 5.seconds).since(@dtnow)
- assert_equal @dtnow.advance(:years => 2), (4.years - 2.years).since(@dtnow)
+ assert_equal @dtnow.advance(:years => 2), (4.years - 2.years).since(@dtnow)
end
-
+
def test_time_plus_duration
assert_equal @now + 8, @now + 8.seconds
assert_equal @now + 22.9, @now + 22.9.seconds
@@ -69,21 +69,21 @@ class NumericExtTimeAndDateTimeTest < Test::Unit::TestCase
assert_equal @dtnow.advance(:days => 15), @dtnow + 15.days
assert_equal @dtnow.advance(:months => 1), @dtnow + 1.month
end
-
+
def test_chaining_duration_operations
assert_equal @now.advance(:days => 2).advance(:months => -3), @now + 2.days - 3.months
assert_equal @now.advance(:days => 1).advance(:months => 2), @now + 1.day + 2.months
assert_equal @dtnow.advance(:days => 2).advance(:months => -3), @dtnow + 2.days - 3.months
- assert_equal @dtnow.advance(:days => 1).advance(:months => 2), @dtnow + 1.day + 2.months
+ assert_equal @dtnow.advance(:days => 1).advance(:months => 2), @dtnow + 1.day + 2.months
end
-
+
def test_duration_after_convertion_is_no_longer_accurate
assert_equal 30.days.to_i.since(@now), 1.month.to_i.since(@now)
assert_equal 365.25.days.to_f.since(@now), 1.year.to_f.since(@now)
assert_equal 30.days.to_i.since(@dtnow), 1.month.to_i.since(@dtnow)
- assert_equal 365.25.days.to_f.since(@dtnow), 1.year.to_f.since(@dtnow)
+ assert_equal 365.25.days.to_f.since(@dtnow), 1.year.to_f.since(@dtnow)
end
-
+
def test_add_one_year_to_leap_day
assert_equal Time.utc(2005,2,28,15,15,10), Time.utc(2004,2,29,15,15,10) + 1.year
assert_equal DateTime.civil(2005,2,28,15,15,10), DateTime.civil(2004,2,29,15,15,10) + 1.year
@@ -102,12 +102,12 @@ class NumericExtDateTest < Test::Unit::TestCase
assert_equal @today.to_time.since(60), @today + 1.minute
assert_equal @today.to_time.since(60*60), @today + 1.hour
end
-
+
def test_chaining_duration_operations
assert_equal @today.advance(:days => 2).advance(:months => -3), @today + 2.days - 3.months
assert_equal @today.advance(:days => 1).advance(:months => 2), @today + 1.day + 2.months
end
-
+
def test_add_one_year_to_leap_day
assert_equal Date.new(2005,2,28), Date.new(2004,2,29) + 1.year
end
@@ -132,7 +132,7 @@ class NumericExtSizeTest < Test::Unit::TestCase
assert_equal right, left
end
end
-
+
def test_units_as_bytes_independently
assert_equal 3145728, 3.megabytes
assert_equal 3145728, 3.megabyte
diff --git a/activesupport/test/core_ext/object_and_class_ext_test.rb b/activesupport/test/core_ext/object_and_class_ext_test.rb
index 6588f2e345..3ccf18f473 100644
--- a/activesupport/test/core_ext/object_and_class_ext_test.rb
+++ b/activesupport/test/core_ext/object_and_class_ext_test.rb
@@ -144,7 +144,7 @@ class ObjectTryTest < Test::Unit::TestCase
assert !@string.respond_to?(method)
assert_raise(NoMethodError) { @string.try(method) }
end
-
+
def test_valid_method
assert_equal 5, @string.try(:size)
end
diff --git a/activesupport/test/core_ext/string_ext_test.rb b/activesupport/test/core_ext/string_ext_test.rb
index affa1b5e18..f7e2ecd357 100644
--- a/activesupport/test/core_ext/string_ext_test.rb
+++ b/activesupport/test/core_ext/string_ext_test.rb
@@ -218,7 +218,7 @@ class StringInflectionsTest < Test::Unit::TestCase
# And changes the original string:
assert_equal original, expected
end
-
+
def test_truncate
assert_equal "Hello World!", "Hello World!".truncate(12)
assert_equal "Hello Wor...", "Hello World!!".truncate(12)
diff --git a/activesupport/test/core_ext/time_ext_test.rb b/activesupport/test/core_ext/time_ext_test.rb
index 1cf84df386..c43b3eb358 100644
--- a/activesupport/test/core_ext/time_ext_test.rb
+++ b/activesupport/test/core_ext/time_ext_test.rb
@@ -187,7 +187,7 @@ class TimeExtCalculationsTest < ActiveSupport::TestCase
assert_equal Time.local(2005,4,2,3,18,0), Time.local(2005,4,3,4,18,0).ago(24.hours), 'dt-24.hours=>st'
assert_equal Time.local(2005,4,2,3,18,0), Time.local(2005,4,3,4,18,0).ago(86400), 'dt-86400=>st'
assert_equal Time.local(2005,4,2,3,18,0), Time.local(2005,4,3,4,18,0).ago(86400.seconds), 'dt-86400.seconds=>st'
-
+
assert_equal Time.local(2005,4,1,4,18,0), Time.local(2005,4,2,4,18,0).ago(24.hours), 'st-24.hours=>st'
assert_equal Time.local(2005,4,1,4,18,0), Time.local(2005,4,2,4,18,0).ago(86400), 'st-86400=>st'
assert_equal Time.local(2005,4,1,4,18,0), Time.local(2005,4,2,4,18,0).ago(86400.seconds), 'st-86400.seconds=>st'
@@ -197,7 +197,7 @@ class TimeExtCalculationsTest < ActiveSupport::TestCase
assert_equal Time.local(2006,9,30,3,18,0), Time.local(2006,10,1,4,18,0).ago(24.hours), 'dt-24.hours=>st'
assert_equal Time.local(2006,9,30,3,18,0), Time.local(2006,10,1,4,18,0).ago(86400), 'dt-86400=>st'
assert_equal Time.local(2006,9,30,3,18,0), Time.local(2006,10,1,4,18,0).ago(86400.seconds), 'dt-86400.seconds=>st'
-
+
assert_equal Time.local(2006,9,29,4,18,0), Time.local(2006,9,30,4,18,0).ago(24.hours), 'st-24.hours=>st'
assert_equal Time.local(2006,9,29,4,18,0), Time.local(2006,9,30,4,18,0).ago(86400), 'st-86400=>st'
assert_equal Time.local(2006,9,29,4,18,0), Time.local(2006,9,30,4,18,0).ago(86400.seconds), 'st-86400.seconds=>st'
@@ -210,7 +210,7 @@ class TimeExtCalculationsTest < ActiveSupport::TestCase
assert_equal Time.local(2005,10,29,5,3), Time.local(2005,10,30,4,3,0).ago(24.hours), 'st-24.hours=>dt'
assert_equal Time.local(2005,10,29,5,3), Time.local(2005,10,30,4,3,0).ago(86400), 'st-86400=>dt'
assert_equal Time.local(2005,10,29,5,3), Time.local(2005,10,30,4,3,0).ago(86400.seconds), 'st-86400.seconds=>dt'
-
+
assert_equal Time.local(2005,10,28,4,3), Time.local(2005,10,29,4,3,0).ago(24.hours), 'dt-24.hours=>dt'
assert_equal Time.local(2005,10,28,4,3), Time.local(2005,10,29,4,3,0).ago(86400), 'dt-86400=>dt'
assert_equal Time.local(2005,10,28,4,3), Time.local(2005,10,29,4,3,0).ago(86400.seconds), 'dt-86400.seconds=>dt'
@@ -220,7 +220,7 @@ class TimeExtCalculationsTest < ActiveSupport::TestCase
assert_equal Time.local(2006,3,18,5,3), Time.local(2006,3,19,4,3,0).ago(24.hours), 'st-24.hours=>dt'
assert_equal Time.local(2006,3,18,5,3), Time.local(2006,3,19,4,3,0).ago(86400), 'st-86400=>dt'
assert_equal Time.local(2006,3,18,5,3), Time.local(2006,3,19,4,3,0).ago(86400.seconds), 'st-86400.seconds=>dt'
-
+
assert_equal Time.local(2006,3,17,4,3), Time.local(2006,3,18,4,3,0).ago(24.hours), 'dt-24.hours=>dt'
assert_equal Time.local(2006,3,17,4,3), Time.local(2006,3,18,4,3,0).ago(86400), 'dt-86400=>dt'
assert_equal Time.local(2006,3,17,4,3), Time.local(2006,3,18,4,3,0).ago(86400.seconds), 'dt-86400.seconds=>dt'
@@ -252,7 +252,7 @@ class TimeExtCalculationsTest < ActiveSupport::TestCase
assert_equal Time.local(2006,3,17,4,3), Time.local(2006,3,18,4,3,0).ago(1.day), 'dt-1.day=>dt'
end
end
-
+
def test_since
assert_equal Time.local(2005,2,22,10,10,11), Time.local(2005,2,22,10,10,10).since(1)
assert_equal Time.local(2005,2,22,11,10,10), Time.local(2005,2,22,10,10,10).since(3600)
@@ -268,7 +268,7 @@ class TimeExtCalculationsTest < ActiveSupport::TestCase
assert_equal Time.local(2005,4,3,20,27,0), Time.local(2005,4,2,19,27,0).since(24.hours), 'st+24.hours=>dt'
assert_equal Time.local(2005,4,3,20,27,0), Time.local(2005,4,2,19,27,0).since(86400), 'st+86400=>dt'
assert_equal Time.local(2005,4,3,20,27,0), Time.local(2005,4,2,19,27,0).since(86400.seconds), 'st+86400.seconds=>dt'
-
+
assert_equal Time.local(2005,4,4,19,27,0), Time.local(2005,4,3,19,27,0).since(24.hours), 'dt+24.hours=>dt'
assert_equal Time.local(2005,4,4,19,27,0), Time.local(2005,4,3,19,27,0).since(86400), 'dt+86400=>dt'
assert_equal Time.local(2005,4,4,19,27,0), Time.local(2005,4,3,19,27,0).since(86400.seconds), 'dt+86400.seconds=>dt'
@@ -278,7 +278,7 @@ class TimeExtCalculationsTest < ActiveSupport::TestCase
assert_equal Time.local(2006,10,1,20,27,0), Time.local(2006,9,30,19,27,0).since(24.hours), 'st+24.hours=>dt'
assert_equal Time.local(2006,10,1,20,27,0), Time.local(2006,9,30,19,27,0).since(86400), 'st+86400=>dt'
assert_equal Time.local(2006,10,1,20,27,0), Time.local(2006,9,30,19,27,0).since(86400.seconds), 'st+86400.seconds=>dt'
-
+
assert_equal Time.local(2006,10,2,19,27,0), Time.local(2006,10,1,19,27,0).since(24.hours), 'dt+24.hours=>dt'
assert_equal Time.local(2006,10,2,19,27,0), Time.local(2006,10,1,19,27,0).since(86400), 'dt+86400=>dt'
assert_equal Time.local(2006,10,2,19,27,0), Time.local(2006,10,1,19,27,0).since(86400.seconds), 'dt+86400.seconds=>dt'
@@ -330,7 +330,7 @@ class TimeExtCalculationsTest < ActiveSupport::TestCase
assert_equal Time.local(2005,10,30,23,45,0), Time.local(2005,10,30,0,45,0).since(24.hours), 'dt+24.hours=>st'
assert_equal Time.local(2005,10,30,23,45,0), Time.local(2005,10,30,0,45,0).since(86400), 'dt+86400=>st'
assert_equal Time.local(2005,10,30,23,45,0), Time.local(2005,10,30,0,45,0).since(86400.seconds), 'dt+86400.seconds=>st'
-
+
assert_equal Time.local(2005,11, 1,0,45,0), Time.local(2005,10,31,0,45,0).since(24.hours), 'st+24.hours=>st'
assert_equal Time.local(2005,11, 1,0,45,0), Time.local(2005,10,31,0,45,0).since(86400), 'st+86400=>st'
assert_equal Time.local(2005,11, 1,0,45,0), Time.local(2005,10,31,0,45,0).since(86400.seconds), 'st+86400.seconds=>st'
@@ -340,7 +340,7 @@ class TimeExtCalculationsTest < ActiveSupport::TestCase
assert_equal Time.local(2006,3,20,0,45,0), Time.local(2006,3,19,1,45,0).since(24.hours), 'dt+24.hours=>st'
assert_equal Time.local(2006,3,20,0,45,0), Time.local(2006,3,19,1,45,0).since(86400), 'dt+86400=>st'
assert_equal Time.local(2006,3,20,0,45,0), Time.local(2006,3,19,1,45,0).since(86400.seconds), 'dt+86400.seconds=>st'
-
+
assert_equal Time.local(2006,3,21,1,45,0), Time.local(2006,3,20,1,45,0).since(24.hours), 'st+24.hours=>st'
assert_equal Time.local(2006,3,21,1,45,0), Time.local(2006,3,20,1,45,0).since(86400), 'st+86400=>st'
assert_equal Time.local(2006,3,21,1,45,0), Time.local(2006,3,20,1,45,0).since(86400.seconds), 'st+86400.seconds=>st'
@@ -729,7 +729,7 @@ class TimeExtCalculationsTest < ActiveSupport::TestCase
def test_minus_with_time_with_zone
assert_equal 86_400.0, Time.utc(2000, 1, 2) - ActiveSupport::TimeWithZone.new( Time.utc(2000, 1, 1), ActiveSupport::TimeZone['UTC'] )
end
-
+
def test_minus_with_datetime
assert_equal 86_400.0, Time.utc(2000, 1, 2) - DateTime.civil(2000, 1, 1)
end
diff --git a/activesupport/test/core_ext/time_with_zone_test.rb b/activesupport/test/core_ext/time_with_zone_test.rb
index 5ce4277672..0bb2c4a39e 100644
--- a/activesupport/test/core_ext/time_with_zone_test.rb
+++ b/activesupport/test/core_ext/time_with_zone_test.rb
@@ -287,7 +287,7 @@ class TimeWithZoneTest < Test::Unit::TestCase
assert_equal 946684800, result
assert_kind_of Integer, result
end
-
+
def test_to_i_with_wrapped_datetime
datetime = DateTime.civil(2000, 1, 1, 0)
twz = ActiveSupport::TimeWithZone.new(datetime, @time_zone)
@@ -328,7 +328,7 @@ class TimeWithZoneTest < Test::Unit::TestCase
assert_kind_of Time, @twz
assert_kind_of ActiveSupport::TimeWithZone, @twz
end
-
+
def test_class_name
assert_equal 'Time', ActiveSupport::TimeWithZone.name
end
@@ -703,7 +703,7 @@ class TimeWithZoneTest < Test::Unit::TestCase
assert_equal "Sun, 15 Jul 2007 10:30:00 EDT -04:00", twz.years_ago(1).inspect
assert_equal "Sun, 15 Jul 2007 10:30:00 EDT -04:00", (twz - 1.year).inspect
end
-
+
protected
def with_env_tz(new_tz = 'US/Eastern')
old_tz, ENV['TZ'] = ENV['TZ'], new_tz
diff --git a/activesupport/test/i18n_test.rb b/activesupport/test/i18n_test.rb
index dfcd4f822d..34825c9b8f 100644
--- a/activesupport/test/i18n_test.rb
+++ b/activesupport/test/i18n_test.rb
@@ -7,68 +7,68 @@ class I18nTest < Test::Unit::TestCase
@date = Date.parse("2008-7-2")
@time = Time.utc(2008, 7, 2, 16, 47, 1)
end
-
+
def test_time_zone_localization_with_default_format
now = Time.local(2000)
assert_equal now.strftime("%a, %d %b %Y %H:%M:%S %z"), I18n.localize(now)
end
-
+
def test_date_localization_should_use_default_format
assert_equal @date.strftime("%Y-%m-%d"), I18n.localize(@date)
end
-
+
def test_date_localization_with_default_format
assert_equal @date.strftime("%Y-%m-%d"), I18n.localize(@date, :format => :default)
end
-
+
def test_date_localization_with_short_format
assert_equal @date.strftime("%b %d"), I18n.localize(@date, :format => :short)
end
-
+
def test_date_localization_with_long_format
assert_equal @date.strftime("%B %d, %Y"), I18n.localize(@date, :format => :long)
end
-
- def test_time_localization_should_use_default_format
+
+ def test_time_localization_should_use_default_format
assert_equal @time.strftime("%a, %d %b %Y %H:%M:%S %z"), I18n.localize(@time)
end
-
+
def test_time_localization_with_default_format
assert_equal @time.strftime("%a, %d %b %Y %H:%M:%S %z"), I18n.localize(@time, :format => :default)
end
-
+
def test_time_localization_with_short_format
assert_equal @time.strftime("%d %b %H:%M"), I18n.localize(@time, :format => :short)
end
-
+
def test_time_localization_with_long_format
assert_equal @time.strftime("%B %d, %Y %H:%M"), I18n.localize(@time, :format => :long)
end
-
+
def test_day_names
assert_equal Date::DAYNAMES, I18n.translate(:'date.day_names')
end
-
+
def test_abbr_day_names
assert_equal Date::ABBR_DAYNAMES, I18n.translate(:'date.abbr_day_names')
end
-
+
def test_month_names
assert_equal Date::MONTHNAMES, I18n.translate(:'date.month_names')
end
-
+
def test_abbr_month_names
assert_equal Date::ABBR_MONTHNAMES, I18n.translate(:'date.abbr_month_names')
end
-
+
def test_date_order
assert_equal [:year, :month, :day], I18n.translate(:'date.order')
end
-
+
def test_time_am
assert_equal 'am', I18n.translate(:'time.am')
end
-
+
def test_time_pm
assert_equal 'pm', I18n.translate(:'time.pm')
end
diff --git a/activesupport/test/message_encryptor_test.rb b/activesupport/test/message_encryptor_test.rb
index 684b931176..419ac14283 100644
--- a/activesupport/test/message_encryptor_test.rb
+++ b/activesupport/test/message_encryptor_test.rb
@@ -14,18 +14,18 @@ class MessageEncryptorTest < Test::Unit::TestCase
@encryptor = ActiveSupport::MessageEncryptor.new(ActiveSupport::SecureRandom.hex(64))
@data = { :some => "data", :now => Time.local(2010) }
end
-
+
def test_simple_round_tripping
message = @encryptor.encrypt(@data)
assert_equal @data, @encryptor.decrypt(message)
end
-
+
def test_encrypting_twice_yields_differing_cipher_text
first_messqage = @encryptor.encrypt(@data)
second_message = @encryptor.encrypt(@data)
assert_not_equal first_messqage, second_message
end
-
+
def test_messing_with_either_value_causes_failure
text, iv = @encryptor.encrypt(@data).split("--")
assert_not_decrypted([iv, text] * "--")
@@ -33,20 +33,20 @@ class MessageEncryptorTest < Test::Unit::TestCase
assert_not_decrypted([munge(text), iv] * "--")
assert_not_decrypted([munge(text), munge(iv)] * "--")
end
-
+
def test_signed_round_tripping
message = @encryptor.encrypt_and_sign(@data)
assert_equal @data, @encryptor.decrypt_and_verify(message)
end
-
-
+
+
private
def assert_not_decrypted(value)
assert_raise(ActiveSupport::MessageEncryptor::InvalidMessage) do
@encryptor.decrypt(value)
end
end
-
+
def munge(base64_string)
bits = ActiveSupport::Base64.decode64(base64_string)
bits.reverse!
diff --git a/activesupport/test/multibyte_conformance.rb b/activesupport/test/multibyte_conformance.rb
index 6ec9a839af..b3b477bb75 100644
--- a/activesupport/test/multibyte_conformance.rb
+++ b/activesupport/test/multibyte_conformance.rb
@@ -27,21 +27,21 @@ end
class MultibyteConformanceTest < Test::Unit::TestCase
include MultibyteTestHelpers
-
+
UNIDATA_URL = "http://www.unicode.org/Public/#{ActiveSupport::Multibyte::Unicode::UNICODE_VERSION}/ucd"
UNIDATA_FILE = '/NormalizationTest.txt'
CACHE_DIR = File.join(Dir.tmpdir, 'cache')
-
+
def setup
FileUtils.mkdir_p(CACHE_DIR)
Downloader.download(UNIDATA_URL + UNIDATA_FILE, CACHE_DIR + UNIDATA_FILE)
@proxy = ActiveSupport::Multibyte::Chars
end
-
+
def test_normalizations_C
each_line_of_norm_tests do |*cols|
col1, col2, col3, col4, col5, comment = *cols
-
+
# CONFORMANCE:
# 1. The following invariants must be true for all conformant implementations
#
@@ -56,7 +56,7 @@ class MultibyteConformanceTest < Test::Unit::TestCase
assert_equal_codepoints col4, @proxy.new(col5).normalize(:c), "Form C - Col 4 has to be C(5) - #{comment}"
end
end
-
+
def test_normalizations_D
each_line_of_norm_tests do |*cols|
col1, col2, col3, col4, col5, comment = *cols
@@ -71,10 +71,10 @@ class MultibyteConformanceTest < Test::Unit::TestCase
assert_equal_codepoints col5, @proxy.new(col5).normalize(:d), "Form D - Col 5 has to be NFD(5) - #{comment}"
end
end
-
+
def test_normalizations_KC
each_line_of_norm_tests do | *cols |
- col1, col2, col3, col4, col5, comment = *cols
+ col1, col2, col3, col4, col5, comment = *cols
#
# NFKC
# c4 == NFKC(c1) == NFKC(c2) == NFKC(c3) == NFKC(c4) == NFKC(c5)
@@ -85,10 +85,10 @@ class MultibyteConformanceTest < Test::Unit::TestCase
assert_equal_codepoints col4, @proxy.new(col5).normalize(:kc), "Form D - Col 4 has to be NFKC(5) - #{comment}"
end
end
-
+
def test_normalizations_KD
each_line_of_norm_tests do | *cols |
- col1, col2, col3, col4, col5, comment = *cols
+ col1, col2, col3, col4, col5, comment = *cols
#
# NFKD
# c5 == NFKD(c1) == NFKD(c2) == NFKD(c3) == NFKD(c4) == NFKD(c5)
@@ -99,7 +99,7 @@ class MultibyteConformanceTest < Test::Unit::TestCase
assert_equal_codepoints col5, @proxy.new(col5).normalize(:kd), "Form KD - Col 5 has to be NFKD(5) - #{comment}"
end
end
-
+
protected
def each_line_of_norm_tests(&block)
lines = 0
@@ -108,21 +108,21 @@ class MultibyteConformanceTest < Test::Unit::TestCase
until f.eof? || (max_test_lines > 38 and lines > max_test_lines)
lines += 1
line = f.gets.chomp!
- next if (line.empty? || line =~ /^\#/)
-
+ next if (line.empty? || line =~ /^\#/)
+
cols, comment = line.split("#")
cols = cols.split(";").map{|e| e.strip}.reject{|e| e.empty? }
next unless cols.length == 5
-
+
# codepoints are in hex in the test suite, pack wants them as integers
cols.map!{|c| c.split.map{|codepoint| codepoint.to_i(16)}.pack("U*") }
cols << comment
-
+
yield(*cols)
end
end
end
-
+
def inspect_codepoints(str)
str.to_s.unpack("U*").map{|cp| cp.to_s(16) }.join(' ')
end
diff --git a/activesupport/test/option_merger_test.rb b/activesupport/test/option_merger_test.rb
index 33e3e69666..5b2e16a212 100644
--- a/activesupport/test/option_merger_test.rb
+++ b/activesupport/test/option_merger_test.rb
@@ -65,7 +65,7 @@ class OptionMergerTest < Test::Unit::TestCase
end
end
end
-
+
def test_nested_method_with_options_using_lamdba
local_lamdba = lambda { { :lambda => true } }
with_options(@options) do |o|
diff --git a/activesupport/test/rescuable_test.rb b/activesupport/test/rescuable_test.rb
index 1c74ce8b2a..bf4f5265ef 100644
--- a/activesupport/test/rescuable_test.rb
+++ b/activesupport/test/rescuable_test.rb
@@ -24,7 +24,7 @@ class Stargate
rescue_from NuclearExplosion do
@result = 'alldead'
end
-
+
rescue_from MadRonon do |e|
@result = e.message
end
@@ -80,16 +80,16 @@ class RescueableTest < Test::Unit::TestCase
@stargate.dispatch :attack
assert_equal 'killed', @stargate.result
end
-
+
def test_rescue_from_with_block
@stargate.dispatch :nuke
assert_equal 'alldead', @stargate.result
end
-
+
def test_rescue_from_with_block_with_args
@stargate.dispatch :ronanize
assert_equal 'dex', @stargate.result
- end
+ end
def test_rescues_defined_later_are_added_at_end_of_the_rescue_handlers_array
expected = ["WraithAttack", "WraithAttack", "NuclearExplosion", "MadRonon"]
diff --git a/activesupport/test/test_test.rb b/activesupport/test/test_test.rb
index 633d3b212b..cdaf63961a 100644
--- a/activesupport/test/test_test.rb
+++ b/activesupport/test/test_test.rb
@@ -89,19 +89,19 @@ end
class AssertBlankTest < ActiveSupport::TestCase
BLANK = [ EmptyTrue.new, nil, false, '', ' ', " \n\t \r ", [], {} ]
NOT_BLANK = [ EmptyFalse.new, Object.new, true, 0, 1, 'x', [nil], { nil => 0 } ]
-
+
def test_assert_blank_true
BLANK.each { |v| assert_blank v }
end
-
+
def test_assert_blank_false
NOT_BLANK.each { |v|
- begin
+ begin
assert_blank v
fail 'should not get to here'
rescue Exception => e
- assert_match(/is not blank/, e.message)
- end
+ assert_match(/is not blank/, e.message)
+ end
}
end
end
@@ -109,19 +109,19 @@ end
class AssertPresentTest < ActiveSupport::TestCase
BLANK = [ EmptyTrue.new, nil, false, '', ' ', " \n\t \r ", [], {} ]
NOT_BLANK = [ EmptyFalse.new, Object.new, true, 0, 1, 'x', [nil], { nil => 0 } ]
-
+
def test_assert_blank_true
NOT_BLANK.each { |v| assert_present v }
end
-
+
def test_assert_blank_false
BLANK.each { |v|
- begin
+ begin
assert_present v
fail 'should not get to here'
rescue Exception => e
- assert_match(/is blank/, e.message)
- end
+ assert_match(/is blank/, e.message)
+ end
}
end
end
diff --git a/activesupport/test/time_zone_test.rb b/activesupport/test/time_zone_test.rb
index af6eee69e5..49cefc6e82 100644
--- a/activesupport/test/time_zone_test.rb
+++ b/activesupport/test/time_zone_test.rb
@@ -216,7 +216,7 @@ class TimeZoneTest < Test::Unit::TestCase
assert_equal "+0000", ActiveSupport::TimeZone.seconds_to_utc_offset(0, false)
assert_equal "+0500", ActiveSupport::TimeZone.seconds_to_utc_offset(18_000, false)
end
-
+
def test_seconds_to_utc_offset_with_negative_offset
assert_equal "-01:00", ActiveSupport::TimeZone.seconds_to_utc_offset(-3_600)
assert_equal "-00:59", ActiveSupport::TimeZone.seconds_to_utc_offset(-3_599)