Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

jasmine cleanup

  • Loading branch information...
commit 7b442e44889c12f33f25e303508b6721b67829eb 1 parent 0d9cd5f
@rmurphey authored
View
0  exercises/libs/jasmine/lib/jasmine-1.0.1/MIT.LICENSE → exercises/libs/jasmine/MIT.LICENSE
File renamed without changes
View
27 exercises/libs/jasmine/SpecRunner.html
@@ -1,27 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
- "http://www.w3.org/TR/html4/loose.dtd">
-<html>
-<head>
- <title>Jasmine Test Runner</title>
- <link rel="stylesheet" type="text/css" href="lib/jasmine-1.0.1/jasmine.css">
- <script type="text/javascript" src="lib/jasmine-1.0.1/jasmine.js"></script>
- <script type="text/javascript" src="lib/jasmine-1.0.1/jasmine-html.js"></script>
-
- <!-- include source files here... -->
- <script type="text/javascript" src="src/Player.js"></script>
- <script type="text/javascript" src="src/Song.js"></script>
-
- <!-- include spec files here... -->
- <script type="text/javascript" src="spec/SpecHelper.js"></script>
- <script type="text/javascript" src="spec/PlayerSpec.js"></script>
-
-</head>
-<body>
-
-<script type="text/javascript">
- jasmine.getEnv().addReporter(new jasmine.TrivialReporter());
- jasmine.getEnv().execute();
-</script>
-
-</body>
-</html>
View
0  ...es/libs/jasmine/lib/jasmine-1.0.1/jasmine-html.js → exercises/libs/jasmine/jasmine-html.js
File renamed without changes
View
0  exercises/libs/jasmine/lib/jasmine-1.0.1/jasmine.css → exercises/libs/jasmine/jasmine.css
File renamed without changes
View
0  exercises/libs/jasmine/lib/jasmine-1.0.1/jasmine.js → exercises/libs/jasmine/jasmine.js
File renamed without changes
View
58 exercises/libs/jasmine/spec/PlayerSpec.js
@@ -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");
- });
- });
-});
View
9 exercises/libs/jasmine/spec/SpecHelper.js
@@ -1,9 +0,0 @@
-beforeEach(function() {
- this.addMatchers({
- toBePlaying: function(expectedSong) {
- var player = this.actual;
- return player.currentlyPlayingSong === expectedSong
- && player.isPlaying;
- }
- })
-});
View
22 exercises/libs/jasmine/src/Player.js
@@ -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);
-};
View
7 exercises/libs/jasmine/src/Song.js
@@ -1,7 +0,0 @@
-function Song() {
-}
-
-Song.prototype.persistFavoriteStatus = function(value) {
- // something complicated
- throw new Error("not yet implemented");
-};
Please sign in to comment.
Something went wrong with that request. Please try again.