Skip to content

Commit

Permalink
Prepare table
Browse files Browse the repository at this point in the history
  • Loading branch information
MeriFW committed May 11, 2017
1 parent e1765e1 commit a63b8e7
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 5 deletions.
21 changes: 19 additions & 2 deletions spec/card_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,36 @@

describe 'Card' do
it 'has a mana cost' do
some_card = Card.new(some_mana_cost)
some_other_card = Card.new(some_other_mana_cost)
some_card = Card.new(some_mana_cost, :damage)
some_other_card = Card.new(some_other_mana_cost, :damage)


expect(some_card.cost).to be(1)
expect(some_other_card.cost).to be(2)
end

it 'has a damage points' do
some_card = Card.new(:mana, some_damage_points)
some_other_card = Card.new(:mana, some_other_damage_points)


expect(some_card.damage).to be(1)
expect(some_other_card.damage).to be(2)
end

def some_mana_cost
1
end

def some_other_mana_cost
2
end

def some_damage_points
1
end

def some_other_damage_points
2
end
end
4 changes: 2 additions & 2 deletions spec/player_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
it 'starts with no cards' do
player = Player.new

expect(player.cards_in_hand?(initial_cards_in_deck)).to be(true)
expect(player.cards_in_deck?(initial_cards_in_hand)).to be(true)
expect(player.cards_in_hand?(initial_cards_in_hand)).to be(true)
expect(player.cards_in_deck?(initial_cards_in_deck)).to be(true)
end

def initial_health
Expand Down
7 changes: 6 additions & 1 deletion system/card.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
class Card
def initialize(cost=0)
def initialize(cost=0, damage=0)
@cost = cost
@damage = damage
end

def cost
@cost
end

def damage
@damage
end

def equal?(card)
card.cost == @cost
end
Expand Down

0 comments on commit a63b8e7

Please sign in to comment.