Skip to content

Commit

Permalink
update Rails::Railtie::Configuration and ActionDispatch::Response#res…
Browse files Browse the repository at this point in the history
…pond_to? to accept include_private argument
  • Loading branch information
jonkessler committed Aug 16, 2013
1 parent 5c6e11d commit ba5fab4
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion actionpack/lib/action_dispatch/http/response.rb
Expand Up @@ -181,7 +181,7 @@ def message
end
alias_method :status_message, :message

def respond_to?(method)
def respond_to?(method, include_private = false)
if method.to_s == 'to_path'
stream.respond_to?(:to_path)
else
Expand Down
5 changes: 5 additions & 0 deletions actionpack/test/dispatch/response_test.rb
Expand Up @@ -212,6 +212,11 @@ def test_response_body_encoding
ActionDispatch::Response.default_headers = nil
end
end

test "respond_to? accepts include_private" do
assert_not @response.respond_to?(:method_missing)
assert @response.respond_to?(:method_missing, true)
end
end

class ResponseIntegrationTest < ActionDispatch::IntegrationTest
Expand Down
2 changes: 1 addition & 1 deletion railties/lib/rails/railtie/configuration.rb
Expand Up @@ -80,7 +80,7 @@ def to_prepare(&blk)
to_prepare_blocks << blk if blk
end

def respond_to?(name)
def respond_to?(name, include_private = false)
super || @@options.key?(name.to_sym)
end

Expand Down
7 changes: 7 additions & 0 deletions railties/test/application/configuration_test.rb
Expand Up @@ -679,5 +679,12 @@ def index
end
assert_equal Logger::INFO, Rails.logger.level
end

test "respond_to? accepts include_private" do
make_basic_app

assert_not Rails.configuration.respond_to?(:method_missing)
assert Rails.configuration.respond_to?(:method_missing, true)
end
end
end

1 comment on commit ba5fab4

@jaredbeck
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jonkessler any plans to backport this to 4-0-stable?

Without this fix, rails 4.0.6.rc3 is incompatible with, e.g. rspec-mocks 3.0.2. See #15896

Please sign in to comment.