diff options
author | Florent Guilleux <florent2@gmail.com> | 2012-12-01 13:22:49 -0500 |
---|---|---|
committer | Florent Guilleux <florent2@gmail.com> | 2012-12-01 13:22:49 -0500 |
commit | 8dc4041a9b2fb0e8bc2bcb72ab93adb8722e62cd (patch) | |
tree | d3c21858cb1a7fae8339b4542b200d59dc9ec815 /activesupport/test | |
parent | 90c887fa7d0c454b7533e208daefc342dea4d5f3 (diff) | |
download | rails-8dc4041a9b2fb0e8bc2bcb72ab93adb8722e62cd.tar.gz rails-8dc4041a9b2fb0e8bc2bcb72ab93adb8722e62cd.tar.bz2 rails-8dc4041a9b2fb0e8bc2bcb72ab93adb8722e62cd.zip |
Revert "Remove trailing whitespaces"
This reverts commit 90c887fa7d0c454b7533e208daefc342dea4d5f3.
Diffstat (limited to 'activesupport/test')
-rw-r--r-- | activesupport/test/callbacks_test.rb | 10 | ||||
-rw-r--r-- | activesupport/test/core_ext/bigdecimal_test.rb | 2 | ||||
-rw-r--r-- | activesupport/test/core_ext/duration_test.rb | 2 | ||||
-rw-r--r-- | activesupport/test/core_ext/module/remove_method_test.rb | 8 | ||||
-rw-r--r-- | activesupport/test/core_ext/numeric_ext_test.rb | 18 | ||||
-rw-r--r-- | activesupport/test/core_ext/object/inclusion_test.rb | 6 | ||||
-rw-r--r-- | activesupport/test/core_ext/object_and_class_ext_test.rb | 2 | ||||
-rw-r--r-- | activesupport/test/deprecation_test.rb | 4 | ||||
-rw-r--r-- | activesupport/test/inflector_test.rb | 2 | ||||
-rw-r--r-- | activesupport/test/message_verifier_test.rb | 8 |
10 files changed, 32 insertions, 30 deletions
diff --git a/activesupport/test/callbacks_test.rb b/activesupport/test/callbacks_test.rb index 8bd182120a..8810302f40 100644 --- a/activesupport/test/callbacks_test.rb +++ b/activesupport/test/callbacks_test.rb @@ -297,7 +297,7 @@ module CallbacksTest end end end - + class AroundPersonResult < MySuper attr_reader :result @@ -308,7 +308,7 @@ module CallbacksTest def tweedle_dum @result = yield end - + def tweedle_1 :tweedle_1 end @@ -316,7 +316,7 @@ module CallbacksTest def tweedle_2 :tweedle_2 end - + def save run_callbacks :save do :running @@ -410,7 +410,7 @@ module CallbacksTest ], around.history end end - + class AroundCallbackResultTest < ActiveSupport::TestCase def test_save_around around = AroundPersonResult.new @@ -709,5 +709,5 @@ module CallbacksTest end end end - + end diff --git a/activesupport/test/core_ext/bigdecimal_test.rb b/activesupport/test/core_ext/bigdecimal_test.rb index 112564944f..a5987044b9 100644 --- a/activesupport/test/core_ext/bigdecimal_test.rb +++ b/activesupport/test/core_ext/bigdecimal_test.rb @@ -14,7 +14,7 @@ class BigDecimalTest < ActiveSupport::TestCase bd = BigDecimal.new '10' assert_equal bd, bd.to_d end - + def test_to_s bd = BigDecimal.new '0.01' assert_equal '0.01', bd.to_s diff --git a/activesupport/test/core_ext/duration_test.rb b/activesupport/test/core_ext/duration_test.rb index 3b7e2f542c..c8312aa653 100644 --- a/activesupport/test/core_ext/duration_test.rb +++ b/activesupport/test/core_ext/duration_test.rb @@ -131,7 +131,7 @@ class DurationTest < ActiveSupport::TestCase assert_equal Time.local(2009,3,29,0,0,0) + 1.day, Time.local(2009,3,30,0,0,0) end end - + def test_delegation_with_block_works counter = 0 assert_nothing_raised do diff --git a/activesupport/test/core_ext/module/remove_method_test.rb b/activesupport/test/core_ext/module/remove_method_test.rb index 9950a0bf95..4657f0c175 100644 --- a/activesupport/test/core_ext/module/remove_method_test.rb +++ b/activesupport/test/core_ext/module/remove_method_test.rb @@ -6,19 +6,19 @@ module RemoveMethodTests def do_something return 1 end - + end end class RemoveMethodTest < ActiveSupport::TestCase - + def test_remove_method_from_an_object RemoveMethodTests::A.class_eval{ self.remove_possible_method(:do_something) } assert !RemoveMethodTests::A.new.respond_to?(:do_something) end - + def test_redefine_method_in_an_object RemoveMethodTests::A.class_eval{ self.redefine_method(:do_something) { return 100 } @@ -26,4 +26,4 @@ class RemoveMethodTest < ActiveSupport::TestCase assert_equal 100, RemoveMethodTests::A.new.do_something end -end +end
\ No newline at end of file diff --git a/activesupport/test/core_ext/numeric_ext_test.rb b/activesupport/test/core_ext/numeric_ext_test.rb index 73c242b94f..435f4aa5a1 100644 --- a/activesupport/test/core_ext/numeric_ext_test.rb +++ b/activesupport/test/core_ext/numeric_ext_test.rb @@ -203,7 +203,7 @@ class NumericExtFormattingTest < ActiveSupport::TestCase def terabytes(number) gigabytes(number) * 1024 end - + def test_to_s__phone assert_equal("555-1234", 5551234.to_s(:phone)) assert_equal("800-555-1212", 8005551212.to_s(:phone)) @@ -217,7 +217,7 @@ class NumericExtFormattingTest < ActiveSupport::TestCase assert_equal("22-555-1212", 225551212.to_s(:phone)) assert_equal("+45-22-555-1212", 225551212.to_s(:phone, :country_code => 45)) end - + def test_to_s__currency assert_equal("$1,234,567,890.50", 1234567890.50.to_s(:currency)) assert_equal("$1,234,567,890.51", 1234567890.506.to_s(:currency)) @@ -228,7 +228,8 @@ class NumericExtFormattingTest < ActiveSupport::TestCase assert_equal("$1,234,567,890.5", 1234567890.50.to_s(:currency, :precision => 1)) assert_equal("£1234567890,50", 1234567890.50.to_s(:currency, :unit => "£", :separator => ",", :delimiter => "")) end - + + def test_to_s__rounded assert_equal("-111.235", -111.2346.to_s(:rounded)) assert_equal("111.235", 111.2346.to_s(:rounded)) @@ -245,7 +246,7 @@ class NumericExtFormattingTest < ActiveSupport::TestCase assert_equal("11.00", 10.995.to_s(:rounded, :precision => 2)) assert_equal("0.00", -0.001.to_s(:rounded, :precision => 2)) end - + def test_to_s__percentage assert_equal("100.000%", 100.to_s(:percentage)) assert_equal("100%", 100.to_s(:percentage, :precision => 0)) @@ -273,6 +274,7 @@ class NumericExtFormattingTest < ActiveSupport::TestCase assert_equal '12.345.678,05', 12345678.05.to_s(:delimited, :separator => ',', :delimiter => '.') assert_equal '12.345.678,05', 12345678.05.to_s(:delimited, :delimiter => '.', :separator => ',') end + def test_to_s__rounded_with_custom_delimiter_and_separator assert_equal '31,83', 31.825.to_s(:rounded, :precision => 2, :separator => ',') @@ -348,7 +350,7 @@ class NumericExtFormattingTest < ActiveSupport::TestCase assert_equal '1.23 GB', 1234567890.to_s(:human_size, :prefix => :si) assert_equal '1.23 TB', 1234567890123.to_s(:human_size, :prefix => :si) end - + def test_to_s__human_size_with_options_hash assert_equal '1.2 MB', 1234567.to_s(:human_size, :precision => 2) assert_equal '3 Bytes', 3.14159265.to_s(:human_size, :precision => 4) @@ -364,13 +366,13 @@ class NumericExtFormattingTest < ActiveSupport::TestCase assert_equal '1.012 KB', kilobytes(1.0123).to_s(:human_size, :precision => 3, :significant => false) assert_equal '1 KB', kilobytes(1.0123).to_s(:human_size, :precision => 0, :significant => true) #ignores significant it precision is 0 end - + def test_to_s__human_size_with_custom_delimiter_and_separator assert_equal '1,01 KB', kilobytes(1.0123).to_s(:human_size, :precision => 3, :separator => ',') assert_equal '1,01 KB', kilobytes(1.0100).to_s(:human_size, :precision => 4, :separator => ',') assert_equal '1.000,1 TB', terabytes(1000.1).to_s(:human_size, :precision => 5, :delimiter => '.', :separator => ',') end - + def test_number_to_human assert_equal '-123', -123.to_s(:human) assert_equal '-0.5', -0.5.to_s(:human) @@ -434,7 +436,7 @@ class NumericExtFormattingTest < ActiveSupport::TestCase def test_to_s__injected_on_proper_types assert_equal Fixnum, 1230.class assert_equal '1.23 Thousand', 1230.to_s(:human) - + assert_equal Float, Float(1230).class assert_equal '1.23 Thousand', Float(1230).to_s(:human) diff --git a/activesupport/test/core_ext/object/inclusion_test.rb b/activesupport/test/core_ext/object/inclusion_test.rb index 37aa7a6038..22888333f5 100644 --- a/activesupport/test/core_ext/object/inclusion_test.rb +++ b/activesupport/test/core_ext/object/inclusion_test.rb @@ -6,12 +6,12 @@ class InTest < ActiveSupport::TestCase assert :b.in?(:a,:b) assert !:c.in?(:a,:b) end - + def test_in_multiple_arrays assert [1,2].in?([1,2],[2,3]) assert ![1,2].in?([1,3],[2,1]) end - + def test_in_array assert 1.in?([1,2]) assert !3.in?([1,2]) @@ -53,7 +53,7 @@ class InTest < ActiveSupport::TestCase assert A.in?(C) assert !A.in?(A) end - + def test_no_method_catching assert_raise(ArgumentError) { 1.in?(1) } end 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 2715eb86df..ec7dd6d4fb 100644 --- a/activesupport/test/core_ext/object_and_class_ext_test.rb +++ b/activesupport/test/core_ext/object_and_class_ext_test.rb @@ -162,7 +162,7 @@ class ObjectTryTest < ActiveSupport::TestCase assert_raise(NoMethodError) { klass.new.try!(:private_method) } end - + def test_try_with_private_method klass = Class.new do private diff --git a/activesupport/test/deprecation_test.rb b/activesupport/test/deprecation_test.rb index d578ef1a09..332100f5a1 100644 --- a/activesupport/test/deprecation_test.rb +++ b/activesupport/test/deprecation_test.rb @@ -254,10 +254,10 @@ class DeprecationTest < ActiveSupport::TestCase klass::OLD.to_s end end - + def test_deprecated_instance_variable_with_instance_deprecator deprecator = deprecator_with_messages - + klass = Class.new() do def initialize(deprecator) @request = ActiveSupport::Deprecation::DeprecatedInstanceVariableProxy.new(self, :request, :@request, deprecator) diff --git a/activesupport/test/inflector_test.rb b/activesupport/test/inflector_test.rb index a1e5db6a2e..aa41e57928 100644 --- a/activesupport/test/inflector_test.rb +++ b/activesupport/test/inflector_test.rb @@ -361,7 +361,7 @@ class InflectorTest < ActiveSupport::TestCase inflect.singular(/s$/, '') inflect.singular(/es$/, '') - + inflect.irregular('el', 'los') end diff --git a/activesupport/test/message_verifier_test.rb b/activesupport/test/message_verifier_test.rb index 4484c42415..5adff41653 100644 --- a/activesupport/test/message_verifier_test.rb +++ b/activesupport/test/message_verifier_test.rb @@ -11,7 +11,7 @@ require 'active_support/time' require 'active_support/json' class MessageVerifierTest < ActiveSupport::TestCase - + class JSONSerializer def dump(value) ActiveSupport::JSON.encode(value) @@ -21,7 +21,7 @@ class MessageVerifierTest < ActiveSupport::TestCase ActiveSupport::JSON.decode(value) end end - + def setup @verifier = ActiveSupport::MessageVerifier.new("Hey, I'm a secret!") @data = { :some => "data", :now => Time.local(2010) } @@ -43,13 +43,13 @@ class MessageVerifierTest < ActiveSupport::TestCase assert_not_verified("#{data}--#{hash.reverse}") assert_not_verified("purejunk") end - + def test_alternative_serialization_method verifier = ActiveSupport::MessageVerifier.new("Hey, I'm a secret!", :serializer => JSONSerializer.new) message = verifier.generate({ :foo => 123, 'bar' => Time.utc(2010) }) assert_equal verifier.verify(message), { "foo" => 123, "bar" => "2010-01-01T00:00:00Z" } end - + def assert_not_verified(message) assert_raise(ActiveSupport::MessageVerifier::InvalidSignature) do @verifier.verify(message) |