Module: FocusedController::TestHelper
- Extended by:
- ActiveSupport::Concern
- Includes:
- ActionDispatch::Assertions::ResponseAssertions
- Defined in:
- lib/focused_controller/test_helper.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, &block) ⇒ Object
121
122
123
124
125
126
127
|
# File 'lib/focused_controller/test_helper.rb', line 121
def method_missing(method_name, *args, &block)
if !_routes_included? && respond_to?(method_name)
send(method_name, *args, &block)
else
super
end
end
|
Instance Method Details
#_routes_included? ⇒ Boolean
108
109
110
|
# File 'lib/focused_controller/test_helper.rb', line 108
def _routes_included?
defined?(@_routes_included) && @_routes_included
end
|
#assert_redirected_to(location, message = nil) ⇒ Object
99
100
101
102
|
# File 'lib/focused_controller/test_helper.rb', line 99
def assert_redirected_to(location, message = nil)
controller super
end
|
#assert_response(type, message = nil) ⇒ Object
94
95
96
97
|
# File 'lib/focused_controller/test_helper.rb', line 94
def assert_response(type, message = nil)
controller super
end
|
#assert_template(template, message = nil) ⇒ Object
90
91
92
|
# File 'lib/focused_controller/test_helper.rb', line 90
def assert_template(template, message = nil)
assert_equal template.to_s, controller._render_options[:template], message
end
|
#controller ⇒ Object
60
61
62
63
64
65
66
67
68
|
# File 'lib/focused_controller/test_helper.rb', line 60
def controller
@controller ||= begin
controller = self.class.controller_class.new
controller.singleton_class.send :include, TestHooks
controller.request = request
controller.response = response
controller
end
end
|
#cookies ⇒ Object
86
87
88
|
# File 'lib/focused_controller/test_helper.rb', line 86
def cookies
request.cookie_jar
end
|
#flash ⇒ Object
82
83
84
|
# File 'lib/focused_controller/test_helper.rb', line 82
def flash
controller.flash
end
|
#optimize_routes_generation? ⇒ Boolean
129
130
131
|
# File 'lib/focused_controller/test_helper.rb', line 129
def optimize_routes_generation?(*)
false
end
|
#request ⇒ Object
70
71
72
|
# File 'lib/focused_controller/test_helper.rb', line 70
def request
@request ||= TestRequest.new
end
|
#respond_to?(*args) ⇒ Boolean
112
113
114
115
116
117
118
119
|
# File 'lib/focused_controller/test_helper.rb', line 112
def respond_to?(*args)
unless _routes_included?
self.class.include_routes
@_routes_included = true
end
super
end
|
#response ⇒ Object
74
75
76
|
# File 'lib/focused_controller/test_helper.rb', line 74
def response
@response ||= TestResponse.new
end
|
#session ⇒ Object
78
79
80
|
# File 'lib/focused_controller/test_helper.rb', line 78
def session
controller.session
end
|
#url_for(*args) ⇒ Object
104
105
106
|
# File 'lib/focused_controller/test_helper.rb', line 104
def url_for(*args)
controller.url_for(*args)
end
|