Skip to content

Instantly share code, notes, and snippets.

@joemsak
Created October 5, 2014 13:46
Show Gist options
  • Save joemsak/d162676e481450f4ca0b to your computer and use it in GitHub Desktop.
Save joemsak/d162676e481450f4ca0b to your computer and use it in GitHub Desktop.
#= require game
#= require player
#= require match
describe Match, ->
it 'starts the game', ->
game = new Game
players = [new Player, new Player]
new Match(game, players)
expect(game.started).to.be.true
it 'scores points for players', ->
game = new Game
players = [new Player, new Player]
match = new Match(game, players)
match.scorePoint(players[0])
expect(players[0].score).to.equal 1
match.scorePoint(players[1])
expect(players[1].score).to.equal 1
it 'quits the game and declares a winner after a player scores 10 points', ->
game = new Game
players = [new Player, new Player]
match = new Match(game, players)
match.scorePoint(players[0]) for [1..10]
expect(game.started).to.be.false
expect(match.winner).to.equal players[0]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment