Skip to content

Commit

Permalink
generating width and cell size
Browse files Browse the repository at this point in the history
  • Loading branch information
dudadornelles committed Jun 24, 2011
1 parent ab57b16 commit 1ceb5fe
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Gemfile
@@ -1,4 +1,6 @@
source :rubygems
gem 'rake'
gem 'rspec'
gem 'theseus'
gem 'ruby-doom'
gem 'ruby-debug19'
17 changes: 17 additions & 0 deletions Gemfile.lock
@@ -1,8 +1,13 @@
GEM
remote: http://rubygems.org/
specs:
archive-tar-minitar (0.5.2)
chunky_png (0.12.0)
columnize (0.3.3)
diff-lcs (1.1.2)
linecache19 (0.5.12)
ruby_core_source (>= 0.1.4)
rake (0.9.2)
rspec (2.6.0)
rspec-core (~> 2.6.0)
rspec-expectations (~> 2.6.0)
Expand All @@ -11,14 +16,26 @@ GEM
rspec-expectations (2.6.0)
diff-lcs (~> 1.1.2)
rspec-mocks (2.6.0)
ruby-debug-base19 (0.11.25)
columnize (>= 0.3.1)
linecache19 (>= 0.5.11)
ruby_core_source (>= 0.1.4)
ruby-debug19 (0.11.6)
columnize (>= 0.3.1)
linecache19 (>= 0.5.11)
ruby-debug-base19 (>= 0.11.19)
ruby-doom (0.9.0)
ruby_core_source (0.1.5)
archive-tar-minitar (>= 0.5.2)
theseus (1.0.2)
chunky_png (~> 0.12.0)

PLATFORMS
ruby

DEPENDENCIES
rake
rspec
ruby-debug19
ruby-doom
theseus
6 changes: 6 additions & 0 deletions Rakefile
@@ -0,0 +1,6 @@
require 'rspec/core/rake_task'

RSpec::Core::RakeTask.new(:spec)

task :default => [:spec]

25 changes: 25 additions & 0 deletions lib/doom_formatter.rb
@@ -0,0 +1,25 @@
require 'rspec/core/formatters/base_text_formatter'

class DoomFormatter < RSpec::Core::Formatters::BaseTextFormatter

def initialize
super nil
@count = 0
end
def example_passed(example)
@count += 1
end

def example_failed(example)
@count += 1
end

def example_pending(example)
@count += 1
end

def generate
"-w #{@count} -c #{@duration}"
end

end
21 changes: 21 additions & 0 deletions spec/doom_formatter_spec.rb
@@ -0,0 +1,21 @@
require 'spec_helper'

describe DoomFormatter do

let (:formatter) { DoomFormatter.new }

it "should generate a the size of the maze based on the number of test" do
10.times do
formatter.example_failed(nil)
formatter.example_pending(nil)
formatter.example_passed(nil)
end
formatter.generate.should match(/-w 30/)
end

it "should generate the cell size based on the duration" do
formatter.dump_summary 10, 0, 0, 0
formatter.generate.should match(/-c 10/)
end
end

2 changes: 2 additions & 0 deletions spec/spec_helper.rb
@@ -0,0 +1,2 @@
require File.join(File.dirname(__FILE__), '/../lib/doom_formatter')

0 comments on commit 1ceb5fe

Please sign in to comment.