Class Index [+]

Quicksearch

ActionView::TestCase::Behavior

Constants

INTERNAL_IVARS

Attributes

controller[RW]
output_buffer[RW]
rendered[RW]

Public Instance Methods

config() click to toggle source
     # File lib/action_view/test_case.rb, line 109
109:       def config
110:         @controller.config if @controller.respond_to?(:config)
111:       end
locals() click to toggle source
     # File lib/action_view/test_case.rb, line 119
119:       def locals
120:         @locals ||= {}
121:       end
render(options = {}, local_assigns = {}, &block) click to toggle source
     # File lib/action_view/test_case.rb, line 113
113:       def render(options = {}, local_assigns = {}, &block)
114:         view.assign(view_assigns)
115:         @rendered << output = view.render(options, local_assigns, &block)
116:         output
117:       end
setup_with_controller() click to toggle source
     # File lib/action_view/test_case.rb, line 99
 99:       def setup_with_controller
100:         @controller = ActionView::TestCase::TestController.new
101:         @request = @controller.request
102:         @output_buffer = ActiveSupport::SafeBuffer.new
103:         @rendered = ''
104: 
105:         make_test_case_available_to_view!
106:         say_no_to_protect_against_forgery!
107:       end

Private Instance Methods

_routes() click to toggle source
     # File lib/action_view/test_case.rb, line 226
226:       def _routes
227:         @controller._routes if @controller.respond_to?(:_routes)
228:       end
_user_defined_ivars() click to toggle source
     # File lib/action_view/test_case.rb, line 212
212:       def _user_defined_ivars
213:         instance_variables.map(&:to_s) - INTERNAL_IVARS
214:       end
_view() click to toggle source
Alias for: view
make_test_case_available_to_view!() click to toggle source
     # File lib/action_view/test_case.rb, line 145
145:       def make_test_case_available_to_view!
146:         test_case_instance = self
147:         _helpers.module_eval do
148:           unless private_method_defined?(:_test_case)
149:             define_method(:_test_case) { test_case_instance }
150:             private :_test_case
151:           end
152:         end
153:       end
method_missing(selector, *args) click to toggle source
     # File lib/action_view/test_case.rb, line 230
230:       def method_missing(selector, *args)
231:         if @controller.respond_to?(:_routes) &&
232:           ( @controller._routes.named_routes.helpers.include?(selector) ||
233:             @controller._routes.mounted_helpers.method_defined?(selector) )
234:           @controller.__send__(selector, *args)
235:         else
236:           super
237:         end
238:       end
protect_against_forgery?() click to toggle source
     # File lib/action_view/test_case.rb, line 139
139:           def protect_against_forgery?
140:             false
141:           end
response_from_page() click to toggle source

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 132
132:       def response_from_page
133:         HTML::Document.new(@rendered.blank? ? @output_buffer : @rendered).root
134:       end
say_no_to_protect_against_forgery!() click to toggle source
     # File lib/action_view/test_case.rb, line 136
136:       def say_no_to_protect_against_forgery!
137:         _helpers.module_eval do
138:           remove_possible_method :protect_against_forgery?
139:           def protect_against_forgery?
140:             false
141:           end
142:         end
143:       end
view() click to toggle source

The instance of ActionView::Base that is used by render.

     # File lib/action_view/test_case.rb, line 175
175:       def view
176:         @view ||= begin
177:           view = @controller.view_context
178:           view.singleton_class.send :include, _helpers
179:           view.extend(Locals)
180:           view.locals = self.locals
181:           view.output_buffer = self.output_buffer
182:           view
183:         end
184:       end
Also aliased as: _view
view_assigns() click to toggle source

Returns a Hash of instance variables and their values, as defined by the user in the test case, which are then assigned to the view being rendered. This is generally intended for internal use and extension frameworks.

     # File lib/action_view/test_case.rb, line 220
220:       def view_assigns
221:         Hash[_user_defined_ivars.map do |var|
222:           [var[1, var.length].to_sym, instance_variable_get(var)]
223:         end]
224:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.