-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not use `"should"` in expectation descriptions, let them speak for themselves. Use `let` instead of instance variables Use `expect` instead of `should`
- Loading branch information
Jake Yesbeck
committed
Oct 27, 2015
1 parent
5ea17da
commit 3989502
Showing
1 changed file
with
15 additions
and
17 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,42 @@ | ||
require 'spec_helper' | ||
|
||
describe Tassadar::SC2::Game do | ||
before(:each) do | ||
@replay = Tassadar::SC2::Replay.new(File.join(REPLAY_DIR, "patch150.SC2Replay")) | ||
end | ||
let(:replay) { Tassadar::SC2::Replay.new(File.join(REPLAY_DIR, "patch150.SC2Replay")) } | ||
|
||
it "should set the winner" do | ||
@replay.game.winner.name.should == "Ratbaxter" | ||
it "sets the winner" do | ||
expect(replay.game.winner.name).to eq("Ratbaxter") | ||
end | ||
|
||
it "should set the map" do | ||
@replay.game.map.should == "Scorched Haven" | ||
it "sets the map" do | ||
expect(replay.game.map).to eq("Scorched Haven") | ||
end | ||
|
||
it "should set the time" do | ||
#@replay.game.time.should == Time.new(2012, 8, 2, 11, 00, 33, "-05:00") | ||
it "sets the time" do | ||
#expect(replay.game.time).to eq(Time.new(2012, 8, 2, 11, 00, 33, "-05:00")) | ||
end | ||
|
||
it "should set the speed" do | ||
@replay.game.speed.should == "Faster" | ||
it "sets the speed" do | ||
expect(replay.game.speed).to eq("Faster") | ||
end | ||
|
||
it "should set the game type" do | ||
@replay.game.type.should == "2v2" | ||
it "sets the game type" do | ||
expect(replay.game.type).to eq("2v2") | ||
end | ||
|
||
it "should set the category" do | ||
@replay.game.category.should == "Ladder" | ||
it "sets the category" do | ||
expect(replay.game.category).to eq("Ladder") | ||
end | ||
|
||
context "2v2's" do | ||
let(:replay) { Tassadar::SC2::Replay.new(File.join(REPLAY_DIR, "2v2.SC2Replay")) } | ||
|
||
it "returns the game winners" do | ||
expect(replay.game).to have(2).winners | ||
expect(replay.game.winners.length).to eq(2) | ||
end | ||
|
||
it "returns the correct winners" do | ||
winners = replay.game.winners.map(&:name) | ||
expect(winners).to eq ["EaglePunch", "JZTD"] | ||
expect(winners).to match_array(["EaglePunch", "JZTD"]) | ||
end | ||
end | ||
end |