Module: Spec::Rails::Example::ControllerExampleGroup::ControllerInstanceMethods

Includes:
RenderObserver
Defined in:
lib/spec/rails/example/controller_example_group.rb

Overview

:nodoc:

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 Method Details

#integrate_views!Object



217
218
219
# File 'lib/spec/rails/example/controller_example_group.rb', line 217

def integrate_views!
  @integrate_views = true
end

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

render(options = nil, extra_options={}, &block)

This gets added to the controller’s singleton meta class, allowing Controller Examples to run in two modes, freely switching from example group to example group.



192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
# File 'lib/spec/rails/example/controller_example_group.rb', line 192

def render(options=nil, extra_options={}, &block)
  unless block_given?
    unless integrate_views?
      @template.extend TemplateIsolationExtensions
    end
  end

  if matching_message_expectation_exists(options)
    render_proxy.render(options, &block)
    @performed_render = true
  else
    if matching_stub_exists(options)
      @performed_render = true
    else
      super
    end
  end
end

#response(&block) ⇒ Object



211
212
213
214
215
# File 'lib/spec/rails/example/controller_example_group.rb', line 211

def response(&block)
  # NOTE - we're setting @update for the assert_select_spec - kinda weird, huh?
  @update = block
  @_response || @response
end