Sha256: 3ab227b10723eb8dbf1a15dee686779904dd5fdd0c68f6e3123f6b7ecfdc660f
Contents?: true
Size: 873 Bytes
Versions: 9
Compression:
Stored size: 873 Bytes
Contents
require "spec_helper" require "scorpion/rack/middleware" describe Scorpion::Rack::Middleware do let(:app) { proc { [ 200, {}, [ "Sting!" ] ] } } let(:stack) { Scorpion::Rack::Middleware.new( app ) } let(:request) { Rack::MockRequest.new( stack ) } let(:response) { request.get("/") } it "creates a scorpion" do expect( stack ).to receive( :prepare_scorpion ).and_call_original response end it "prepares it with the environment" do proc = ->(env) { scorpion = env[Scorpion::Rack::Middleware::ENV_KEY] expect( scorpion.fetch( Scorpion::Rack::Env) ).to be env app.call( env ) } request = Rack::MockRequest.new( Scorpion::Rack::Middleware.new( proc ) ) request.get "/" end it "frees the scorpion on return" do expect( stack ).to receive( :free_scorpion ).and_call_original response end end
Version data entries
9 entries across 9 versions & 1 rubygems