Sha256: de9260d5adba295a110146776d1c88fe7600390193a5cce1f3b97c874a76c8c5

Contents?: true

Size: 789 Bytes

Versions: 1

Compression:

Stored size: 789 Bytes

Contents

require 'fozzie/rack/middleware'
require 'sinatra/base'
require 'rack/test'

describe "Sinatra Server with Middleware" do
  include Rack::Test::Methods

  def app
    Sinatra.new do
      set :environment, :test
      use Fozzie::Rack::Middleware
      get('/') { "echo" }
      get('/somewhere/nice') { "echo" }
    end
  end

  it "sends stats request on root" do
    S.should_receive(:timing).with('index.render', anything, anything)
    get '/'
    last_response.should be_ok
    last_response.body.should == 'echo'
  end

  it "sends stats request on nested path" do
    S.should_receive(:timing).with('somewhere.nice.render', anything, anything)

    get '/somewhere/nice'
    last_response.should be_ok
    last_response.body.should == 'echo'
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fozzie-1.0.3 spec/lib/fozzie/rack/sinatra_spec.rb