Skip to content

Commit

Permalink
Add specs for future DiceParser class.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam Rose committed Jun 12, 2012
1 parent 7c1b0e3 commit e233683
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Gemfile
@@ -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
12 changes: 12 additions & 0 deletions Gemfile.lock
Expand Up @@ -2,9 +2,21 @@ GEM
remote: http://rubygems.org/ remote: http://rubygems.org/
specs: specs:
Ruby-IRC (1.0.13) Ruby-IRC (1.0.13)
diff-lcs (1.1.3)
rake (0.9.2.2)
rspec (2.10.0)
rspec-core (~> 2.10.0)
rspec-expectations (~> 2.10.0)
rspec-mocks (~> 2.10.0)
rspec-core (2.10.1)
rspec-expectations (2.10.0)
diff-lcs (~> 1.1.3)
rspec-mocks (2.10.1)


PLATFORMS PLATFORMS
ruby ruby


DEPENDENCIES DEPENDENCIES
Ruby-IRC Ruby-IRC
rake
rspec
8 changes: 8 additions & 0 deletions Rakefile
@@ -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
15 changes: 15 additions & 0 deletions spec/parser_spec.rb
@@ -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
4 changes: 4 additions & 0 deletions spec/spec_helper.rb
@@ -0,0 +1,4 @@
require File.dirname(__FILE__) + '/../lib/dudley'

# Include support files
Dir[File.dirname(__FILE__) + '/support/*.rb'].each { |file| require file }

0 comments on commit e233683

Please sign in to comment.