Last active
January 13, 2017 21:34
-
-
Save mitchlloyd/15980bc78fbccae76f421f6e9c6e9c78 to your computer and use it in GitHub Desktop.
Revisions
-
mitchlloyd revised this gist
Jan 13, 2017 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -18,6 +18,8 @@ export default Service.extend({ return new RSVP.Promise((resolve, reject) => { resolve({ result: { // Here we use stubbed data, but you may consider passing this information // into the fake to handle more test cases. token: { id: 'fake-token-id' }, shippingContact 'Fake Shipping Contact' }, -
mitchlloyd created this gist
Jan 13, 2017 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,35 @@ import Ember from 'ember'; const { Service, RSVP } = Ember; export default Service.extend({ init() { this._super(...arguments); // We record both the charges sent and notifications sent to verify in // our tests. this.chargesSent = []; this.notificationsSent = []; }, charge(payment) { this.chargesSent.push(payment); let notificationsSent = this.notificationsSent; return new RSVP.Promise((resolve, reject) => { resolve({ result: { token: { id: 'fake-token-id' }, shippingContact 'Fake Shipping Contact' }, notify: { success() { notificationsSent.push('success') }, failure() { notificationsSent.push('failure') } } }) }); } });