Sha256: b8d874f2c813d6b2e2b56057e76edf951f319329385387d6a376ac591e37068a

Contents?: true

Size: 866 Bytes

Versions: 4

Compression:

Stored size: 866 Bytes

Contents

# frozen_string_literal: true

module FiftyTwo
  describe Hand do
    # majority covered by tests for FiftyTwo::Deck

    let(:deck) { FiftyTwo::Deck.standard }
    let(:hand) { described_class.new }
    before(:each) { deck.shuffle! }

    describe "#release" do
      it "does nothing with an empty hand" do
        expect(deck.count).to eq 52
        expect(hand.count).to eq 0

        hand.release

        expect(deck.count).to eq 52
        expect(hand.count).to eq 0
      end

      context "with cards" do
        before(:each) { deck.deal(hand, 5) }

        it "can return the entirety of the hand back to the deck from whence it came" do
          expect(deck.count).to eq 47
          expect(hand.count).to eq 5

          hand.release

          expect(deck.count).to eq 52
          expect(hand.count).to eq 0
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fiftytwo-0.0.5 spec/lib/fiftytwo/hand_spec.rb
fiftytwo-0.0.4 spec/lib/fiftytwo/hand_spec.rb
fiftytwo-0.0.3 spec/lib/fiftytwo/hand_spec.rb
fiftytwo-0.0.2 spec/lib/fiftytwo/hand_spec.rb