Privatize unneededly protected methods in Action Pack tests

This commit is contained in:
Akira Matsuda 2016-12-23 23:40:07 +09:00
parent 1f5bed9855
commit f2dfd5c6fd
10 changed files with 20 additions and 22 deletions

@ -55,7 +55,7 @@ class TestMultipleFiltersController < ActionController::Base
end
end
protected
private
(1..3).each do |i|
define_method "try_#{i}" do
instance_variable_set :@try, i
@ -296,7 +296,7 @@ def change_password
render inline: "ran action"
end
protected
private
def find_user
@ran_filter ||= []
@ran_filter << "find_user"
@ -428,7 +428,7 @@ def bar
render plain: "bar"
end
protected
private
def first
@first = true
end
@ -1040,7 +1040,7 @@ def test_last_action_in_multiple_before_action_chain_halts
assert_equal 3, controller.instance_variable_get(:@try)
end
protected
private
def test_process(controller, action = "show")
@controller = controller.is_a?(Class) ? controller.new : controller
process(action)

@ -40,7 +40,7 @@ def index
respond_to(:html, :iphone, :js)
end
protected
private
def with_iphone
request.format = "iphone" if request.env["HTTP_ACCEPT"] == "text/iphone"

@ -273,7 +273,7 @@ def format_any_variant_any
end
end
protected
private
def set_layout
case action_name
when "all_types_with_layout", "iphone_with_html_response_type"

@ -25,7 +25,7 @@ def show_actions
render body: "actions: #{action_methods.to_a.sort.join(', ')}"
end
protected
private
def authenticate
end
end

@ -26,16 +26,14 @@ def with_layout
render action: "hello_world", layout: "basic"
end
protected
protected def __controller_method__
"controller context!"
end
# 3) Set view_context to self
def view_context
self
end
def __controller_method__
"controller context!"
end
# 3) Set view_context to self
private def view_context
self
end
end
class RenderContextTest < Rack::TestCase

@ -123,7 +123,7 @@ def redirect_with_null_bytes
def rescue_errors(e) raise e end
protected
private
def dashbord_url(id, message)
url_for action: "dashboard", params: { "id" => id, "message" => message }
end

@ -92,7 +92,7 @@ def index
render inline: "OK"
end
protected
private
def add_called_callback(name)
@called_callbacks ||= []

@ -149,7 +149,7 @@ def exception_with_no_handler_for_wrapper
raise RangeError
end
protected
private
def deny_access
head :forbidden
end
@ -327,7 +327,7 @@ def b00m
raise "b00m"
end
protected
private
def show_errors(exception)
render plain: exception.message
end

@ -1089,7 +1089,7 @@ def test_singleton_resource_name_is_not_singularized
end
end
protected
private
def with_restful_routing(*args)
options = args.extract_options!
collection_methods = options.delete(:collection)

@ -18,7 +18,7 @@ def url_for(options = {})
ActionDispatch::Http::URL.url_for(options)
end
protected
private
def stub_request(env = {})
ip_spoofing_check = env.key?(:ip_spoofing_check) ? env.delete(:ip_spoofing_check) : true
@trusted_proxies ||= nil