module Spec::Rails::Example::RenderObserver

def expect_render(opts={})

Use should_receive(:render).with(opts) instead

DEPRECATED
def expect_render(opts={})
  warn_deprecation("expect_render", "should_receive")
  register_verify_after_each
  render_proxy.should_receive(:render, :expected_from => caller(1)[0]).with(opts)
end

def register_verify_after_each #:nodoc:

:nodoc:
def register_verify_after_each #:nodoc:
  proc = verify_rendered_proc
  Spec::Example::ExampleGroup.after(:each, &proc)
end

def render_proxy #:nodoc:

:nodoc:
def render_proxy #:nodoc:
  @render_proxy ||= Spec::Mocks::Mock.new("render_proxy")
end

def should_not_receive(*args)

def should_not_receive(*args)
  if args[0] == :render
    register_verify_after_each
    render_proxy.should_not_receive(:render)
  else
    super
  end
end

def should_receive(*args)

def should_receive(*args)
  if args[0] == :render
    register_verify_after_each
    render_proxy.should_receive(:render, :expected_from => caller(1)[0])
  else
    super
  end
end

def stub!(*args)

def stub!(*args)
  if args[0] == :render
    register_verify_after_each
    render_proxy.stub!(:render, :expected_from => caller(1)[0])
  else
    super
  end
end

def stub_render(opts={})

Use stub!(:render).with(opts) instead

DEPRECATED
def stub_render(opts={})
  warn_deprecation("stub_render", "stub!")
  register_verify_after_each
  render_proxy.stub!(:render, :expected_from => caller(1)[0]).with(opts)
end

def unregister_verify_after_each #:nodoc:

:nodoc:
def unregister_verify_after_each #:nodoc:
  proc = verify_rendered_proc
  Spec::Example::ExampleGroup.remove_after(:each, &proc)
end

def verify_rendered # :nodoc:

:nodoc:
def verify_rendered # :nodoc:
  render_proxy.rspec_verify
end

def verify_rendered_proc #:nodoc:

:nodoc:
def verify_rendered_proc #:nodoc:
  template = self
  @verify_rendered_proc ||= Proc.new do
    template.verify_rendered
    template.unregister_verify_after_each
  end
end

def warn_deprecation(deprecated_method, new_method)

def warn_deprecation(deprecated_method, new_method)
  Kernel.warn <<-WARNING
ated_method} is deprecated and will be removed from a future version of rspec-rails.
ust use object.#{new_method} instead.
end