diff options
author | Richard Schneeman <richard.schneeman@gmail.com> | 2015-11-06 16:32:51 -0600 |
---|---|---|
committer | Richard Schneeman <richard.schneeman@gmail.com> | 2015-11-06 16:32:51 -0600 |
commit | 92bc8cdb0771bf6ffcfb31ef58dba529527b514c (patch) | |
tree | dbef2dfcf006ecadf748de995c23dba857ac9d33 /activerecord/test | |
parent | 79d310fbd33c172f7f54d989191008581e028b64 (diff) | |
parent | 2fe4586974689842dbdf3354678438618089accc (diff) | |
download | rails-92bc8cdb0771bf6ffcfb31ef58dba529527b514c.tar.gz rails-92bc8cdb0771bf6ffcfb31ef58dba529527b514c.tar.bz2 rails-92bc8cdb0771bf6ffcfb31ef58dba529527b514c.zip |
Merge pull request #21967 from kevinbuch/connection-middleware-mutation
Avoid mutating original response in connection management middleware
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/connection_management_test.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/activerecord/test/cases/connection_management_test.rb b/activerecord/test/cases/connection_management_test.rb index dff6ea0fb0..cf8c4c688a 100644 --- a/activerecord/test/cases/connection_management_test.rb +++ b/activerecord/test/cases/connection_management_test.rb @@ -94,6 +94,13 @@ module ActiveRecord assert response_body.respond_to?(:to_path) assert_equal response_body.to_path, "/path" end + + test "doesn't mutate the original response" do + original_response = [200, {}, 'hi'] + app = lambda { |_| original_response } + response_body = ConnectionManagement.new(app).call(@env)[2] + assert_equal original_response.last, 'hi' + end end end end |