Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save tatsuro-ueda/4254898 to your computer and use it in GitHub Desktop.
Save tatsuro-ueda/4254898 to your computer and use it in GitHub Desktop.
Jasmine beforeEach / afterEach in CoffeeScript
# 「JS開発におけるTDDと自動テストツール利用の勘所 」より引用。
# http://www.slideshare.net/KojiNakamura/jstdd
describe "Object", ->
beforeEach ->
object = new MyObject
afterEach ->
# do something...
describe "#methodA", ->
it "should be ok", ->
expect(object.methodA()).toBeTruthy()
describe "#methodB", ->
it "should be ok", ->
expect(object.methodB).toBeTruthy()
describe "(context)", ->
beforeEach ->
object.someMethod()
describe "#methodC", ->
it "should be ok", ->
expect(object.methodC).toBeTruthy()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment