Methods
- S
- T
-
- test_method_with_options_allows_to_overwrite_options,
- test_method_with_options_appends_options_when_options_are_missing,
- test_method_with_options_merges_options_when_options_are_present,
- test_nested_method_with_options_containing_hashes_going_deep,
- test_nested_method_with_options_containing_hashes_merge,
- test_nested_method_with_options_containing_hashes_overwrite,
- test_nested_method_with_options_using_lambda,
- test_option_merger_class_method,
- test_option_merger_implicit_receiver
Instance Public methods
setup()
Link
test_method_with_options_allows_to_overwrite_options()
Link
# File activesupport/test/option_merger_test.rb, line 26 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
test_method_with_options_appends_options_when_options_are_missing()
Link
test_method_with_options_merges_options_when_options_are_present()
Link
# File activesupport/test/option_merger_test.rb, line 9 def test_method_with_options_merges_options_when_options_are_present local_options = {:cool => true} 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) end end
test_nested_method_with_options_containing_hashes_going_deep()
Link
# File activesupport/test/option_merger_test.rb, line 60 def test_nested_method_with_options_containing_hashes_going_deep with_options :html => { :class => "foo", :style => { :margin => 0, :display => "block" } } do |outer| outer.with_options :html => { :title => "bar", :style => { :margin => "1em", :color => "#fff" } } do |inner| expected = { :html => { :class => "foo", :title => "bar", :style => { :margin => "1em", :display => "block", :color => "#fff" } } } assert_equal expected, inner.method_with_options end end end
test_nested_method_with_options_containing_hashes_merge()
Link
# File activesupport/test/option_merger_test.rb, line 42 def test_nested_method_with_options_containing_hashes_merge with_options :conditions => { :method => :get } do |outer| outer.with_options :conditions => { :domain => "www" } do |inner| expected = { :conditions => { :method => :get, :domain => "www" } } assert_equal expected, inner.method_with_options end end end
test_nested_method_with_options_containing_hashes_overwrite()
Link
# File activesupport/test/option_merger_test.rb, line 51 def test_nested_method_with_options_containing_hashes_overwrite with_options :conditions => { :method => :get, :domain => "www" } do |outer| outer.with_options :conditions => { :method => :post } do |inner| expected = { :conditions => { :method => :post, :domain => "www" } } assert_equal expected, inner.method_with_options end end end
test_nested_method_with_options_using_lambda()
Link
# File activesupport/test/option_merger_test.rb, line 69 def test_nested_method_with_options_using_lambda local_lambda = lambda { { :lambda => true } } with_options(@options) do |o| assert_equal @options.merge(local_lambda.call), o.method_with_options(local_lambda).call end end
test_option_merger_class_method()
Link
Needed when counting objects with the ObjectSpace
test_option_merger_implicit_receiver()
Link