Module: Spec::Rails::Example::ControllerExampleGroup::TemplateIsolationExtensions
- Defined in:
- lib/spec/rails/example/controller_example_group.rb
Defined Under Namespace
Classes: PickedTemplate
Instance Method Summary collapse
- #__action_exists?(params) ⇒ Boolean
- #__template_exists?(args) ⇒ Boolean
-
#_pick_template(*args) ⇒ Object
Rails 2.2.
- #file_exists?(ignore) ⇒ Boolean
- #render(*args) ⇒ Object
- #render_file(*args) ⇒ Object
Instance Method Details
#__action_exists?(params) ⇒ Boolean
168 169 170 |
# File 'lib/spec/rails/example/controller_example_group.rb', line 168 def __action_exists?(params) controller.respond_to? params[:action] end |
#__template_exists?(args) ⇒ Boolean
172 173 174 175 176 |
# File 'lib/spec/rails/example/controller_example_group.rb', line 172 def __template_exists?(args) self.view_paths.respond_to?(:find_template) ? self.view_paths.find_template(args[0][:file], template_format) : false end |
#_pick_template(*args) ⇒ Object
Rails 2.2
163 164 165 166 |
# File 'lib/spec/rails/example/controller_example_group.rb', line 163 def _pick_template(*args) @_first_render ||= args[0] unless args[0] =~ /^layouts/ PickedTemplate.new end |
#file_exists?(ignore) ⇒ Boolean
156 |
# File 'lib/spec/rails/example/controller_example_group.rb', line 156 def file_exists?(ignore); true; end |
#render(*args) ⇒ Object
178 179 180 181 182 183 184 185 186 187 188 189 190 191 |
# File 'lib/spec/rails/example/controller_example_group.rb', line 178 def render(*args) if ::Rails::VERSION::STRING >= "2.1" return super unless __action_exists?(params) || __template_exists?(args) end if file = args.last[:file].instance_eval{@template_path} record_render :file => file elsif args.last[:inline] super elsif @_rendered record_render(args[0]) else super end end |
#render_file(*args) ⇒ Object
158 159 160 |
# File 'lib/spec/rails/example/controller_example_group.rb', line 158 def render_file(*args) @first_render ||= args[0] unless args[0] =~ /^layouts/ end |