spec/result_spec.rb in icu_ratings-1.5.0 vs spec/result_spec.rb in icu_ratings-1.5.1
- old
+ new
@@ -3,24 +3,24 @@
module ICU
describe RatedResult do
context "a basic rated result" do
before(:all) do
- @o = ICU::RatedPlayer.new(2)
+ @o = ICU::RatedPlayer.factory(2)
end
it "needs a round, opponent and score (win, loss or draw)" do
r = ICU::RatedResult.new(1, @o, 'W')
r.round.should == 1
- r.opponent.should be_an_instance_of(ICU::RatedPlayer)
+ r.opponent.should be_a_kind_of(ICU::RatedPlayer)
r.score.should == 1.0
end
end
context "restrictions, or lack thereof, on attributes" do
before(:each) do
- @p = ICU::RatedPlayer.new(2)
+ @p = ICU::RatedPlayer.factory(2)
end
it "round numbers must be positive" do
lambda { ICU::RatedResult.new(0, 1, 'W') }.should raise_error(/invalid.*round number/i)
lambda { ICU::RatedResult.new(-1, 1, 'W') }.should raise_error(/invalid.*round number/i)
@@ -39,11 +39,11 @@
end
end
context "#opponents_score" do
before(:each) do
- @p = ICU::RatedPlayer.new(2)
+ @p = ICU::RatedPlayer.factory(2)
end
it "should give the score from the opponent's perspective" do
ICU::RatedResult.new(1, @p, 'W').opponents_score.should == 0.0
ICU::RatedResult.new(1, @p, 'L').opponents_score.should == 1.0
@@ -51,11 +51,11 @@
end
end
context "equality" do
before(:each) do
- @p1 = ICU::RatedPlayer.new(1)
- @p2 = ICU::RatedPlayer.new(2)
+ @p1 = ICU::RatedPlayer.factory(1)
+ @p2 = ICU::RatedPlayer.factory(2)
@r1 = ICU::RatedResult.new(1, @p1, 'W')
@r2 = ICU::RatedResult.new(1, @p1, 'W')
@r3 = ICU::RatedResult.new(2, @p1, 'W')
@r4 = ICU::RatedResult.new(1, @p2, 'W')
@r5 = ICU::RatedResult.new(1, @p1, 'L')
\ No newline at end of file