1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

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

View file

@ -55,7 +55,7 @@ class FilterTest < ActionController::TestCase
end
end
protected
private
(1..3).each do |i|
define_method "try_#{i}" do
instance_variable_set :@try, i
@ -296,7 +296,7 @@ class FilterTest < ActionController::TestCase
render inline: "ran action"
end
protected
private
def find_user
@ran_filter ||= []
@ran_filter << "find_user"
@ -428,7 +428,7 @@ class FilterTest < ActionController::TestCase
render plain: "bar"
end
protected
private
def first
@first = true
end
@ -1040,7 +1040,7 @@ class YieldingAroundFiltersTest < ActionController::TestCase
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)

View file

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

View file

@ -273,7 +273,7 @@ class RespondToController < ActionController::Base
end
end
protected
private
def set_layout
case action_name
when "all_types_with_layout", "iphone_with_html_response_type"

View file

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

View file

@ -26,16 +26,14 @@ module RenderContext
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

View file

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

View file

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

View file

@ -149,7 +149,7 @@ class RescueController < ActionController::Base
raise RangeError
end
protected
private
def deny_access
head :forbidden
end
@ -327,7 +327,7 @@ class RescueTest < ActionDispatch::IntegrationTest
raise "b00m"
end
protected
private
def show_errors(exception)
render plain: exception.message
end

View file

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

View file

@ -18,7 +18,7 @@ class BaseRequestTest < ActiveSupport::TestCase
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