Created
May 16, 2014 01:13
-
-
Save uglyog/9eac3eeac0069e1c3527 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'pact_helper' | |
require_relative '../lib/client' | |
require_relative '../lib/event' | |
describe SourceSystemClient, :pact => true do | |
let!(:now) { Time.now } | |
before do | |
subject.class.base_uri 'http://localhost:1234' | |
subject.hmac_secret = '01234567890' | |
Time.stub(:now).and_return(now) | |
end | |
describe 'posting an event to the event service' do | |
let(:event) { Event.new } | |
let(:event_json) { event.to_hash } | |
before do | |
event_api.upon_receiving('A POST request with an event'). | |
with(method: :post, path: '/events', headers: subject.hmac_headers(JSON.generate(event_json)), body: event_json). | |
will_respond_with(status: 201) | |
end | |
it 'is successful' do | |
expect(subject.save_event(event)).to be_true | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment