From 172f0a1833e665c41be6f2fcbaaf02ebc6032257 Mon Sep 17 00:00:00 2001 From: Nick Date: Mon, 18 Jun 2007 17:06:39 +0000 Subject: [PATCH] Add Aslak's patch for SPEC_OPTS (new in RSpec 1.0.6) git-svn-id: http://svn.caldersphere.net/svn/main/rubyforge/ci_reporter/trunk@100 b03c2d0b-2f10-0410-a2f9-fc8001506dfa --- History.txt | 4 ++++ README.txt | 12 ++++++++---- Rakefile | 2 +- lib/ci/reporter/rake/rspec.rb | 9 +++++++-- spec/ci/reporter/rake/rake_tasks_spec.rb | 14 +++++++------- 5 files changed, 27 insertions(+), 14 deletions(-) diff --git a/History.txt b/History.txt index bd2b9b5..18ff2a7 100644 --- a/History.txt +++ b/History.txt @@ -1,3 +1,7 @@ +== 1.3.3 + +- Use SPEC_OPTS instead of RSPECOPTS (Aslak Hellesøy) + == 1.3.2 - Fix bug trying to modify frozen environment strings diff --git a/README.txt b/README.txt index f541b51..0767819 100644 --- a/README.txt +++ b/README.txt @@ -2,9 +2,7 @@ CI::Reporter is an add-on to Test::Unit and RSpec that allows you to generate XM == Dependencies -CI::Reporter has one required dependency on Builder, but since many will have a viable version of Builder via Rails' ActiveSupport gem, Builder is not a direct dependency of the project at the moment. Instead, ensure that you have either the +builder+ or +activesupport+ gem installed before continuing. - -*NOTE*: As of this release, CI::Reporter is only compatible with RSpec up through version 0.8.2. The 0.9 series has introduced an incompatibility that has not been rectified yet. +CI::Reporter has one required dependency on Builder, but since many will have a viable version of Builder via Rails' ActiveSupport gem, Builder is not a direct dependency of the project at the moment. Instead, ensure that you have either the +builder+ or +activesupport+ gem installed before continuing. CI::Reporter will raise an exception at runtime if it cannot locate Builder. == Installation @@ -18,7 +16,7 @@ To use CI::Reporter as a Rails plugin, first install the gem, and then install t == Usage -CI::Reporter works best with projects that use a +Rakefile+ along with the standard Rake::TestTask or Spec::Rake::SpecTask tasks for running tests or specs, respectively. In this fashion, it hooks into Test::Unit or +RSpec+ using environment variables recognized by these custom tasks to inject the CI::Reporter code into the test or spec runs. If you're using the Rails plugin, step 1 is unnecessary; skip to step 2. +CI::Reporter works best with projects that use a +Rakefile+ along with the standard Rake::TestTask or Spec::Rake::SpecTask tasks for running tests or examples, respectively. In this fashion, it hooks into Test::Unit or +RSpec+ using environment variables recognized by these custom tasks to inject the CI::Reporter code into the test or spec runs. If you're using the Rails plugin, step 1 is unnecessary; skip to step 2. 1. To use CI::Reporter, simply add the following lines to your Rakefile: @@ -49,6 +47,12 @@ There's a bit of a chicken and egg problem because rubygems needs to be loaded b * +CI_REPORTS+: if set, points to a directory where report files will be written. * +CI_CAPTURE+: if set to value "off", stdout/stderr capture will be disabled. +== Source + +CI::Reporter source is not currently located in Rubyforge's SVN. To get the source: + + svn co http://svn.caldersphere.net/svn/main/rubyforge/ci_reporter/trunk ci_reporter + == License This software is released under an MIT license. For details, see the LICENSE.txt file included with the distribution. The software is copyright (c) 2006-2007 Nick Sieger . \ No newline at end of file diff --git a/Rakefile b/Rakefile index 3c9c5ae..a532e75 100644 --- a/Rakefile +++ b/Rakefile @@ -5,7 +5,7 @@ MANIFEST = FileList["History.txt", "Manifest.txt", "README.txt", "LICENSE.txt", begin require 'hoe' - hoe = Hoe.new("ci_reporter", "1.3.2") do |p| + hoe = Hoe.new("ci_reporter", "1.3.3") do |p| p.rubyforge_name = "caldersphere" p.url = "http://caldersphere.rubyforge.org/ci_reporter" p.author = "Nick Sieger" diff --git a/lib/ci/reporter/rake/rspec.rb b/lib/ci/reporter/rake/rspec.rb index 396d232..e10c384 100644 --- a/lib/ci/reporter/rake/rspec.rb +++ b/lib/ci/reporter/rake/rspec.rb @@ -6,9 +6,14 @@ namespace :setup do task :rspec do rm_rf ENV["CI_REPORTS"] || "spec/reports" + + spec_opts = ["--require", "#{File.dirname(__FILE__)}/rspec_loader.rb", + "--format", "CI::Reporter::RSpec"].join(" ") + ENV["SPEC_OPTS"] ||= "" + ENV["SPEC_OPTS"] += spec_opts + # Pre RSpec 1.0.6 ENV["RSPECOPTS"] ||= "" - ENV["RSPECOPTS"] += [" --require", "#{File.dirname(__FILE__)}/rspec_loader.rb", - "--format", "CI::Reporter::RSpec"].join(" ") + ENV["RSPECOPTS"] += spec_opts end end end diff --git a/spec/ci/reporter/rake/rake_tasks_spec.rb b/spec/ci/reporter/rake/rake_tasks_spec.rb index 09132a8..cb96c6d 100644 --- a/spec/ci/reporter/rake/rake_tasks_spec.rb +++ b/spec/ci/reporter/rake/rake_tasks_spec.rb @@ -46,23 +46,23 @@ def restore_env(v) Rake.application = @rake load CI_REPORTER_LIB + '/ci/reporter/rake/rspec.rb' save_env "CI_REPORTS" - save_env "RSPECOPTS" + save_env "SPEC_OPTS" ENV["CI_REPORTS"] = "some-bogus-nonexistent-directory-that-wont-fail-rm_rf" end after(:each) do - restore_env "RSPECOPTS" + restore_env "SPEC_OPTS" restore_env "CI_REPORTS" Rake.application = nil end - it "should set ENV['RSPECOPTS'] to include rspec formatter args" do + it "should set ENV['SPEC_OPTS'] to include rspec formatter args" do @rake["ci:setup:rspec"].invoke - ENV["RSPECOPTS"].should =~ /--require.*rspec_loader.*--format.*CI::Reporter::RSpec/ + ENV["SPEC_OPTS"].should =~ /--require.*rspec_loader.*--format.*CI::Reporter::RSpec/ end - it "should append to ENV['RSPECOPTS'] if it already contains a value" do - ENV["RSPECOPTS"] = "somevalue".freeze + it "should append to ENV['SPEC_OPTS'] if it already contains a value" do + ENV["SPEC_OPTS"] = "somevalue".freeze @rake["ci:setup:rspec"].invoke - ENV["RSPECOPTS"].should =~ /somevalue.*--require.*rspec_loader.*--format.*CI::Reporter::RSpec/ + ENV["SPEC_OPTS"].should =~ /somevalue.*--require.*rspec_loader.*--format.*CI::Reporter::RSpec/ end end