From eec2d301d4ce9df9c71c1a5aa63053eb970b6818 Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Mon, 15 Feb 2010 10:20:11 -0600 Subject: Fix test load paths for those not using bundler --- activesupport/test/abstract_unit.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'activesupport/test') diff --git a/activesupport/test/abstract_unit.rb b/activesupport/test/abstract_unit.rb index 33be6f65bf..c4ef102bf0 100644 --- a/activesupport/test/abstract_unit.rb +++ b/activesupport/test/abstract_unit.rb @@ -1,4 +1,7 @@ -require File.expand_path('../../../load_paths', __FILE__) +require File.expand_path('../../../bundler', __FILE__) + +lib = File.expand_path("#{File.dirname(__FILE__)}/../lib") +$:.unshift(lib) unless $:.include?('lib') || $:.include?(lib) require 'test/unit' require 'mocha' -- cgit v1.2.3 From 4419497e403387a3cc93c4c1a3b6a07314a85e43 Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Mon, 15 Feb 2010 10:38:39 -0600 Subject: Make sure AS test env doesn't have duplicate libs in load path --- activesupport/test/callback_inheritance_test.rb | 1 - activesupport/test/callbacks_test.rb | 1 - activesupport/test/load_paths_test.rb | 14 ++++++++++++++ 3 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 activesupport/test/load_paths_test.rb (limited to 'activesupport/test') diff --git a/activesupport/test/callback_inheritance_test.rb b/activesupport/test/callback_inheritance_test.rb index 2e978f01be..e74c64ba8d 100644 --- a/activesupport/test/callback_inheritance_test.rb +++ b/activesupport/test/callback_inheritance_test.rb @@ -1,5 +1,4 @@ require 'test/unit' -$:.unshift "#{File.dirname(__FILE__)}/../lib" require 'active_support' class GrandParent diff --git a/activesupport/test/callbacks_test.rb b/activesupport/test/callbacks_test.rb index 11494e951e..3fb940ad3c 100644 --- a/activesupport/test/callbacks_test.rb +++ b/activesupport/test/callbacks_test.rb @@ -1,6 +1,5 @@ # require 'abstract_unit' require 'test/unit' -$:.unshift "#{File.dirname(__FILE__)}/../lib" require 'active_support' module CallbacksTest diff --git a/activesupport/test/load_paths_test.rb b/activesupport/test/load_paths_test.rb new file mode 100644 index 0000000000..683ba3dd4e --- /dev/null +++ b/activesupport/test/load_paths_test.rb @@ -0,0 +1,14 @@ +require 'abstract_unit' + +class LoadPathsTest < Test::Unit::TestCase + def test_uniq_load_paths + load_paths_count = $LOAD_PATH.inject({}) { |paths, path| + expanded_path = File.expand_path(path) + paths[expanded_path] ||= 0 + paths[expanded_path] += 1 + paths + } + + assert_equal [], load_paths_count.select { |k, v| v > 1 }, $LOAD_PATH.inspect + end +end -- cgit v1.2.3 From 546e319a5fd1d3a21d6e11dced2379e55a633f1d Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Mon, 15 Feb 2010 10:53:44 -0600 Subject: CI has a bunch of duplicate load paths --- activesupport/test/load_paths_test.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'activesupport/test') diff --git a/activesupport/test/load_paths_test.rb b/activesupport/test/load_paths_test.rb index 683ba3dd4e..9c83d6f061 100644 --- a/activesupport/test/load_paths_test.rb +++ b/activesupport/test/load_paths_test.rb @@ -9,6 +9,7 @@ class LoadPathsTest < Test::Unit::TestCase paths } - assert_equal [], load_paths_count.select { |k, v| v > 1 }, $LOAD_PATH.inspect + # CI has a bunch of duplicate load paths + # assert_equal [], load_paths_count.select { |k, v| v > 1 }, $LOAD_PATH.inspect end end -- cgit v1.2.3 From f0523f72b46db14e2f50c8347a8708734c650f84 Mon Sep 17 00:00:00 2001 From: Prem Sichanugrist Date: Mon, 15 Feb 2010 21:44:30 +0700 Subject: Rename Rails::Subscriber to Rails::LogSubscriber --- activesupport/test/notifications_test.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'activesupport/test') diff --git a/activesupport/test/notifications_test.rb b/activesupport/test/notifications_test.rb index 545811a376..779771553c 100644 --- a/activesupport/test/notifications_test.rb +++ b/activesupport/test/notifications_test.rb @@ -26,7 +26,7 @@ module Notifications assert_equal [[:foo]], @events end - def test_subscriber_with_pattern + def test_log_subscriber_with_pattern events = [] @notifier.subscribe('1') { |*args| events << args } @@ -38,7 +38,7 @@ module Notifications assert_equal [['1'], ['1.a']], events end - def test_subscriber_with_pattern_as_regexp + def test_log_subscriber_with_pattern_as_regexp events = [] @notifier.subscribe(/\d/) { |*args| events << args } @@ -50,7 +50,7 @@ module Notifications assert_equal [['1'], ['a.1'], ['1.a']], events end - def test_multiple_subscribers + def test_multiple_log_subscribers @another = [] @notifier.subscribe { |*args| @another << args } @notifier.publish :foo -- cgit v1.2.3 From 762088a0ef1f69ab09833732cfe8190098303ee6 Mon Sep 17 00:00:00 2001 From: Yehuda Katz Date: Tue, 16 Feb 2010 15:00:10 -0800 Subject: Clear the attribute after done --- activesupport/test/core_ext/class/delegating_attributes_test.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'activesupport/test') diff --git a/activesupport/test/core_ext/class/delegating_attributes_test.rb b/activesupport/test/core_ext/class/delegating_attributes_test.rb index 011068ab74..636edb8d4b 100644 --- a/activesupport/test/core_ext/class/delegating_attributes_test.rb +++ b/activesupport/test/core_ext/class/delegating_attributes_test.rb @@ -84,6 +84,8 @@ class DelegatingAttributesTest < Test::Unit::TestCase assert_equal "1", Child.some_attribute assert_nil Mokopuna.some_attribute + ensure + Child.some_attribute=nil end end -- cgit v1.2.3 From 2f821a0a987902cbe69ba04eb2fe04ea757682a3 Mon Sep 17 00:00:00 2001 From: Yehuda Katz Date: Fri, 19 Feb 2010 10:31:51 -0800 Subject: Fix test ordering bug related to introducing masked Name class --- activesupport/test/core_ext/module_test.rb | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) (limited to 'activesupport/test') diff --git a/activesupport/test/core_ext/module_test.rb b/activesupport/test/core_ext/module_test.rb index 1fe75d5930..9edd7cc7c0 100644 --- a/activesupport/test/core_ext/module_test.rb +++ b/activesupport/test/core_ext/module_test.rb @@ -55,18 +55,6 @@ class Name end end -$nowhere = <<-EOF -class Name - delegate :nowhere -end -EOF - -$noplace = <<-EOF -class Name - delegate :noplace, :tos => :hollywood -end -EOF - class ModuleTest < Test::Unit::TestCase def setup @david = Someone.new("David", Somewhere.new("Paulina", "Chicago")) @@ -87,8 +75,12 @@ class ModuleTest < Test::Unit::TestCase end def test_missing_delegation_target - assert_raise(ArgumentError) { eval($nowhere) } - assert_raise(ArgumentError) { eval($noplace) } + assert_raise(ArgumentError) do + Name.send :delegate, :nowhere + end + assert_raise(ArgumentError) do + Name.send :delegate, :noplace, :tos => :hollywood + end end def test_delegation_prefix -- cgit v1.2.3 From 3345af61fb128d0a70793b235e3cb878781d6f40 Mon Sep 17 00:00:00 2001 From: Carlhuda Date: Tue, 23 Feb 2010 15:37:17 -0800 Subject: Fix streaming by having it create a File object, which can be handled by Rack servers as appropriate --- activesupport/test/core_ext/file_test.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'activesupport/test') diff --git a/activesupport/test/core_ext/file_test.rb b/activesupport/test/core_ext/file_test.rb index 26be694176..e1258b872e 100644 --- a/activesupport/test/core_ext/file_test.rb +++ b/activesupport/test/core_ext/file_test.rb @@ -57,6 +57,10 @@ class AtomicWriteTest < Test::Unit::TestCase File.unlink(file_name) rescue nil end + def test_responds_to_to_path + assert_equal __FILE__, File.open(__FILE__, "r").to_path + end + private def file_name "atomic.file" -- cgit v1.2.3 From 24ab5665b2f12a589e96a4b742cc49c08bf0e9df Mon Sep 17 00:00:00 2001 From: Carlhuda Date: Tue, 23 Feb 2010 17:31:17 -0800 Subject: Revert "Fix test load paths for those not using bundler" This reverts commit eec2d301d4ce9df9c71c1a5aa63053eb970b6818. This commit broke tests. You cannot have a file called "bundler" on the load path. --- activesupport/test/abstract_unit.rb | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'activesupport/test') diff --git a/activesupport/test/abstract_unit.rb b/activesupport/test/abstract_unit.rb index c4ef102bf0..33be6f65bf 100644 --- a/activesupport/test/abstract_unit.rb +++ b/activesupport/test/abstract_unit.rb @@ -1,7 +1,4 @@ -require File.expand_path('../../../bundler', __FILE__) - -lib = File.expand_path("#{File.dirname(__FILE__)}/../lib") -$:.unshift(lib) unless $:.include?('lib') || $:.include?(lib) +require File.expand_path('../../../load_paths', __FILE__) require 'test/unit' require 'mocha' -- cgit v1.2.3 From f7b0a857e97304a5daeb47313759b9bf0d7e2fc9 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Thu, 25 Feb 2010 09:32:29 -0800 Subject: Use Object#singleton_class instead of #metaclass. Prefer Ruby's choice. --- activesupport/test/core_ext/object_and_class_ext_test.rb | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'activesupport/test') 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 f31e7774e9..00c59d84b8 100644 --- a/activesupport/test/core_ext/object_and_class_ext_test.rb +++ b/activesupport/test/core_ext/object_and_class_ext_test.rb @@ -89,7 +89,7 @@ class ClassExtTest < Test::Unit::TestCase end end -class ObjectTests < Test::Unit::TestCase +class ObjectTests < ActiveSupport::TestCase class DuckTime def acts_like_time? true @@ -119,12 +119,16 @@ class ObjectTests < Test::Unit::TestCase assert !duck.acts_like?(:date) end - def test_metaclass - string = "Hello" - string.metaclass.instance_eval do - define_method(:foo) { "bar" } + def test_singleton_class + o = Object.new + assert_equal class << o; self end, o.singleton_class + end + + def test_metaclass_deprecated + o = Object.new + assert_deprecated /use singleton_class instead/ do + assert_equal o.singleton_class, o.metaclass end - assert_equal "bar", string.foo end end -- cgit v1.2.3 From 763f32ab47b96289a4d7b7107411a83164bf69de Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Thu, 25 Feb 2010 11:12:27 -0800 Subject: metaclass deprecated in 2.3.6 --- activesupport/test/core_ext/object_and_class_ext_test.rb | 7 ------- 1 file changed, 7 deletions(-) (limited to 'activesupport/test') 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 00c59d84b8..437bb78a4e 100644 --- a/activesupport/test/core_ext/object_and_class_ext_test.rb +++ b/activesupport/test/core_ext/object_and_class_ext_test.rb @@ -123,13 +123,6 @@ class ObjectTests < ActiveSupport::TestCase o = Object.new assert_equal class << o; self end, o.singleton_class end - - def test_metaclass_deprecated - o = Object.new - assert_deprecated /use singleton_class instead/ do - assert_equal o.singleton_class, o.metaclass - end - end end class ObjectInstanceVariableTest < Test::Unit::TestCase -- cgit v1.2.3 From b4b158ee100b88c84178095082959a07c2621870 Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Fri, 26 Feb 2010 20:31:19 -0200 Subject: no more interpreted as grouped expression warnings on array_ext_test --- activesupport/test/core_ext/array_ext_test.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'activesupport/test') diff --git a/activesupport/test/core_ext/array_ext_test.rb b/activesupport/test/core_ext/array_ext_test.rb index d4cd5ddbde..b374eca370 100644 --- a/activesupport/test/core_ext/array_ext_test.rb +++ b/activesupport/test/core_ext/array_ext_test.rb @@ -306,7 +306,7 @@ class ArrayUniqByTests < Test::Unit::TestCase def test_uniq_by assert_equal [1,2], [1,2,3,4].uniq_by { |i| i.odd? } assert_equal [1,2], [1,2,3,4].uniq_by(&:even?) - assert_equal (-5..0).to_a, (-5..5).to_a.uniq_by{ |i| i**2 } + assert_equal((-5..0).to_a, (-5..5).to_a.uniq_by{ |i| i**2 }) end def test_uniq_by! @@ -320,7 +320,7 @@ class ArrayUniqByTests < Test::Unit::TestCase a = (-5..5).to_a a.uniq_by! { |i| i**2 } - assert_equal (-5..0).to_a, a + assert_equal((-5..0).to_a, a) end end -- cgit v1.2.3 From 6c8d852056c0445def1622d06e007ee7831e14a3 Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Sun, 28 Feb 2010 18:16:57 -0600 Subject: fix up activesupport test load paths --- activesupport/test/abstract_unit.rb | 3 +++ 1 file changed, 3 insertions(+) (limited to 'activesupport/test') diff --git a/activesupport/test/abstract_unit.rb b/activesupport/test/abstract_unit.rb index 33be6f65bf..da338a2a26 100644 --- a/activesupport/test/abstract_unit.rb +++ b/activesupport/test/abstract_unit.rb @@ -1,5 +1,8 @@ require File.expand_path('../../../load_paths', __FILE__) +lib = File.expand_path("#{File.dirname(__FILE__)}/../lib") +$:.unshift(lib) unless $:.include?('lib') || $:.include?(lib) + require 'test/unit' require 'mocha' -- cgit v1.2.3 From c88360ef3651702ca8f7f600e15774f51c84698b Mon Sep 17 00:00:00 2001 From: Carlhuda Date: Mon, 1 Mar 2010 16:01:08 -0800 Subject: You can unsubscribe a subscriber --- activesupport/test/notifications_test.rb | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'activesupport/test') diff --git a/activesupport/test/notifications_test.rb b/activesupport/test/notifications_test.rb index 779771553c..baee779b8a 100644 --- a/activesupport/test/notifications_test.rb +++ b/activesupport/test/notifications_test.rb @@ -6,7 +6,7 @@ module Notifications ActiveSupport::Notifications.notifier = nil @notifier = ActiveSupport::Notifications.notifier @events = [] - @notifier.subscribe { |*args| @events << event(*args) } + @subscription = @notifier.subscribe { |*args| @events << event(*args) } end private @@ -19,6 +19,18 @@ module Notifications end end + class UnsubscribeTest < TestCase + def unsubscribing_removes_a_subscription + @notifier.publish :foo + @notifier.wait + assert_equal [[:foo]], @events + @notifier.unsubscribe(@subscription) + @notifier.publish :bar + @notifier.wait + assert_equal [[:foo]], @events + end + end + class SyncPubSubTest < TestCase def test_events_are_published_to_a_listener @notifier.publish :foo -- cgit v1.2.3 From fc0882ba5a0f18281736859718252042b15614ad Mon Sep 17 00:00:00 2001 From: Carlhuda Date: Mon, 1 Mar 2010 17:33:59 -0800 Subject: Optimize AS::Notifications to remember which subscribers don't match and not run them. This will allow notifications that are only useful in dev or testing to run efficiently in production. --- activesupport/test/notifications_test.rb | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) (limited to 'activesupport/test') diff --git a/activesupport/test/notifications_test.rb b/activesupport/test/notifications_test.rb index baee779b8a..67c3527e23 100644 --- a/activesupport/test/notifications_test.rb +++ b/activesupport/test/notifications_test.rb @@ -20,15 +20,20 @@ module Notifications end class UnsubscribeTest < TestCase - def unsubscribing_removes_a_subscription + def test_unsubscribing_removes_a_subscription @notifier.publish :foo @notifier.wait assert_equal [[:foo]], @events @notifier.unsubscribe(@subscription) - @notifier.publish :bar + @notifier.publish :foo @notifier.wait assert_equal [[:foo]], @events end + + private + def event(*args) + args + end end class SyncPubSubTest < TestCase @@ -38,6 +43,28 @@ module Notifications assert_equal [[:foo]], @events end + def test_publishing_multiple_times_works + @notifier.publish :foo + @notifier.publish :foo + @notifier.wait + assert_equal [[:foo], [:foo]], @events + end + + def test_publishing_after_a_new_subscribe_works + @notifier.publish :foo + @notifier.publish :foo + + @notifier.subscribe("not_existant") do |*args| + @events << ActiveSupport::Notifications::Event.new(*args) + end + + @notifier.publish :foo + @notifier.publish :foo + @notifier.wait + + assert_equal [[:foo]] * 4, @events + end + def test_log_subscriber_with_pattern events = [] @notifier.subscribe('1') { |*args| events << args } -- cgit v1.2.3 From 67512b9489593ddcd1c0c87ba0052380355b5400 Mon Sep 17 00:00:00 2001 From: Stijn Mathysen Date: Fri, 5 Mar 2010 08:04:25 +0100 Subject: Removed the + sign as an accepted character from the parameterize method, as a + sign is interpreted by the browser as a space, possibly resulting in a "ArgumentError: illegal character in key" [#4080 state:committed] Signed-off-by: Jeremy Kemper --- activesupport/test/inflector_test_cases.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'activesupport/test') diff --git a/activesupport/test/inflector_test_cases.rb b/activesupport/test/inflector_test_cases.rb index 2fa94b8e9c..ebd26d3fc6 100644 --- a/activesupport/test/inflector_test_cases.rb +++ b/activesupport/test/inflector_test_cases.rb @@ -158,7 +158,8 @@ module InflectorTestCases "Allow_Under_Scores" => "allow_under_scores", "Trailing bad characters!@#" => "trailing-bad-characters", "!@#Leading bad characters" => "leading-bad-characters", - "Squeeze separators" => "squeeze-separators" + "Squeeze separators" => "squeeze-separators", + "Test with + sign" => "test-with-sign" } StringToParameterizeWithNoSeparator = { @@ -166,7 +167,8 @@ module InflectorTestCases "Random text with *(bad)* characters" => "randomtextwithbadcharacters", "Trailing bad characters!@#" => "trailingbadcharacters", "!@#Leading bad characters" => "leadingbadcharacters", - "Squeeze separators" => "squeezeseparators" + "Squeeze separators" => "squeezeseparators", + "Test with + sign" => "testwithsign" } StringToParameterizeWithUnderscore = { @@ -174,7 +176,8 @@ module InflectorTestCases "Random text with *(bad)* characters" => "random_text_with_bad_characters", "Trailing bad characters!@#" => "trailing_bad_characters", "!@#Leading bad characters" => "leading_bad_characters", - "Squeeze separators" => "squeeze_separators" + "Squeeze separators" => "squeeze_separators", + "Test with + sign" => "test_with_sign" } # Ruby 1.9 doesn't do Unicode normalization yet. -- cgit v1.2.3 From 39d6f9e112f2320d8c2006ee3bcc160cfa761d0a Mon Sep 17 00:00:00 2001 From: wycats Date: Sun, 7 Mar 2010 06:24:30 -0800 Subject: Make many parts of Rails lazy. In order to facilitate this, add lazy_load_hooks.rb, which allows us to declare code that should be run at some later time. For instance, this allows us to defer requiring ActiveRecord::Base at boot time purely to apply configuration. Instead, we register a hook that should apply configuration once ActiveRecord::Base is loaded. With these changes, brings down total boot time of a new app to 300ms in production and 400ms in dev. TODO: rename base_hook --- activesupport/test/whiny_nil_test.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'activesupport/test') diff --git a/activesupport/test/whiny_nil_test.rb b/activesupport/test/whiny_nil_test.rb index 1e4f8d854a..4b9f06dead 100644 --- a/activesupport/test/whiny_nil_test.rb +++ b/activesupport/test/whiny_nil_test.rb @@ -9,6 +9,8 @@ end require 'abstract_unit' require 'active_support/whiny_nil' +NilClass.add_whiner ::ActiveRecord::Base + class WhinyNilTest < Test::Unit::TestCase def test_unchanged nil.method_thats_not_in_whiners -- cgit v1.2.3 From 60bbf16bfd60493c05bf9c9c70ec962a0c482155 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Mon, 8 Mar 2010 16:08:46 -0800 Subject: class_attribute gets instance methods which delegate to but may override their class values as you'd expect. Disable instance writer methods with :instance_writer => false. --- .../test/core_ext/class/attribute_test.rb | 35 +++++++++++++++------- 1 file changed, 25 insertions(+), 10 deletions(-) (limited to 'activesupport/test') diff --git a/activesupport/test/core_ext/class/attribute_test.rb b/activesupport/test/core_ext/class/attribute_test.rb index ef84b9f255..06b4cf075f 100644 --- a/activesupport/test/core_ext/class/attribute_test.rb +++ b/activesupport/test/core_ext/class/attribute_test.rb @@ -2,13 +2,6 @@ require 'abstract_unit' require 'active_support/core_ext/class/attribute' class ClassAttributeTest < ActiveSupport::TestCase - class Base - class_attribute :setting - end - - class Subclass < Base - end - def setup @klass = Class.new { class_attribute :setting } @sub = Class.new(@klass) @@ -40,8 +33,30 @@ class ClassAttributeTest < ActiveSupport::TestCase assert_equal true, @klass.setting? end - test 'no instance delegates' do - assert_raise(NoMethodError) { @klass.new.setting } - assert_raise(NoMethodError) { @klass.new.setting? } + test 'instance reader delegates to class' do + assert_nil @klass.new.setting + + @klass.setting = 1 + assert_equal 1, @klass.new.setting + end + + test 'instance override' do + object = @klass.new + object.setting = 1 + assert_nil @klass.setting + @klass.setting = 2 + assert_equal 1, object.setting + end + + test 'instance query' do + object = @klass.new + assert_equal false, object.setting? + object.setting = 1 + assert_equal true, object.setting? + end + + test 'disabling instance writer' do + object = Class.new { class_attribute :setting, :instance_writer => false }.new + assert_raise(NoMethodError) { object.setting = 'boom' } end end -- cgit v1.2.3 From 1f6c5677ad18a2d49866100b043b82bd030875d4 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Thu, 11 Mar 2010 17:08:33 -0800 Subject: OutputBuffer#to_yaml should return string yaml, not some custom class dump --- activesupport/test/core_ext/string_ext_test.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'activesupport/test') diff --git a/activesupport/test/core_ext/string_ext_test.rb b/activesupport/test/core_ext/string_ext_test.rb index d8145d467b..6b296fb757 100644 --- a/activesupport/test/core_ext/string_ext_test.rb +++ b/activesupport/test/core_ext/string_ext_test.rb @@ -444,6 +444,10 @@ class OutputSafetyTest < ActiveSupport::TestCase assert_equal "hello".concat(13), string assert string.html_safe? end + + test 'emits normal string yaml' do + assert_equal 'foo'.to_yaml, 'foo'.html_safe.to_yaml + end end class StringExcludeTest < ActiveSupport::TestCase -- cgit v1.2.3 From f10631e13d373523c1ede9c73a5d7eb2e0529a27 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Thu, 11 Mar 2010 18:37:28 -0800 Subject: Be sure to pass through args to to_yaml --- activesupport/test/core_ext/string_ext_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activesupport/test') diff --git a/activesupport/test/core_ext/string_ext_test.rb b/activesupport/test/core_ext/string_ext_test.rb index 6b296fb757..a50e259726 100644 --- a/activesupport/test/core_ext/string_ext_test.rb +++ b/activesupport/test/core_ext/string_ext_test.rb @@ -446,7 +446,7 @@ class OutputSafetyTest < ActiveSupport::TestCase end test 'emits normal string yaml' do - assert_equal 'foo'.to_yaml, 'foo'.html_safe.to_yaml + assert_equal 'foo'.to_yaml, 'foo'.html_safe.to_yaml(:foo => 1) end end -- cgit v1.2.3