 		it "should return the updated subscription", ->
 			should.exist @recurlySubscription
 			@recurlySubscription.plan.plan_code.should.equal "gold"
-			
+
 
 	describe "cancelSubscription", ->
 		beforeEach (done) ->
 			@recurlySubscriptionId = "subscription-id-123"
-			@apiRequest = sinon.stub RecurlyWrapper, "apiRequest", (options, callback) =>
+			@apiRequest = sinon.stub @RecurlyWrapper, "apiRequest", (options, callback) =>
 				options.url.should.equal "subscriptions/#{@recurlySubscriptionId}/cancel"
 				options.method.should.equal "put"
 				callback()
-			RecurlyWrapper.cancelSubscription(@recurlySubscriptionId, done)
+			@RecurlyWrapper.cancelSubscription(@recurlySubscriptionId, done)
 
 		afterEach ->
-			RecurlyWrapper.apiRequest.restore()
+			@RecurlyWrapper.apiRequest.restore()
 
 		it "should send a cancel request to the API", ->
 			@apiRequest.called.should.equal true
-	
+
 	describe "reactivateSubscription", ->
 		beforeEach (done) ->
 			@recurlySubscriptionId = "subscription-id-123"
-			@apiRequest = sinon.stub RecurlyWrapper, "apiRequest", (options, callback) =>
+			@apiRequest = sinon.stub @RecurlyWrapper, "apiRequest", (options, callback) =>
 				options.url.should.equal "subscriptions/#{@recurlySubscriptionId}/reactivate"
 				options.method.should.equal "put"
 				callback()
-			RecurlyWrapper.reactivateSubscription(@recurlySubscriptionId, done)
+			@RecurlyWrapper.reactivateSubscription(@recurlySubscriptionId, done)
 
 		afterEach ->
-			RecurlyWrapper.apiRequest.restore()
+			@RecurlyWrapper.apiRequest.restore()
 
 		it "should send a cancel request to the API", ->
 			@apiRequest.called.should.equal true
-	
-		
+
+
 
 	describe "redeemCoupon", ->
 
 		beforeEach (done) ->
 			@recurlyAccountId = "account-id-123"
 			@coupon_code = "312321312"
-			@apiRequest = sinon.stub RecurlyWrapper, "apiRequest", (options, callback) =>
+			@apiRequest = sinon.stub @RecurlyWrapper, "apiRequest", (options, callback) =>
 				options.url.should.equal "coupons/#{@coupon_code}/redeem"
 				options.body.indexOf("<account_code>#{@recurlyAccountId}</account_code>").should.not.equal -1
 				options.body.indexOf("<currency>USD</currency>").should.not.equal -1
 				options.method.should.equal "post"
 				callback()
-			RecurlyWrapper.redeemCoupon(@recurlyAccountId, @coupon_code, done)
+			@RecurlyWrapper.redeemCoupon(@recurlyAccountId, @coupon_code, done)
 
 		afterEach ->
-			RecurlyWrapper.apiRequest.restore()
+			@RecurlyWrapper.apiRequest.restore()
 
 		it "should send the request to redem the coupon", ->
 			@apiRequest.called.should.equal true
-	
 
 	describe "_addressToXml", ->
 

				nonsenseKey: "rubbish"

		it 'should generate the correct xml', () ->
			result = RecurlyWrapper._addressToXml @address
			should.equal(
				result,
				"""


		describe "with ReculyJS token", ->
			before ->
				@apiRequest = sinon.stub(@RecurlyWrapper, "apiRequest", mockApiRequest)
				@RecurlyWrapper.getSubscription "70db44b10f5f4b238669480c9903f6f5", {recurlyJsResult: true}, (error, recurlySubscription) =>
					@recurlySubscription = recurlySubscription
			after ->
				@RecurlyWrapper.apiRequest.restore()

			it "should return the subscription", ->
				@recurlySubscription.uuid.should.equal "44f83d7cba354d5b84812419f923ea96"

