Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Completed dice project test

  • Loading branch information...
commit 415a832f5a6066d43641a275cc2f889ead339ede 1 parent be8f7cf
@javierjulio authored
Showing with 15 additions and 5 deletions.
  1. +15 −5 about_dice_project.rb
View
20 about_dice_project.rb
@@ -1,10 +1,18 @@
require File.expand_path(File.dirname(__FILE__) + '/edgecase')
-# Implement a DiceSet Class here:
-#
-# class DiceSet
-# code ...
-# end
+class DiceSet
+
+ attr_reader :values
+
+ def roll(numDie)
+
+ @values = []
+
+ numDie.downto(1) { |i|
+ @values.push(1 + rand(6))
+ }
+ end
+end
class AboutDiceProject < EdgeCase::Koan
def test_can_create_a_dice_set
@@ -48,6 +56,8 @@ def test_dice_values_should_change_between_rolls
# If the rolls are random, then it is possible (although not
# likely) that two consecutive rolls are equal. What would be a
# better way to test this.
+ #
+ # Research: http://stackoverflow.com/questions/2082970/whats-the-best-way-to-test-this
end
def test_you_can_roll_different_numbers_of_dice
Please sign in to comment.
Something went wrong with that request. Please try again.