module Spec::Rails::Example::ControllerExampleGroup::ControllerInstanceMethods

def integrate_views!

def integrate_views!
  @integrate_views = true
end

def integrate_views?

def integrate_views?
  @integrate_views
end

def matching_message_expectation_exists(options)

def matching_message_expectation_exists(options)
  render_proxy.__send__(:__mock_proxy).__send__(:find_matching_expectation, :render, options)
end

def matching_stub_exists(options)

def matching_stub_exists(options)
  render_proxy.__send__(:__mock_proxy).__send__(:find_matching_method_stub, :render, options)
end

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

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

=== render(options = nil, extra_options={}, &block)
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

def response(&block)

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