Sha256: 8a34df578eb094e6ce4f0c7fb15624e2ef8c65b33c48b94c971e73d43aef4564

Contents?: true

Size: 780 Bytes

Versions: 1

Compression:

Stored size: 780 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, 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, 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.1.0 spec/lib/fozzie/rack/sinatra_spec.rb