Skip to content

Instantly share code, notes, and snippets.

@uglyog
Created May 16, 2014 01:13
Show Gist options
  • Save uglyog/9eac3eeac0069e1c3527 to your computer and use it in GitHub Desktop.
Save uglyog/9eac3eeac0069e1c3527 to your computer and use it in GitHub Desktop.
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