Module: Spec::Rails::Example::ControllerExampleGroup::TemplateIsolationExtensions

Defined in:
lib/vendor/plugins/rspec-rails/lib/spec/rails/example/controller_example_group.rb

Defined Under Namespace

Classes: PickedTemplate

Instance Method Summary collapse

Instance Method Details

#__action_exists?(params) ⇒ Boolean

Returns:

  • (Boolean)


168
169
170
# File 'lib/vendor/plugins/rspec-rails/lib/spec/rails/example/controller_example_group.rb', line 168

def __action_exists?(params)
  controller.respond_to? params[:action]
end

#_pick_template(*args) ⇒ Object

Rails 2.2



163
164
165
166
# File 'lib/vendor/plugins/rspec-rails/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

Returns:

  • (Boolean)


156
# File 'lib/vendor/plugins/rspec-rails/lib/spec/rails/example/controller_example_group.rb', line 156

def file_exists?(ignore); true; end

#render(*args) ⇒ Object



172
173
174
175
176
177
178
179
180
181
182
183
184
185
# File 'lib/vendor/plugins/rspec-rails/lib/spec/rails/example/controller_example_group.rb', line 172

def render(*args)
  if ::Rails::VERSION::STRING >= "2.1"
    return super unless __action_exists?(params) 
  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/vendor/plugins/rspec-rails/lib/spec/rails/example/controller_example_group.rb', line 158

def render_file(*args)
  @first_render ||= args[0] unless args[0] =~ /^layouts/
end