Sha256: 5fc170819093758e8aa4cd2465088f55f715b2b8329230a1cfb0031986ccab56
Contents?: true
Size: 979 Bytes
Versions: 17
Compression:
Stored size: 979 Bytes
Contents
require "spec_helper" require "shamu/rack" module QueryParamsMiddlewareSpec class App include Scorpion::Rack attr_accessor :next def call( env ) @next ||= proc { [ 200, {}, [ "Sting!" ] ] } @next.call( env, self ) end end end describe Shamu::Rack::QueryParamsMiddleware do let(:app) { QueryParamsMiddlewareSpec::App.new } let(:scorpion_middleware) { Scorpion::Rack::Middleware.new( query_parmas_middleware ) } let(:query_parmas_middleware) { Shamu::Rack::QueryParamsMiddleware.new( app ) } let(:request) { Rack::MockRequest.new( scorpion_middleware ) } let(:response) { request.get( "/" ) } it "prepares it with the environment" do app.next = proc do |env, app| query_parmas = app.send( :scorpion, env ).fetch Shamu::Rack::QueryParams expect( query_parmas ).to be_a Shamu::Rack::QueryParams [ 200, {}, [ "Yum!" ] ] end request.get "/" end end
Version data entries
17 entries across 17 versions & 1 rubygems