Sha256: 6c4b729ae94ca6a578aebeec73462d391c3e274b6c4d10c897af0311444228a1
Contents?: true
Size: 956 Bytes
Versions: 1
Compression:
Stored size: 956 Bytes
Contents
require 'spec_helper' describe LazyResource::LogSubscriber do let(:event) do OpenStruct.new({ payload: { code: 200, time: 5, url: "http://google.com" } }) end describe '#request' do subject { LazyResource::LogSubscriber.new } before do LazyResource::LogSubscriber.attach_to(:lazy_resource) subject.stub(:info) do |message| message end end it 'logs the request using the info level' do subject.should_receive(:info).with(any_args) subject.request(event) end it 'includes the response code' do subject.request(event).should =~ /200/ end it 'includes the response time' do subject.request(event).should =~ /5000ms/ end it 'includes the request url' do subject.request(event).should =~ /http:\/\/google\.com/ end after do ActiveSupport::LogSubscriber.log_subscribers.clear end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
lazy_resource-0.5.0 | spec/lazy_resource/log_subscriber_spec.rb |