Skip to content
Browse files

Add in some tests for the Cucumber setup rake task.

Wow.  People test their Rakefiles?  Never thought to do that before...
  • Loading branch information...
1 parent 8b884ec commit 9f243152681bf67a8d7bb9c825be806ee7ffeaa3 @mathie mathie committed May 1, 2009
Showing with 32 additions and 0 deletions.
  1. +32 −0 spec/ci/reporter/rake/rake_tasks_spec.rb
View
32 spec/ci/reporter/rake/rake_tasks_spec.rb
@@ -71,3 +71,35 @@ def restore_env(v)
ENV["SPEC_OPTS"].should =~ /somevalue.*--require.*rspec_loader.*--format.*CI::Reporter::RSpec/
end
end
+
+describe "ci_reporter ci:setup:cucumber task" do
+ before(:each) do
+ @rake = Rake::Application.new
+ Rake.application = @rake
+ load CI_REPORTER_LIB + '/ci/reporter/rake/cucumber.rb'
+ save_env "CI_REPORTS"
+ save_env "CUCUMBER_OPTS"
+ ENV["CI_REPORTS"] = "some-bogus-nonexistent-directory-that-wont-fail-rm_rf"
+ end
+ after(:each) do
+ restore_env "CUCUMBER_OPTS"
+ restore_env "CI_REPORTS"
+ Rake.application = nil
+ end
+
+ it "should set ENV['CUCUMBER_OPTS'] to include cucumber formatter args" do
+ @rake["ci:setup:cucumber"].invoke
+ ENV["CUCUMBER_OPTS"].should =~ /--require.*cucumber_loader.*--format.*CI::Reporter::Cucumber/
+ end
+
+ it "should set ENV['CUCUMBER_OPTS'] to include cucumber doc formatter if task is ci:setup:cucumberdoc" do
+ @rake["ci:setup:cucumberdoc"].invoke
+ ENV["CUCUMBER_OPTS"].should =~ /--require.*cucumber_loader.*--format.*CI::Reporter::CucumberDoc/
+ end
+
+ it "should append to ENV['CUCUMBER_OPTS'] if it already contains a value" do
+ ENV["CUCUMBER_OPTS"] = "somevalue".freeze
+ @rake["ci:setup:cucumber"].invoke
+ ENV["CUCUMBER_OPTS"].should =~ /somevalue.*--require.*cucumber_loader.*--format.*CI::Reporter::Cucumber/
+ end
+end

0 comments on commit 9f24315

Please sign in to comment.
Something went wrong with that request. Please try again.