public

Jasmine shared examples with CoffeeScript. Based on: http://pivotallabs.com/drying-up-jasmine-specs-with-shared-behavior/

  • Download Gist
coffee_shared_examples.js.coffee
CoffeeScript
1 2 3 4 5 6 7 8 9 10 11 12
describe "Football Game", ->
football = {}
beforeEach ->
@game = new FootballGame()
football.ball = new Football()
football.game = @game
it "should score a field goal properly" ->
expect(@game.fieldGoal.points).toEqual(3)
sharedBehaviorForGameOf(football)

I believe this means you're putting the game as a property on the spec. Not best practice.

Why can't you just put game in the describe, maybe assigning null?

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.