Sha256: 18356dc52419827676019054b0b5d43a3e2197cc709a70ee812ef96d7da71fdc

Contents?: true

Size: 601 Bytes

Versions: 2

Compression:

Stored size: 601 Bytes

Contents

module RubyQuiz1
  describe Card do

    let :suit do
      Suit.new :club, 0
    end

    it "can be initialized with a value from 1 to 13" do
      (1..13).each do |n|
        expect{described_class.new(n, suit)}.not_to raise_error
      end
    end

    it "cannot be initialized with a value below 1 or above 13" do
      [0,14].each do |n|
        expect{described_class.new(n, suit)}.to raise_error ArgumentError
      end
    end

    it "calculates the total value" do
      subject = described_class.new 1, Suit.new(:diamond, 13)
      expect(subject.total_value).to eq 14
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ruby_quiz_1-0.0.2 spec/lib/ruby_quiz_1/card_spec.rb
ruby_quiz_1-0.0.1 spec/lib/ruby_quiz_1/card_spec.rb