Skip to content
Browse files

Don't mutate the Base settings by merge!ing the given value

  • Loading branch information...
1 parent fb97a7d commit 64202abc3d15663776b29654e415c2708611e237 @amatsuda amatsuda committed Jul 26, 2013
View
2 actionmailer/lib/action_mailer/delivery_methods.rb
@@ -64,7 +64,7 @@ def wrap_delivery_behavior(mail, method=nil, options=nil) # :nodoc:
raise "Delivery method cannot be nil"
when Symbol
if klass = delivery_methods[method]
- mail.delivery_method(klass,(send(:"#{method}_settings") || {}).merge!(options || {}))
+ mail.delivery_method(klass, (send(:"#{method}_settings") || {}).merge(options || {}))
else
raise "Invalid delivery method #{method.inspect}"
end
View
3 actionmailer/test/delivery_methods_test.rb
@@ -152,6 +152,9 @@ def teardown
assert_equal "overridden", delivery_method_instance.settings[:user_name]
assert_equal "somethingobtuse", delivery_method_instance.settings[:password]
assert_equal delivery_method_instance.settings.merge(overridden_options), delivery_method_instance.settings
+
+ # make sure that overriding delivery method options per mail instance doesn't affect the Base setting
+ assert_equal settings, ActionMailer::Base.smtp_settings
end
test "non registered delivery methods raises errors" do

0 comments on commit 64202ab

Please sign in to comment.
Something went wrong with that request. Please try again.