physh_roller 0.0.1 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README +55 -1
- data/lib/physh_roller/dice_roll.rb +27 -10
- data/lib/physh_roller.rb +3 -0
- metadata +16 -62
- data/doc/Object.html +0 -204
- data/doc/Output.html +0 -226
- data/doc/PhyshRoller/DiceRoll.html +0 -498
- data/doc/PhyshRoller/Die.html +0 -266
- data/doc/PhyshRoller.html +0 -140
- data/doc/created.rid +0 -14
- data/doc/doc/created_rid.html +0 -97
- data/doc/features/physh_roller/parse_dice_roll_string_feature.html +0 -117
- data/doc/features/physh_roller/roll_dice_feature.html +0 -119
- data/doc/features/physh_roller/roll_die_feature.html +0 -117
- data/doc/images/add.png +0 -0
- data/doc/images/arrow_up.png +0 -0
- data/doc/images/brick.png +0 -0
- data/doc/images/brick_link.png +0 -0
- data/doc/images/bug.png +0 -0
- data/doc/images/bullet_black.png +0 -0
- data/doc/images/bullet_toggle_minus.png +0 -0
- data/doc/images/bullet_toggle_plus.png +0 -0
- data/doc/images/date.png +0 -0
- data/doc/images/delete.png +0 -0
- data/doc/images/find.png +0 -0
- data/doc/images/loadingAnimation.gif +0 -0
- data/doc/images/macFFBgHack.png +0 -0
- data/doc/images/package.png +0 -0
- data/doc/images/page_green.png +0 -0
- data/doc/images/page_white_text.png +0 -0
- data/doc/images/page_white_width.png +0 -0
- data/doc/images/plugin.png +0 -0
- data/doc/images/ruby.png +0 -0
- data/doc/images/tag_blue.png +0 -0
- data/doc/images/tag_green.png +0 -0
- data/doc/images/transparent.png +0 -0
- data/doc/images/wrench.png +0 -0
- data/doc/images/wrench_orange.png +0 -0
- data/doc/images/zoom.png +0 -0
- data/doc/index.html +0 -94
- data/doc/js/darkfish.js +0 -155
- data/doc/js/jquery.js +0 -18
- data/doc/js/navigation.js +0 -142
- data/doc/js/search.js +0 -94
- data/doc/js/search_index.js +0 -1
- data/doc/js/searcher.js +0 -228
- data/doc/rdoc.css +0 -595
- data/doc/table_of_contents.html +0 -98
- data/features/physh_roller/parse_dice_roll_string.feature +0 -19
- data/features/physh_roller/roll_dice.feature +0 -22
- data/features/physh_roller/roll_die.feature +0 -19
- data/features/step_definitions/physh_roller/physh_roller_steps.rb +0 -79
- data/features/support/env.rb +0 -3
@@ -1,22 +0,0 @@
|
|
1
|
-
Feature: Roll dice
|
2
|
-
|
3
|
-
As a user
|
4
|
-
I want to roll a set of dice
|
5
|
-
To get a set of rolls and a total
|
6
|
-
|
7
|
-
Scenario Outline: getting the result of rolling some dice
|
8
|
-
Given I have a dice roll string described by "<dice_roll_string>"
|
9
|
-
When I roll the set of dice
|
10
|
-
Then the result should have "<number_of_dice>"
|
11
|
-
And each die roll should be equal to or greater than "<lower_limit>"
|
12
|
-
And each die roll should be equal to or less than "<upper_limit>"
|
13
|
-
And the total should be equal to or greater than "<lowest_total>"
|
14
|
-
And the total should be equal to or less than "<upper_total>"
|
15
|
-
|
16
|
-
|
17
|
-
Scenarios: different dice strings
|
18
|
-
| dice_roll_string | lower_limit | upper_limit | lowest_total | upper_total | number_of_dice |
|
19
|
-
| 1d6 | 1 | 6 | 1 | 6 | 1 |
|
20
|
-
| 3d4 | 1 | 4 | 3 | 12 | 3 |
|
21
|
-
| 1d6+1 | 1 | 6 | 2 | 7 | 1 |
|
22
|
-
| 3d4-2 | 1 | 4 | 1 | 10 | 3 |
|
@@ -1,19 +0,0 @@
|
|
1
|
-
Feature: Simple Die Roll
|
2
|
-
|
3
|
-
As a user
|
4
|
-
I want to roll a die
|
5
|
-
To generate a random number between 1 and the number of sides on the die
|
6
|
-
|
7
|
-
Scenario Outline: Roll a die
|
8
|
-
Given I want to roll a die with "<sides_on_die>" sides
|
9
|
-
When I roll the die
|
10
|
-
Then the result should be between "1" and "<sides_on_die>"
|
11
|
-
|
12
|
-
Scenarios: different sides on die
|
13
|
-
| sides_on_die |
|
14
|
-
| 2 |
|
15
|
-
| 6 |
|
16
|
-
| 12 |
|
17
|
-
| 100 |
|
18
|
-
| 1000 |
|
19
|
-
| 3 |
|
@@ -1,79 +0,0 @@
|
|
1
|
-
class Output
|
2
|
-
def messages
|
3
|
-
@messages = []
|
4
|
-
end
|
5
|
-
|
6
|
-
def puts(message)
|
7
|
-
messages << message
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
def output
|
12
|
-
@output ||= Output.new
|
13
|
-
end
|
14
|
-
|
15
|
-
Given /^I want to roll some dice$/ do
|
16
|
-
|
17
|
-
end
|
18
|
-
|
19
|
-
When /^I create a new dice roll with the string "(.*?)"$/ do |dice_roll_string|
|
20
|
-
@dice_roll = PhyshRoller::DiceRoll.new(dice_roll_string, output)
|
21
|
-
end
|
22
|
-
|
23
|
-
Then /^the number of dice should be "(.*?)"$/ do |number_of_dice|
|
24
|
-
@dice_roll.number_of_dice.should == number_of_dice.to_i
|
25
|
-
end
|
26
|
-
|
27
|
-
Then /^the sides on the dice should be "(.*?)"$/ do |sides_on_dice|
|
28
|
-
@dice_roll.sides_on_dice.should == sides_on_dice.to_i
|
29
|
-
end
|
30
|
-
|
31
|
-
Then /^the roll modifier should be "(.*?)"$/ do |roll_modifier|
|
32
|
-
@dice_roll.roll_modifier.should == roll_modifier.to_i
|
33
|
-
end
|
34
|
-
|
35
|
-
Given /^I want to roll a die with "(.*?)" sides$/ do |sides_on_die|
|
36
|
-
@die = PhyshRoller::Die.new(sides_on_die)
|
37
|
-
end
|
38
|
-
|
39
|
-
When /^I roll the die$/ do
|
40
|
-
@die.roll
|
41
|
-
end
|
42
|
-
|
43
|
-
Then /^the result should be between "(.*?)" and "(.*?)"$/ do |lower_limit, upper_limit|
|
44
|
-
@die.last_result.should be >= lower_limit.to_i
|
45
|
-
puts @die.last_result
|
46
|
-
@die.last_result.should be <= upper_limit.to_i
|
47
|
-
end
|
48
|
-
|
49
|
-
Given /^I have a dice roll string described by "(.*?)"$/ do |dice_roll_string|
|
50
|
-
@dice_roll = PhyshRoller::DiceRoll.new(dice_roll_string, output)
|
51
|
-
end
|
52
|
-
|
53
|
-
When /^I roll the set of dice$/ do
|
54
|
-
@dice_roll.roll_dice
|
55
|
-
end
|
56
|
-
|
57
|
-
Then /^I should see "(.*?)"$/ do |message|
|
58
|
-
@output.messages.should include message
|
59
|
-
end
|
60
|
-
|
61
|
-
Then /^the result should have "(.*?)"$/ do |number_of_dice|
|
62
|
-
@dice_roll.results[:dice_rolls].size.should == number_of_dice.to_i
|
63
|
-
end
|
64
|
-
|
65
|
-
Then /^each die roll should be equal to or greater than "(.*?)"$/ do |lower_limit|
|
66
|
-
@dice_roll.results[:dice_rolls].each { |roll| roll.should be >= lower_limit.to_i }
|
67
|
-
end
|
68
|
-
|
69
|
-
Then /^each die roll should be equal to or less than "(.*?)"$/ do |upper_limit|
|
70
|
-
@dice_roll.results[:dice_rolls].each { |roll| roll.should be <= upper_limit.to_i }
|
71
|
-
end
|
72
|
-
|
73
|
-
Then /^the total should be equal to or greater than "(.*?)"$/ do |lowest_total|
|
74
|
-
@dice_roll.results[:sum].should be >= lowest_total.to_i
|
75
|
-
end
|
76
|
-
|
77
|
-
Then /^the total should be equal to or less than "(.*?)"$/ do |highest_total|
|
78
|
-
@dice_roll.results[:sum].should be <= highest_total.to_i
|
79
|
-
end
|
data/features/support/env.rb
DELETED