1 require File.expand_path(File.dirname(__FILE__) + '/edgecase')
3 # Implement a DiceSet Class here:
9 class AboutDiceProject < EdgeCase::Koan
10 def test_can_create_a_dice_set
15 def test_rolling_the_dice_returns_a_set_of_integers_between_1_and_6
19 assert dice.values.is_a?(Array), "should be an array"
20 assert_equal 5, dice.values.size
21 dice.values.each do |value|
22 assert value >= 1 && value <= 6, "value #{value} must be between 1 and 6"
26 def test_dice_values_do_not_change_unless_explicitly_rolled
29 first_time = dice.values
30 second_time = dice.values
31 assert_equal first_time, second_time
34 def test_dice_values_should_change_between_rolls
38 first_time = dice.values
41 second_time = dice.values
43 assert_not_equal first_time, second_time,
44 "Two rolls should not be equal"
48 # If the rolls are random, then it is possible (although not
49 # likely) that two consecutive rolls are equal. What would be a
50 # better way to test this.
53 def test_you_can_roll_different_numbers_of_dice
57 assert_equal 3, dice.values.size
60 assert_equal 1, dice.values.size