Sha256: aeb42a3390eb7ca23323d06fb0242895852214c70da743acbbbcb400bd043732

Contents?: true

Size: 1.11 KB

Versions: 5

Compression:

Stored size: 1.11 KB

Contents

deck = Deck.new
describe Deck do
	subject {Deck.new}
	describe "#length" do
		it "should == 54" do; expect(subject.cards.length).to eq 54; end
	end
end
describe Card do
	cards = ["Ace", "King", "Queen", "Jack", "Joker"] + (2..10).to_a
	describe "#value" do
		for card in cards
			describe "#{card}" do
				it "should == #{Card.new(card)._value}" do; 
					expect(Card.new(card).value).to eq Card.new(card)._value
				end
			end
		end
	end
end
describe "converter" do
	context "when a number" do
		it "should return the input as a number" do
			expect(converter("5")).to eq 5
		end
	end
	context "when an abbreveation" do
		it "should expand it" do
			expect(converter("K")).to eq "King"
		end
	end
end
describe Hand do
	hand = Hand.new Deck.new
	describe "#hand" do
		describe "#length" do
			subject { hand.hand.length }
			it "should == 3" do; expect( subject ).to eq 3; end
		end
	end
	describe "#initialize" do
		describe "Deck#length" do
			it "should have three less cards after initialization" do
				deck1, hand, deck2 = deck.cards.length, Hand.new( deck ), deck.cards.length
				expect( deck1 ).to be > deck2
			end
		end
	end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
99_game-2.0.3.pre.71 spec/lib/99_game_spec.rb
99_game-2.0.3.pre.70 spec/lib/99_game_spec.rb
99_game-2.0.3.pre.69 spec/lib/99_game_spec.rb
99_game-2.0.3.pre.68 spec/lib/99_game_spec.rb
99_game-2.0.3 spec/lib/99_game_spec.rb