freeze Date in Recurly tests before all calls

beforeEach freezes and resets for each subtest, which does not give
the desired result as the time increases between each subtest, we want
to freeze once at the beginning and reset at the end using before/after.
This commit is contained in:
Brian Gough 2015-05-19 14:59:09 +01:00
parent f5c39efcac
commit cc9c8fdc94

View file

@ -108,13 +108,10 @@ describe "RecurlyWrapper", ->
Settings.defaultPlanCode =
collaborators: 0
versioning: false
tk.freeze(Date.now())
afterEach ->
tk.reset()
describe "sign", ->
before (done) ->
tk.freeze Date.now() # freeze the time for these tests
RecurlyWrapper.sign({
subscription :
plan_code : "gold"
@ -124,6 +121,9 @@ describe "RecurlyWrapper", ->
done()
)
after ->
tk.reset()
it "should be signed correctly", ->
signed = @signature.split("|")[0]
query = @signature.split("|")[1]