Sha256: 01d1887307f5b3e79fa3bea5ac0101909a32442252baadfb415e0a2b3595b4f7

Contents?: true

Size: 924 Bytes

Versions: 2

Compression:

Stored size: 924 Bytes

Contents

require 'twenty_one/chip'

include TwentyOne

describe Chip do
	
	it 'should value $1 if it is white' do
		white = Chip.new :white

		expect(white.value).to eq(1)
	end

	it 'should value $5 if it is red' do
		red = Chip.new :red

		expect(red.value).to eq(5)
	end

	it 'should value $25 if it is green' do
		green = Chip.new :green

		expect(green.value).to eq(25)
	end

	it 'should value $100 if it is black' do
		black = Chip.new :black

		expect(black.value).to eq(100)
	end

	describe '#generate_chips(color, amount)' do
		it 'should generate a set of chips of a specific color' do
			chips = Chip.generate_chips :white, 50

			expect(chips.size).to eq(50)
		end
	end	

	describe '#get_amount(chips)' do
		it 'should get the total amount of money a set of chips is worth' do
			chips = [Chip.new(:white), Chip.new(:red), Chip.new(:green), Chip.new(:black)]	

			expect(Chip.get_amount(chips)).to eq(131)
		end
	end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
twenty_one-0.1.1 spec/lib/chip_spec.rb
twenty_one-0.1.0 spec/lib/chip_spec.rb