summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormo k <mo@mokhan.ca>2012-05-21 12:08:10 -0600
committermo k <mo@mokhan.ca>2012-05-21 12:08:10 -0600
commitc5bb8e11918394ab864595f968cda276ae532508 (patch)
tree361bae4e0ce2c03e05eb582d8a484ca015fd23da
parented7612d2dbf43c9250c3ed6a2f988ac29bd34c00 (diff)
remove examples specs.
-rw-r--r--public/javascripts/Player.js22
-rw-r--r--public/javascripts/Song.js7
-rw-r--r--spec/javascripts/PlayerSpec.js58
-rw-r--r--spec/javascripts/helpers/SpecHelper.js7
4 files changed, 0 insertions, 94 deletions
diff --git a/public/javascripts/Player.js b/public/javascripts/Player.js
deleted file mode 100644
index fcce826..0000000
--- a/public/javascripts/Player.js
+++ /dev/null
@@ -1,22 +0,0 @@
-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);
-}; \ No newline at end of file
diff --git a/public/javascripts/Song.js b/public/javascripts/Song.js
deleted file mode 100644
index a8a3f2d..0000000
--- a/public/javascripts/Song.js
+++ /dev/null
@@ -1,7 +0,0 @@
-function Song() {
-}
-
-Song.prototype.persistFavoriteStatus = function(value) {
- // something complicated
- throw new Error("not yet implemented");
-}; \ No newline at end of file
diff --git a/spec/javascripts/PlayerSpec.js b/spec/javascripts/PlayerSpec.js
deleted file mode 100644
index 79f1022..0000000
--- a/spec/javascripts/PlayerSpec.js
+++ /dev/null
@@ -1,58 +0,0 @@
-describe("Player", function() {
- var player;
- var song;
-
- beforeEach(function() {
- player = new Player();
- song = new Song();
- });
-
- it("should be able to play a Song", function() {
- player.play(song);
- expect(player.currentlyPlayingSong).toEqual(song);
-
- //demonstrates use of custom matcher
- expect(player).toBePlaying(song);
- });
-
- describe("when song has been paused", function() {
- beforeEach(function() {
- player.play(song);
- player.pause();
- });
-
- it("should indicate that the song is currently paused", function() {
- expect(player.isPlaying).toBeFalsy();
-
- // demonstrates use of 'not' with a custom matcher
- expect(player).not.toBePlaying(song);
- });
-
- it("should be possible to resume", function() {
- player.resume();
- expect(player.isPlaying).toBeTruthy();
- expect(player.currentlyPlayingSong).toEqual(song);
- });
- });
-
- // demonstrates use of spies to intercept and test method calls
- it("tells the current song if the user has made it a favorite", function() {
- spyOn(song, 'persistFavoriteStatus');
-
- player.play(song);
- player.makeFavorite();
-
- expect(song.persistFavoriteStatus).toHaveBeenCalledWith(true);
- });
-
- //demonstrates use of expected exceptions
- describe("#resume", function() {
- it("should throw an exception if song is already playing", function() {
- player.play(song);
-
- expect(function() {
- player.resume();
- }).toThrow("song is already playing");
- });
- });
-}); \ No newline at end of file
diff --git a/spec/javascripts/helpers/SpecHelper.js b/spec/javascripts/helpers/SpecHelper.js
index e9b8284..b75d4f8 100644
--- a/spec/javascripts/helpers/SpecHelper.js
+++ b/spec/javascripts/helpers/SpecHelper.js
@@ -1,9 +1,2 @@
beforeEach(function() {
- this.addMatchers({
- toBePlaying: function(expectedSong) {
- var player = this.actual;
- return player.currentlyPlayingSong === expectedSong &&
- player.isPlaying;
- }
- });
});