Skip to content

Commit

Permalink
Clean up Player specs.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmckible committed Feb 19, 2010
1 parent ed73fa2 commit 0f3ea0d
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 19 deletions.
43 changes: 31 additions & 12 deletions spec/engine/player_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
require 'spec_helper'

describe Player do

it 'should initialize' do
player = Player.new 'Dave'
player.name.should == 'Dave'
Expand Down Expand Up @@ -30,16 +29,12 @@
player.hand << Estate.new
player.should have(2).available_actions
end

it 'should discard deck' do
game, player, turn = GameFactory.build
player.deck.size.should == 5
player.discard.size.should == 0
player.discard_deck
player.deck.size.should == 0
player.discard.size.should == 5
end

end

###############################################################################
# D R A W #
###############################################################################
describe Player, 'draw' do
it 'should draw a card with one in the deck' do
player = Player.new 'Draw'
copper = Copper.new
Expand Down Expand Up @@ -67,6 +62,19 @@
player.hand.should be_empty
player.deck.should be_empty
end
end

###############################################################################
# D I S C A R D #
###############################################################################
describe Player, 'discard' do
it 'should discard' do
game, player, turn = GameFactory.build
card = player.hand.first
player.discard_card card
player.discard.should == [card]
player.hand.size.should == 4
end

it 'should discard hand' do
player = Player.new 'Discard'
Expand All @@ -78,9 +86,20 @@
player.hand.should be_empty
player.discard.should == [silver, copper]
end


it 'should discard deck' do
game, player, turn = GameFactory.build
player.deck.size.should == 5
player.discard.size.should == 0
player.discard_deck
player.deck.size.should == 0
player.discard.size.should == 5
end
end

###############################################################################
# I / O #
###############################################################################
describe Player, 'IO' do
it 'should select a card' do
game, player, turn = GameFactory.build
Expand Down
7 changes: 0 additions & 7 deletions spec/engine/turn_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,4 @@
@player.hand.should be_empty
end

it 'should discard' do
card = @player.hand.first
@player.discard_card card
@player.discard.should == [card]
@player.hand.size.should == 4
end

end

0 comments on commit 0f3ea0d

Please sign in to comment.