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



222
223
224
# File 'lib/spec/rails/example/controller_example_group.rb', line 222

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.



197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
# File 'lib/spec/rails/example/controller_example_group.rb', line 197

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



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

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