Sha256: 78596a75e1f4f8dfb033b1f98df460f3ea4ac2d97943d1d73d2f87c92805c421
Contents?: true
Size: 662 Bytes
Versions: 5
Compression:
Stored size: 662 Bytes
Contents
require_relative '../spec_helper' module Cardgame describe Deck do def setup @deck = Deck.new end it "must be an instance of deck" do @deck.must_be_instance_of Deck end it "must have 52 cards in it" do @deck.length.must_equal 52 end it "must have 13 cards of each suit" do h = Hash.new(0) @deck.each { |card| h[card.suit] += 1 } h.each_key do |suit| h[suit].must_equal 13 end end it "must have 4 of each value" do h = Hash.new(0) @deck.each { |card| h[card.value] += 1 } h.each_key do |value| h[value].must_equal 4 end end end end
Version data entries
5 entries across 5 versions & 1 rubygems