Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add specs for future DiceParser class.
- Loading branch information
Sam Rose
committed
Jun 12, 2012
1 parent
7c1b0e3
commit e233683
Showing
5 changed files
with
48 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,3 +1,11 @@ | |||
source :rubygems | source :rubygems | ||
|
|
||
gem "Ruby-IRC" | gem 'Ruby-IRC' | ||
|
|||
group :testing do | |||
gem 'rspec' | |||
end | |||
|
|||
group :development do | |||
gem 'rake' | |||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,8 @@ | |||
require 'rspec/core/rake_task' | |||
|
|||
task :default => [:test] | |||
|
|||
desc "Run all tests" | |||
RSpec::Core::RakeTask.new(:test) do |t| | |||
t.rspec_opts = '-cfs' | |||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,15 @@ | |||
require 'spec_helper' | |||
|
|||
describe "Dudley::DiceParser" do | |||
it "should correctly parse simply dice rolls" do | |||
result = Dudley::DiceParser.parse("1d6") | |||
result.should be >= 1 | |||
result.should be <= 6 | |||
end | |||
|
|||
it "should correctly parse simply dice rolls with modifier" do | |||
result = Dudley::DiceParser.parse("1d6 + 1") | |||
result.should be >= 2 | |||
result.should be <= 7 | |||
end | |||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,4 @@ | |||
require File.dirname(__FILE__) + '/../lib/dudley' | |||
|
|||
# Include support files | |||
Dir[File.dirname(__FILE__) + '/support/*.rb'].each { |file| require file } |