-
-
Save cmar/6081925 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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