Skip to content

Commit

Permalink
Infrastructure for Cucumber integration.
Browse files Browse the repository at this point in the history
Now I just need to figure out how to implement CI::Reporter::Cucumber so that it reports the right information. :-)
  • Loading branch information
mathie committed May 1, 2009
1 parent 509a989 commit 8b884ec
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 0 deletions.
28 changes: 28 additions & 0 deletions lib/ci/reporter/cucumber.rb
@@ -0,0 +1,28 @@
# (c) Copyright 2006-2009 Nick Sieger <nicksieger@gmail.com>
# See the file LICENSE.txt included with the distribution for
# software license details.

require 'ci/reporter/core'
tried_gem = false
begin
require 'cucumber'
require 'cucumber/formatter/progress'
require 'cucumber/formatter/pretty'
rescue LoadError
unless tried_gem
tried_gem = true
require 'rubygems'
gem 'cucumber'
retry
end
end

module CI
module Reporter
class Cucumber < ::Cucumber::Formatter::Progress
end

class CucumberDoc < ::Cucumber::Formatter::Pretty
end
end
end
23 changes: 23 additions & 0 deletions lib/ci/reporter/rake/cucumber.rb
@@ -0,0 +1,23 @@
# (c) Copyright 2006-2007 Nick Sieger <nicksieger@gmail.com>
# See the file LICENSE.txt included with the distribution for
# software license details.

namespace :ci do
namespace :setup do
task :cucumber_report_cleanup do
rm_rf ENV["CI_REPORTS"] || "features/reports"
end

task :cucumber => :cucumber_report_cleanup do
spec_opts = ["--require", "#{File.dirname(__FILE__)}/cucumber_loader.rb",
"--format", "CI::Reporter::Cucumber"].join(" ")
ENV["CUCUMBER_OPTS"] = "#{ENV['CUCUMBER_OPTS']} #{spec_opts}"
end

task :cucumberdoc => :cucumber_report_cleanup do
spec_opts = ["--require", "#{File.dirname(__FILE__)}/cucumber_loader.rb",
"--format", "CI::Reporter::CucumberDoc"].join(" ")
ENV["CUCUMBER_OPTS"] = "#{ENV['CUCUMBER_OPTS']} #{spec_opts}"
end
end
end
6 changes: 6 additions & 0 deletions lib/ci/reporter/rake/cucumber_loader.rb
@@ -0,0 +1,6 @@
# (c) Copyright 2006-2007 Nick Sieger <nicksieger@gmail.com>
# See the file LICENSE.txt included with the distribution for
# software license details.

$: << File.dirname(__FILE__) + "/../../.."
require 'ci/reporter/cucumber'
1 change: 1 addition & 0 deletions stub.rake
Expand Up @@ -9,5 +9,6 @@
# #


load File.dirname(__FILE__) + '/lib/ci/reporter/rake/rspec.rb' load File.dirname(__FILE__) + '/lib/ci/reporter/rake/rspec.rb'
load File.dirname(__FILE__) + '/lib/ci/reporter/rake/cucumber.rb'
load File.dirname(__FILE__) + '/lib/ci/reporter/rake/test_unit.rb' load File.dirname(__FILE__) + '/lib/ci/reporter/rake/test_unit.rb'
load 'Rakefile' load 'Rakefile'
2 changes: 2 additions & 0 deletions tasks/ci_reporter.rake
Expand Up @@ -8,9 +8,11 @@ rescue Gem::LoadError
$: << File.dirname(__FILE__) + "/../lib" $: << File.dirname(__FILE__) + "/../lib"
end end
require 'ci/reporter/rake/rspec' require 'ci/reporter/rake/rspec'
require 'ci/reporter/rake/cucumber'
require 'ci/reporter/rake/test_unit' require 'ci/reporter/rake/test_unit'


namespace :ci do namespace :ci do
task :setup_rspec => "ci:setup:rspec" task :setup_rspec => "ci:setup:rspec"
task :setup_cucumber => "ci:setup:cucumber"
task :setup_testunit => "ci:setup:testunit" task :setup_testunit => "ci:setup:testunit"
end end

0 comments on commit 8b884ec

Please sign in to comment.