Permalink
Browse files

Added somethings that I can't remember and I am not with patience to …

…look at the diff :)
  • Loading branch information...
1 parent 1f5b259 commit eaa84d6cdd17aa7da92c204946e266f80b6d3dbf @hugomaiavieira committed Jul 16, 2010
Showing with 18 additions and 4 deletions.
  1. +6 −2 player.py
  2. +5 −1 specs/buraco_spec.py
  3. +6 −0 specs/player_spec.py
  4. +1 −1 stories.md
View
@@ -28,6 +28,10 @@ def draws_card(self, pile):
self.hand.append(card)
def discard(self, card):
- self.hand.remove(card)
- self.game.discard_pile.append(card)
+ try:
+ self.hand.remove(card)
+ except:
+ raise CardNotInHandError
+ else:
+ self.game.discard_pile.append(card)
View
@@ -45,7 +45,11 @@ def it_should_pop_card_from_the_stock(self):
len(self.buraco.stock) |should| equal_to(stock_length - 1)
def it_should_return_the_player_of_the_current_turn(self):
+ self.hugo.hand = []
self.buraco.current_player() |should| be(self.hugo)
- self.hugo.make_shot(STOCK)
+ # shot
+ self.hugo.draws_card(STOCK)
+ self.hugo.discard(self.hugo.hand[0])
+ # after his move, the turn goes to the next player in the table
self.buraco.current_player() |should| be(self.pedro)
View
@@ -53,5 +53,11 @@ def it_should_discard_the_given_card(self):
self.pedro.hand |should_not| contain(card)
self.game.discard_pile |should| contain(card)
+ def it_should_not_allow_user_to_discard_a_card_if_he_doesnt_have_it(self):
+ self.pedro.hand = []
+ card = Card('J', 'spades')
(lambda: self.pedro.discard(card)) |should| throw(CardNotInHandError)
+ def after_discarding_the_player_should_notify_the_game_he_is_done(self):
+ pass
+
View
@@ -16,7 +16,7 @@ Buraco
* Se tiver apenas uma carta na mesa, esta não poderá ser a carta descartada
* Descartar:
- * Jogar uma carta da sua mão na mesa.
+ * Jogar uma carta da sua mão na mesa.(OK)
* Fazer jogada:

0 comments on commit eaa84d6

Please sign in to comment.