# File lib/action_view/test_case.rb, line 97
97: def config
98: @controller.config if @controller.respond_to?(:config)
99: end
# File lib/action_view/test_case.rb, line 107
107: def locals
108: @locals ||= {}
109: end
# File lib/action_view/test_case.rb, line 101
101: def render(options = {}, local_assigns = {}, &block)
102: view.assign(_assigns)
103: @rendered << output = view.render(options, local_assigns, &block)
104: output
105: end
# File lib/action_view/test_case.rb, line 86
86: def setup_with_controller
87: @controller = ActionView::TestCase::TestController.new
88: @request = @controller.request
89: @output_buffer = ActiveSupport::SafeBuffer.new
90: @rendered = ''
91:
92: self.class.send(:include_helper_modules!)
93: make_test_case_available_to_view!
94: say_no_to_protect_against_forgery!
95: end
# File lib/action_view/test_case.rb, line 187
187: def _assigns
188: _instance_variables.inject({}) do |hash, var|
189: name = var[1..1].to_sym
190: hash[name] = instance_variable_get(var)
191: hash
192: end
193: end
# File lib/action_view/test_case.rb, line 183
183: def _instance_variables
184: instance_variables.map(&:to_s) - EXCLUDE_IVARS
185: end
# File lib/action_view/test_case.rb, line 195
195: def _routes
196: @controller._routes if @controller.respond_to?(:_routes)
197: end
# File lib/action_view/test_case.rb, line 132
132: def make_test_case_available_to_view!
133: test_case_instance = self
134: _helpers.module_eval do
135: define_method(:_test_case) { test_case_instance }
136: private :_test_case
137: end
138: end
# File lib/action_view/test_case.rb, line 199
199: def method_missing(selector, *args)
200: if @controller.respond_to?(:_routes) &&
201: @controller._routes.named_routes.helpers.include?(selector)
202: @controller.__send__(selector, *args)
203: else
204: super
205: end
206: end
# File lib/action_view/test_case.rb, line 126
126: def protect_against_forgery?
127: false
128: end
Support the selector assertions
Need to experiment if this priority is the best one: rendered => output_buffer
# File lib/action_view/test_case.rb, line 120
120: def response_from_page_or_rjs
121: HTML::Document.new(@rendered.blank? ? @output_buffer : @rendered).root
122: end
# File lib/action_view/test_case.rb, line 124
124: def say_no_to_protect_against_forgery!
125: _helpers.module_eval do
126: def protect_against_forgery?
127: false
128: end
129: end
130: end
The instance of ActionView::Base that is used by render.
# File lib/action_view/test_case.rb, line 150
150: def view
151: @view ||= begin
152: view = ActionView::Base.new(ActionController::Base.view_paths, {}, @controller)
153: view.singleton_class.send :include, _helpers
154: view.singleton_class.send :include, @controller._routes.url_helpers
155: view.singleton_class.send :delegate, :alert, :notice, :to => "request.flash"
156: view.extend(Locals)
157: view.locals = self.locals
158: view.output_buffer = self.output_buffer
159: view
160: end
161: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.