From 0daae4d7b4c006e23ff345709516108289334988 Mon Sep 17 00:00:00 2001 From: Greg Cobb and JR Boyens Date: Tue, 16 Jul 2013 10:00:16 -0700 Subject: [PATCH] Update examples for 2.0 --- lib/jasmine-core/example/spec/PlayerSpec.js | 4 ++-- lib/jasmine-core/example/spec/SpecHelper.js | 22 +++++++++++++-------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/lib/jasmine-core/example/spec/PlayerSpec.js b/lib/jasmine-core/example/spec/PlayerSpec.js index 79f10221..f17521fd 100644 --- a/lib/jasmine-core/example/spec/PlayerSpec.js +++ b/lib/jasmine-core/example/spec/PlayerSpec.js @@ -52,7 +52,7 @@ describe("Player", function() { expect(function() { player.resume(); - }).toThrow("song is already playing"); + }).toThrowError("song is already playing"); }); }); -}); \ No newline at end of file +}); diff --git a/lib/jasmine-core/example/spec/SpecHelper.js b/lib/jasmine-core/example/spec/SpecHelper.js index c097ee1f..415c5438 100644 --- a/lib/jasmine-core/example/spec/SpecHelper.js +++ b/lib/jasmine-core/example/spec/SpecHelper.js @@ -1,9 +1,15 @@ -beforeEach(function() { - addMatchers({ - toBePlaying: function(expectedSong) { - var player = this.actual; - return player.currentlyPlayingSong === expectedSong && - player.isPlaying; - } - }); +beforeEach(function () { + jasmine.Expectation.addMatchers({ + toBePlaying: function () { + return { + compare: function (actual, expected) { + var player = actual; + + return { + pass: player.currentlyPlayingSong === expected && player.isPlaying + } + } + }; + } + }); });