Skip to content

Instantly share code, notes, and snippets.

@cromwellryan
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cromwellryan/9513580 to your computer and use it in GitHub Desktop.
Save cromwellryan/9513580 to your computer and use it in GitHub Desktop.
require_relative 'dice'
require 'minitest/spec'
require 'minitest/autorun'
describe Dice do
before do
@new_roll = Dice.new
end
describe "rolling 5 dice" do
before { @result = @new_roll.hashing([1,3,1,1,5]) }
it "counts how many times each number comes up" do
@result.must_equal ({1=>3, 3=>1, 5=>1})
end
end
describe "when asked if there is a set of 3 repeated results" do
before { @result = @new_roll.set_of_three([1,3,5,1,1]) }
it "will remove the set if it exists" do
@result.must_equal ({1=>0, 3=>1, 5=>1})
end
end
describe "when asked about the total score" do
before { @result = @new_roll.score([1,3,1,1,1]) }
it "will calculate total score for 1 game" do
@result.must_equal 1100
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment