Skip to content

Instantly share code, notes, and snippets.

@cmar
Created July 25, 2013 17:25
Show Gist options
  • Save cmar/6081925 to your computer and use it in GitHub Desktop.
Save cmar/6081925 to your computer and use it in GitHub Desktop.
it 'subscribes new users to a mailing list' do
@usps.should_receive(:picked_up?).with('EJ958083578US').and_return(true)
post '/pickup_check', message.to_json, auth
last_response.status.should == 200
json = JSON.parse last_response.body
json['message_id'].should eq 'abc'
json['messages'].first['message'].should eq 'shipment:dispatch'
json['messages'].first['payload']['shipment_number'].should eq 'H12345678901'
json['messages'][1]['payload']['subject'].should eq 'Shipment H12345678901 has been picked up'
end
it 'returns a 200 with a delay retry' do
@usps.should_receive(:picked_up?).with('EJ958083578US').and_return(false)
post '/pickup_check', message.to_json, auth
last_response.status.should == 200
json = JSON.parse last_response.body
json['message_id'].should eq 'abc'
json['delay'].should eq 3600
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment