Class: Spec::Rails::Example::ViewExampleGroupController

Inherits:
ApplicationController
  • Object
show all
Includes:
RenderObserver
Defined in:
lib/spec/rails/example/view_example_group.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from RenderObserver

#register_verify_after_each, #render_proxy, #should_not_receive, #should_receive, #stub!, #unregister_verify_after_each, #verify_rendered, #verify_rendered_proc

Instance Attribute Details

#templateObject (readonly)

Returns the value of attribute template.



6
7
8
# File 'lib/spec/rails/example/view_example_group.rb', line 6

def template
  @template
end

Instance Method Details

#add_helper(name) ⇒ Object



12
13
14
15
16
17
18
19
20
21
# File 'lib/spec/rails/example/view_example_group.rb', line 12

def add_helper(name)
  begin
    helper_module = "#{name}_helper".camelize.constantize
  rescue
    return
  end
  (class << template; self; end).class_eval do
    include helper_module
  end
end

#add_helper_for(template_path) ⇒ Object



8
9
10
# File 'lib/spec/rails/example/view_example_group.rb', line 8

def add_helper_for(template_path)
  add_helper(template_path.split('/')[0])
end

#forget_variables_added_to_assignsObject



23
24
# File 'lib/spec/rails/example/view_example_group.rb', line 23

def forget_variables_added_to_assigns
end