Module: ActionView::TestCase::Behavior

Defined Under Namespace

Modules: ClassMethods, Locals

Constant Summary

Constants included from Helpers::TagHelper

Helpers::TagHelper::BOOLEAN_ATTRIBUTES

Constants included from Helpers::ScriptaculousHelper

Helpers::ScriptaculousHelper::TOGGLE_EFFECTS

Constants included from ActionController::RecordIdentifier

ActionController::RecordIdentifier::JOIN, ActionController::RecordIdentifier::NEW

Constants included from Helpers::PrototypeHelper

Helpers::PrototypeHelper::AJAX_OPTIONS, Helpers::PrototypeHelper::CALLBACKS

Constants included from Helpers::NumberHelper

Helpers::NumberHelper::DECIMAL_UNITS, Helpers::NumberHelper::DEFAULT_CURRENCY_VALUES, Helpers::NumberHelper::STORAGE_UNITS

Constants included from Helpers::JavaScriptHelper

Helpers::JavaScriptHelper::JS_ESCAPE_MAP

Constants included from ActionDispatch::Assertions

ActionDispatch::Assertions::NO_STRIP

Instance Attribute Summary collapse

Attributes included from AbstractController::Rendering

#view_context_class

Instance Method Summary collapse

Methods included from Helpers::UrlHelper

#button_to, #current_page?, #link_to, #link_to_if, #link_to_unless, #link_to_unless_current, #mail_to, #url_for, #url_options

Methods included from Helpers::TagHelper

#cdata_section, #content_tag, #escape_once, #tag

Methods included from Helpers::CaptureHelper

#capture, #content_for, #content_for?, #flush_output_buffer, #with_output_buffer

Methods included from ActionDispatch::Routing::UrlFor

#url_for, #url_options

Methods included from ActionDispatch::Routing::PolymorphicRoutes

#polymorphic_path, #polymorphic_url

Methods included from Helpers::TranslationHelper

#localize, #translate

Methods included from Helpers::TextHelper

#auto_link, #concat, #current_cycle, #cycle, #excerpt, #highlight, #pluralize, #reset_cycle, #safe_concat, #simple_format, #truncate, #word_wrap

Methods included from Helpers::SanitizeHelper

#sanitize, #sanitize_css, #strip_links, #strip_tags

Methods included from Helpers::ScriptaculousHelper

#draggable_element, #draggable_element_js, #drop_receiving_element, #drop_receiving_element_js, #sortable_element, #sortable_element_js, #visual_effect

Methods included from Helpers::RecordTagHelper

#content_tag_for, #div_for

Methods included from ActionController::RecordIdentifier

#dom_class, #dom_id

Methods included from Helpers::RawOutputHelper

#raw

Methods included from Helpers::PrototypeHelper

#remote_function, #update_page, #update_page_tag

Methods included from Helpers::NumberHelper

#number_to_currency, #number_to_human, #number_to_human_size, #number_to_percentage, #number_to_phone, #number_with_delimiter, #number_with_precision

Methods included from Helpers::JavaScriptHelper

#button_to_function, #escape_javascript, #javascript_cdata_section, #javascript_tag, #link_to_function

Methods included from Helpers::FormTagHelper

#check_box_tag, #email_field_tag, #field_set_tag, #file_field_tag, #form_tag, #hidden_field_tag, #image_submit_tag, #label_tag, #number_field_tag, #password_field_tag, #radio_button_tag, #range_field_tag, #search_field_tag, #select_tag, #submit_tag, #telephone_field_tag, #text_area_tag, #text_field_tag, #url_field_tag

Methods included from Helpers::FormOptionsHelper

#collection_select, #grouped_collection_select, #grouped_options_for_select, #option_groups_from_collection_for_select, #options_for_select, #options_from_collection_for_select, #select, #time_zone_options_for_select, #time_zone_select

Methods included from Helpers::FormHelper

#apply_form_for_options!, #check_box, #email_field, #fields_for, #file_field, #form_for, #hidden_field, #label, #number_field, #password_field, #radio_button, #range_field, #search_field, #telephone_field, #text_area, #text_field, #url_field

Methods included from Helpers::DebugHelper

#debug

Methods included from Helpers::DateHelper

#date_select, #datetime_select, #distance_of_time_in_words, #select_date, #select_datetime, #select_day, #select_hour, #select_minute, #select_month, #select_second, #select_time, #select_year, #time_ago_in_words, #time_select

Methods included from Helpers::CsrfHelper

#csrf_meta_tag

Methods included from Helpers::CacheHelper

#cache

Methods included from Helpers::AtomFeedHelper

#atom_feed

Methods included from Helpers::AssetTagHelper

#audio_path, #audio_tag, #auto_discovery_link_tag, #favicon_link_tag, #image_path, #image_tag, #javascript_include_tag, #javascript_path, register_javascript_expansion, register_javascript_include_default, register_stylesheet_expansion, reset_javascript_include_default, #stylesheet_link_tag, #stylesheet_path, #video_path, #video_tag

Methods included from AbstractController::Rendering

#_prefix, #_render_template, #initialize, #process, #render_to_body, #render_to_string, #view_context

Methods included from AbstractController::ViewPaths

#append_view_path, #details_for_lookup, #lookup_context, #prepend_view_path

Methods included from Context

#convert_to_model

Methods included from ActionController::TemplateAssertions

#assert_template, #process, #setup_subscriptions, #teardown_subscriptions

Methods included from ActionDispatch::TestProcess

#assigns, #cookies, #fixture_file_upload, #flash, #redirect_to_url, #session

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(selector, *args) ⇒ Object (private)



215
216
217
218
219
220
221
222
# File 'lib/action_view/test_case.rb', line 215

def method_missing(selector, *args)
  if @controller.respond_to?(:_routes) &&
  @controller._routes.named_routes.helpers.include?(selector)
    @controller.__send__(selector, *args)
  else
    super
  end
end

Instance Attribute Details

#controllerObject

Returns the value of attribute controller.



46
47
48
# File 'lib/action_view/test_case.rb', line 46

def controller
  @controller
end

#output_bufferObject

Returns the value of attribute output_buffer.



46
47
48
# File 'lib/action_view/test_case.rb', line 46

def output_buffer
  @output_buffer
end

#renderedObject

Returns the value of attribute rendered.



46
47
48
# File 'lib/action_view/test_case.rb', line 46

def rendered
  @rendered
end

Instance Method Details

#configObject



101
102
103
# File 'lib/action_view/test_case.rb', line 101

def config
  @controller.config if @controller.respond_to?(:config)
end

#localsObject



111
112
113
# File 'lib/action_view/test_case.rb', line 111

def locals
  @locals ||= {}
end

#render(options = {}, local_assigns = {}, &block) ⇒ Object



105
106
107
108
109
# File 'lib/action_view/test_case.rb', line 105

def render(options = {}, local_assigns = {}, &block)
  view.assign(view_assigns)
  @rendered << output = view.render(options, local_assigns, &block)
  output
end

#setup_with_controllerObject



91
92
93
94
95
96
97
98
99
# File 'lib/action_view/test_case.rb', line 91

def setup_with_controller
  @controller = ActionView::TestCase::TestController.new
  @request = @controller.request
  @output_buffer = ActiveSupport::SafeBuffer.new
  @rendered = ''

  make_test_case_available_to_view!
  say_no_to_protect_against_forgery!
end