Sha256: 46238166b929570c8cfaf4af6888194eda55acdcabc43e89b10d117e9bc3136b

Contents?: true

Size: 759 Bytes

Versions: 3

Compression:

Stored size: 759 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

3 entries across 3 versions & 1 rubygems

Version Path
fozzie-1.0.2 spec/lib/fozzie/rack/sinatra_spec.rb
fozzie-1.0.1 spec/lib/fozzie/rack/sinatra_spec.rb
fozzie-1.0.0 spec/lib/fozzie/rack/sinatra_spec.rb