Skip to content

Commit

Permalink
Add Aslak's patch for SPEC_OPTS (new in RSpec 1.0.6)
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.caldersphere.net/svn/main/rubyforge/ci_reporter/trunk@100 b03c2d0b-2f10-0410-a2f9-fc8001506dfa
  • Loading branch information
nicksieger committed Jun 18, 2007
1 parent 8a2ce16 commit 172f0a1
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 14 deletions.
4 changes: 4 additions & 0 deletions History.txt
@@ -1,3 +1,7 @@
== 1.3.3

- Use SPEC_OPTS instead of RSPECOPTS (Aslak Hellesøy)

== 1.3.2 == 1.3.2


- Fix bug trying to modify frozen environment strings - Fix bug trying to modify frozen environment strings
Expand Down
12 changes: 8 additions & 4 deletions README.txt
Expand Up @@ -2,9 +2,7 @@ CI::Reporter is an add-on to Test::Unit and RSpec that allows you to generate XM


== Dependencies == 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. 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.

*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.


== Installation == Installation


Expand All @@ -18,7 +16,7 @@ To use CI::Reporter as a Rails plugin, first install the gem, and then install t


== Usage == Usage


CI::Reporter works best with projects that use a +Rakefile+ along with the standard <code>Rake::TestTask</code> or <code>Spec::Rake::SpecTask</code> tasks for running tests or specs, respectively. In this fashion, it hooks into <code>Test::Unit</code> 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 <code>Rake::TestTask</code> or <code>Spec::Rake::SpecTask</code> tasks for running tests or examples, respectively. In this fashion, it hooks into <code>Test::Unit</code> 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: 1. To use CI::Reporter, simply add the following lines to your Rakefile:


Expand Down Expand Up @@ -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_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. * +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 == 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 <nicksieger@gmail.com>. 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 <nicksieger@gmail.com>.
2 changes: 1 addition & 1 deletion Rakefile
Expand Up @@ -5,7 +5,7 @@ MANIFEST = FileList["History.txt", "Manifest.txt", "README.txt", "LICENSE.txt",


begin begin
require 'hoe' 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.rubyforge_name = "caldersphere"
p.url = "http://caldersphere.rubyforge.org/ci_reporter" p.url = "http://caldersphere.rubyforge.org/ci_reporter"
p.author = "Nick Sieger" p.author = "Nick Sieger"
Expand Down
9 changes: 7 additions & 2 deletions lib/ci/reporter/rake/rspec.rb
Expand Up @@ -6,9 +6,14 @@
namespace :setup do namespace :setup do
task :rspec do task :rspec do
rm_rf ENV["CI_REPORTS"] || "spec/reports" 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"] ||= ""
ENV["RSPECOPTS"] += [" --require", "#{File.dirname(__FILE__)}/rspec_loader.rb", ENV["RSPECOPTS"] += spec_opts
"--format", "CI::Reporter::RSpec"].join(" ")
end end
end end
end end
14 changes: 7 additions & 7 deletions spec/ci/reporter/rake/rake_tasks_spec.rb
Expand Up @@ -46,23 +46,23 @@ def restore_env(v)
Rake.application = @rake Rake.application = @rake
load CI_REPORTER_LIB + '/ci/reporter/rake/rspec.rb' load CI_REPORTER_LIB + '/ci/reporter/rake/rspec.rb'
save_env "CI_REPORTS" save_env "CI_REPORTS"
save_env "RSPECOPTS" save_env "SPEC_OPTS"
ENV["CI_REPORTS"] = "some-bogus-nonexistent-directory-that-wont-fail-rm_rf" ENV["CI_REPORTS"] = "some-bogus-nonexistent-directory-that-wont-fail-rm_rf"
end end
after(:each) do after(:each) do
restore_env "RSPECOPTS" restore_env "SPEC_OPTS"
restore_env "CI_REPORTS" restore_env "CI_REPORTS"
Rake.application = nil Rake.application = nil
end 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 @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 end


it "should append to ENV['RSPECOPTS'] if it already contains a value" do it "should append to ENV['SPEC_OPTS'] if it already contains a value" do
ENV["RSPECOPTS"] = "somevalue".freeze ENV["SPEC_OPTS"] = "somevalue".freeze
@rake["ci:setup:rspec"].invoke @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
end end

0 comments on commit 172f0a1

Please sign in to comment.