Sha256: f601774ed61067ed954dcdb99d85c5dacb0e9220eb670dd000c98cec6cab7bec

Contents?: true

Size: 1.07 KB

Versions: 1

Compression:

Stored size: 1.07 KB

Contents

require File.expand_path("#{File.dirname(__FILE__)}/../spec_helper")

module BangBang
  describe Controller do
    describe "GET /authentication/error-page" do
      def uris
        @uris ||= Authentication::Routes.instance
      end

      context "when there is not a rack.logger" do
        it "responds with a 500" do
          any_instance_of(Authentication::Controller) do |controller|
            stub.proxy(controller).env do |env|
              env.delete("rack.logger")
              env
            end
          end
          get uris.authentication_error_page

          response.status.should == 500
        end
      end

      context "when there is a rack.logger" do
        it "responds with a 500 and logs the message" do
          message = nil
          any_instance_of(Logger) do |l|
            stub(l).error(is_a(String)) do |*args|
              message = args.first
            end
          end
          get uris.authentication_error_page

          response.status.should == 500
          message.should include("An Error")
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bang-bang-0.2.1 spec/bang-bang/controller_spec.rb