Correct spy set up

This commit is contained in:
Blade Barringer 2015-05-10 22:13:53 -05:00
parent d4a296870b
commit a906c750eb

View file

@ -25,7 +25,7 @@ describe "Push-Notifications", ->
describe "Events that send push notifications", ->
pushSpy = sinon.spy()
pushSpy = { sendNotify: sinon.spy() }
context "Challenges", ->
@ -44,32 +44,31 @@ describe "Push-Notifications", ->
context "Gifts", ->
recipient = null
members = rewire("../../website/src/controllers/members")
members.__set__('pushNotify', pushSpy)
members.sendMessage = -> true
members.__set__('pushNotify', pushSpy)
before (done) ->
registerNewUser (err, _user) ->
recipient = _user
user.balance = 4
user.save = -> return true
recipient.save = -> return true
members.__set__ 'fetchMember', (id) -> return (cb) -> cb(null, recipient)
done()
, false
it "sends a push notification when gifted gems", (done) ->
req = {
req = {
params: { uuid: "uuid" },
body: {
body: {
type: 'gems',
gems: { amount: 1 }
}
}
}
res = { locals: { user: user } }
members.sendGift req, res
expect(pushSpy.calledOnce).to.be.ok
# @TODO Expectations
done()
it "sends a push notification when gifted a subscription"