|
@@ -42,10 +42,6 @@ describe "SubscriptionController", ->
|
|
|
userHasSubscriptionOrIsGroupMember: sinon.stub()
|
|
userHasSubscriptionOrIsGroupMember: sinon.stub()
|
|
|
userHasSubscription : sinon.stub()
|
|
userHasSubscription : sinon.stub()
|
|
|
|
|
|
|
|
- @RecurlyWrapper =
|
|
|
|
|
- sign: sinon.stub().callsArgWith(1, null, "somthing")
|
|
|
|
|
- getSubscription: sinon.stub().callsArgWith(2, null, {})
|
|
|
|
|
-
|
|
|
|
|
@SubscriptionViewModelBuilder =
|
|
@SubscriptionViewModelBuilder =
|
|
|
buildUsersSubscriptionViewModel:sinon.stub().callsArgWith(1, null, @activeRecurlySubscription)
|
|
buildUsersSubscriptionViewModel:sinon.stub().callsArgWith(1, null, @activeRecurlySubscription)
|
|
|
buildViewModel: sinon.stub()
|
|
buildViewModel: sinon.stub()
|
|
@@ -72,7 +68,6 @@ describe "SubscriptionController", ->
|
|
|
'./SubscriptionViewModelBuilder': @SubscriptionViewModelBuilder
|
|
'./SubscriptionViewModelBuilder': @SubscriptionViewModelBuilder
|
|
|
"./LimitationsManager": @LimitationsManager
|
|
"./LimitationsManager": @LimitationsManager
|
|
|
"../../infrastructure/GeoIpLookup":@GeoIpLookup
|
|
"../../infrastructure/GeoIpLookup":@GeoIpLookup
|
|
|
- './RecurlyWrapper': @RecurlyWrapper
|
|
|
|
|
"logger-sharelatex":
|
|
"logger-sharelatex":
|
|
|
log:->
|
|
log:->
|
|
|
warn:->
|
|
warn:->
|
|
@@ -182,7 +177,7 @@ describe "SubscriptionController", ->
|
|
|
opts.currency.should.equal @stubbedCurrencyCode
|
|
opts.currency.should.equal @stubbedCurrencyCode
|
|
|
done()
|
|
done()
|
|
|
@SubscriptionController.paymentPage @req, @res
|
|
@SubscriptionController.paymentPage @req, @res
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
describe "with a recurly subscription already", ->
|
|
describe "with a recurly subscription already", ->
|
|
|
it "should redirect to the subscription dashboard", (done)->
|
|
it "should redirect to the subscription dashboard", (done)->
|
|
|
@LimitationsManager.userHasSubscription.callsArgWith(1, null, false)
|
|
@LimitationsManager.userHasSubscription.callsArgWith(1, null, false)
|
|
@@ -191,7 +186,7 @@ describe "SubscriptionController", ->
|
|
|
url.should.equal "/user/subscription"
|
|
url.should.equal "/user/subscription"
|
|
|
done()
|
|
done()
|
|
|
@SubscriptionController.paymentPage(@req, @res)
|
|
@SubscriptionController.paymentPage(@req, @res)
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
describe "successful_subscription", ->
|
|
describe "successful_subscription", ->
|
|
|
beforeEach (done) ->
|
|
beforeEach (done) ->
|
|
@@ -230,8 +225,6 @@ describe "SubscriptionController", ->
|
|
|
@res.callback = done
|
|
@res.callback = done
|
|
|
@settings.apis.recurly.subdomain = 'test'
|
|
@settings.apis.recurly.subdomain = 'test'
|
|
|
@userSub = {account: {hosted_login_token: 'abcd'}}
|
|
@userSub = {account: {hosted_login_token: 'abcd'}}
|
|
|
- @RecurlyWrapper.getSubscription = sinon.stub()
|
|
|
|
|
- .callsArgWith(2, null, @userSub)
|
|
|
|
|
@LimitationsManager.userHasSubscriptionOrIsGroupMember
|
|
@LimitationsManager.userHasSubscriptionOrIsGroupMember
|
|
|
.callsArgWith(1, null, true, {})
|
|
.callsArgWith(1, null, true, {})
|
|
|
@SubscriptionController.userSubscriptionPage @req, @res
|
|
@SubscriptionController.userSubscriptionPage @req, @res
|