Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions app/js/jasmine-given.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@
context = currentSpec
result = setupFunction.call(context, done)
if assignResultTo
unless context[assignResultTo]
context[assignResultTo] = result
else
if context[assignResultTo]
throw new Error("Unfortunately, the variable '#{assignResultTo}' is already assigned to: #{context[assignResultTo]}")
else
context[assignResultTo] = result

mostRecentExpectations = null
mostRecentStacks = null
Expand Down
11 changes: 11 additions & 0 deletions spec/implementation-spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,17 @@ describe "jasmine-given implementation", ->
expect(@then).not.toHaveBeenCalled()
expect(doneProvidedByJasmineRunner).not.toHaveBeenCalled()

context "the when calls its done() with an error", ->
beforeEach ->
When (done) -> done(new Error())
Then (done) -> @then(); done()
it '', ->
specImplementation = it.calls[0].args[1]
doneProvidedByJasmineRunner = jasmine.createSpy("done")
specImplementation(doneProvidedByJasmineRunner)
expect(@then).not.toHaveBeenCalled()
expect(doneProvidedByJasmineRunner).toHaveBeenCalled()

context "the when does indeed call its done()", ->
beforeEach ->
When (done) -> done()
Expand Down