Module Spec::Rails::Example::RenderObserver

  1. lib/spec/rails/example/render_observer.rb

Extends the should_receive, should_not_receive and stub! methods in rspec’s mocking framework to handle render calls to controller in controller examples and template and view examples

Methods

public instance

  1. should_not_receive
  2. should_receive
  3. stub!

Public instance methods

should_not_receive (*args)
[show source]
# File lib/spec/rails/example/render_observer.rb, line 29
        def should_not_receive(*args)
          if args[0] == :render
            register_verify_after_each
            render_proxy.should_not_receive(:render)
          else
            super
          end
        end
should_receive (*args)
[show source]
# File lib/spec/rails/example/render_observer.rb, line 20
        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
stub! (*args)
[show source]
# File lib/spec/rails/example/render_observer.rb, line 38
        def stub!(*args)
          if args[0] == :render
            register_verify_after_each
            render_proxy.stub!(:render, :expected_from => caller(1)[0])
          else
            super
          end
        end