aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/option_merger_test.rb
diff options
context:
space:
mode:
authorMarcel Molina <marcel@vernix.org>2006-04-26 21:49:41 +0000
committerMarcel Molina <marcel@vernix.org>2006-04-26 21:49:41 +0000
commit71ff705449aa0cc38baa746c07d2520fdb64096a (patch)
treea0aa21a9b6245dadf271bc38a5237524100a26cb /activesupport/test/option_merger_test.rb
parentca2eb16bf9a5844607787c49be38bd36cfbfd568 (diff)
downloadrails-71ff705449aa0cc38baa746c07d2520fdb64096a.tar.gz
rails-71ff705449aa0cc38baa746c07d2520fdb64096a.tar.bz2
rails-71ff705449aa0cc38baa746c07d2520fdb64096a.zip
Allow default options in with_options to be overridden. Closes #4480. [murphy@cYcnus.de]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4282 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/test/option_merger_test.rb')
-rw-r--r--activesupport/test/option_merger_test.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/activesupport/test/option_merger_test.rb b/activesupport/test/option_merger_test.rb
index f5287d5725..e97a4f918b 100644
--- a/activesupport/test/option_merger_test.rb
+++ b/activesupport/test/option_merger_test.rb
@@ -27,6 +27,22 @@ class OptionMergerTest < Test::Unit::TestCase
end
end
+ def test_method_with_options_allows_to_overwrite_options
+ local_options = {:hello => 'moon'}
+ assert_equal @options.keys, local_options.keys
+
+ with_options(@options) do |o|
+ assert_equal local_options, method_with_options(local_options)
+ assert_equal @options.merge(local_options),
+ o.method_with_options(local_options)
+ assert_equal local_options, o.method_with_options(local_options)
+ end
+ with_options(local_options) do |o|
+ assert_equal local_options.merge(@options),
+ o.method_with_options(@options)
+ end
+ end
+
private
def method_with_options(options = {})
options