-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
simulator raises an error when #enter called and no way to process it…
…s input
- Loading branch information
1 parent
5e0709d
commit ce48882
Showing
8 changed files
with
74 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
function Player() { | ||
} | ||
Player.prototype.play = function(song) { | ||
this.currentlyPlayingSong = song; | ||
this.isPlaying = true; | ||
}; | ||
|
||
Player.prototype.pause = function() { | ||
this.isPlaying = false; | ||
}; | ||
|
||
Player.prototype.resume = function() { | ||
if (this.isPlaying) { | ||
throw new Error("song is already playing"); | ||
} | ||
|
||
this.isPlaying = true; | ||
}; | ||
|
||
Player.prototype.makeFavorite = function() { | ||
this.currentlyPlayingSong.persistFavoriteStatus(true); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
function Song() { | ||
} | ||
|
||
Song.prototype.persistFavoriteStatus = function(value) { | ||
// something complicated | ||
throw new Error("not yet implemented"); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
beforeEach(function() { | ||
this.addMatchers({ | ||
toBePlaying: function(expectedSong) { | ||
var player = this.actual; | ||
return player.currentlyPlayingSong === expectedSong && | ||
player.isPlaying; | ||
} | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters