Skip to content

Instantly share code, notes, and snippets.

@nolman
Created May 12, 2013 19:49
Show Gist options
  • Save nolman/5564680 to your computer and use it in GitHub Desktop.
Save nolman/5564680 to your computer and use it in GitHub Desktop.
require 'spec_helper'
require 'redis'
class SomeApi < Goliath::API
use Goliath::Rack::Params
def response(env)
[200, {}, '']
end
end
CALLED = false
Goliath::Request.log_block = proc do |env, response, elapsed_time|
redis = Redis.new(:driver => :synchrony)
redis.get('something')
CALLED = true
end
describe 'Logging' do
let(:err) { Proc.new { |c| fail "#{c.response}" } }
it 'calls the logging' do
with_api(SomeApi, :port => 9901) do
get_request({}, err) do |c|
end
end
CALLED.should be_true
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment