Sha256: 222af9c0bfc4c7ab48bdf4a2a855b264048fd27b635e32089470887b83f566a4

Contents?: true

Size: 1.38 KB

Versions: 5

Compression:

Stored size: 1.38 KB

Contents

require_relative '../spec_helper'

module Cardgame
  describe Player do
    #def setup
      #@deck = Deck.new
      #@player = Player.new
      #@player = Player.new
      #@gameplay = Gameplay.new(:deck => @deck, :player => @player, :ai => @ai)
      #@player = @gameplay.player
      #@gameplay.deal
    #end

    it "must be an instance of Player" do
      Player.new.must_be_instance_of Player
    end

    describe "#stack" do
      def setup
        @player = Player.new
        card = Card.new(:suit => :hearts, :value => 6)
        @player.stack << card
      end
      it "player must have a stack of cards" do
        @player.stack.first.must_be_instance_of Card
      end
    end
    describe "#discard" do
          def setup
            @player = Player.new
            @player.discard << Card.new(:suit => :clubs, :value => 11)
          end

          it "must have a discard of Card objects" do
            @player.discard.first.must_be_instance_of Card
          end

          it "must be able to append cards on the end" do
            original_discard_length = @player.discard.length
            @player.discard << Card.new(:suit => :spades, :value => 7)
            @player.discard.length.must_equal (original_discard_length + 1)
          end
        end

    describe "#name" do
      it "player must have a name" do
        Player.new.name.must_equal "Player"
      end
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
warcards-0.0.7 spec/warcards/player_spec.rb
warcards-0.0.6 spec/warcards/player_spec.rb
warcards-0.0.5 spec/warcards/player_spec.rb
warcards-0.0.3 spec/warcards/player_spec.rb
warcards-0.0.2 spec/warcards/player_spec.rb