Permalink
Browse files

Add specs for future DiceParser class.

  • Loading branch information...
1 parent 7c1b0e3 commit e2336835e7cc1d5117ddc7c80d97ef778bf5621e @samwho samwho committed Jun 12, 2012
Showing with 48 additions and 1 deletion.
  1. +9 −1 Gemfile
  2. +12 −0 Gemfile.lock
  3. +8 −0 Rakefile
  4. +15 −0 spec/parser_spec.rb
  5. +4 −0 spec/spec_helper.rb
View
10 Gemfile
@@ -1,3 +1,11 @@
source :rubygems
-gem "Ruby-IRC"
+gem 'Ruby-IRC'
+
+group :testing do
+ gem 'rspec'
+end
+
+group :development do
+ gem 'rake'
+end
View
@@ -2,9 +2,21 @@ GEM
remote: http://rubygems.org/
specs:
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
ruby
DEPENDENCIES
Ruby-IRC
+ rake
+ rspec
View
@@ -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
View
@@ -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
View
@@ -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.