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 101
101:       def config
102:         @controller.config if @controller.respond_to?(:config)
103:       end
locals() click to toggle source
     # File lib/action_view/test_case.rb, line 111
111:       def locals
112:         @locals ||= {}
113:       end
render(options = {}, local_assigns = {}, &block) click to toggle source
     # File lib/action_view/test_case.rb, line 105
105:       def render(options = {}, local_assigns = {}, &block)
106:         view.assign(view_assigns)
107:         @rendered << output = view.render(options, local_assigns, &block)
108:         output
109:       end
setup_with_controller() click to toggle source
    # File lib/action_view/test_case.rb, line 91
91:       def setup_with_controller
92:         @controller = ActionView::TestCase::TestController.new
93:         @request = @controller.request
94:         @output_buffer = ActiveSupport::SafeBuffer.new
95:         @rendered = ''
96: 
97:         make_test_case_available_to_view!
98:         say_no_to_protect_against_forgery!
99:       end

Private Instance Methods

_assigns() click to toggle source
     # File lib/action_view/test_case.rb, line 205
205:       def _assigns
206:         ActiveSupport::Deprecation.warn "ActionView::TestCase#_assigns is deprecated and will be removed in future versions. " <<
207:           "Please use view_assigns instead."
208:         view_assigns
209:       end
_routes() click to toggle source
     # File lib/action_view/test_case.rb, line 211
211:       def _routes
212:         @controller._routes if @controller.respond_to?(:_routes)
213:       end
_user_defined_ivars() click to toggle source
     # File lib/action_view/test_case.rb, line 191
191:       def _user_defined_ivars
192:         instance_variables.map(&:to_s) - INTERNAL_IVARS
193:       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 136
136:       def make_test_case_available_to_view!
137:         test_case_instance = self
138:         _helpers.module_eval do
139:           define_method(:_test_case) { test_case_instance }
140:           private :_test_case
141:         end
142:       end
method_missing(selector, *args) click to toggle source
     # File lib/action_view/test_case.rb, line 215
215:       def method_missing(selector, *args)
216:         if @controller.respond_to?(:_routes) &&
217:         @controller._routes.named_routes.helpers.include?(selector)
218:           @controller.__send__(selector, *args)
219:         else
220:           super
221:         end
222:       end
protect_against_forgery?() click to toggle source
     # File lib/action_view/test_case.rb, line 130
130:           def protect_against_forgery?
131:             false
132:           end
response_from_page_or_rjs() 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 124
124:       def response_from_page_or_rjs
125:         HTML::Document.new(@rendered.blank? ? @output_buffer : @rendered).root
126:       end
say_no_to_protect_against_forgery!() click to toggle source
     # File lib/action_view/test_case.rb, line 128
128:       def say_no_to_protect_against_forgery!
129:         _helpers.module_eval do
130:           def protect_against_forgery?
131:             false
132:           end
133:         end
134:       end
view() click to toggle source

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

     # File lib/action_view/test_case.rb, line 154
154:       def view
155:         @view ||= begin
156:                      view = ActionView::Base.new(ActionController::Base.view_paths, {}, @controller)
157:                      view.singleton_class.send :include, _helpers
158:                      view.singleton_class.send :include, @controller._routes.url_helpers
159:                      view.singleton_class.send :delegate, :alert, :notice, :to => "request.flash"
160:                      view.extend(Locals)
161:                      view.locals = self.locals
162:                      view.output_buffer = self.output_buffer
163:                      view
164:                    end
165:       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 199
199:       def view_assigns
200:         Hash[_user_defined_ivars.map do |var|
201:           [var[1..1].to_sym, instance_variable_get(var)]
202:         end]
203:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.