Permalink
Browse files

Tagging 1.5.1

git-svn-id: http://svn.caldersphere.net/svn/main/rubyforge/ci_reporter/tags/1.5.1@196 b03c2d0b-2f10-0410-a2f9-fc8001506dfa
  • Loading branch information...
1 parent f13ed9f commit 28d371d5b2ee3d5fee280ab063807c7f527249e6 @nicksieger nicksieger committed Feb 6, 2008
View
@@ -1,3 +1,15 @@
+== 1.5.1
+
+- Fix silly load-path error that some had been seeing
+
+== 1.5
+
+- Support for RSpec 1.1.1 example groups (which broke ci_reporter 1.4)
+- Change internal model to delegation instead of inheritance, allowing ci_reporter to wrap different output formatters
+- Add 'ci:setup:rspecdoc' task to output specdoc format instead of progress
+- Add support for pending examples; they will be listed in the report XML as successful, but the name will have a '(PENDING)' tag appended
+- Support for RSpec < 0.9 removed as promised; use 1.4 if you still need to use an older version of RSpec
+
== 1.4
- Test::Unit tests that fail in multiple places (setup, test method, and teardown) are now tracked (marcog)
View
@@ -30,11 +30,15 @@ end
# !@#$ no easy way to empty the default list of prerequisites
Rake::Task['default'].send :instance_variable_set, "@prerequisites", FileList[]
-task :default => :rcov
+# No RCov on JRuby at the moment
+if RUBY_PLATFORM =~ /java/
+ task :default => :spec
+else
+ task :default => :rcov
+end
Spec::Rake::SpecTask.new do |t|
- t.spec_opts ||= []
- t.spec_opts << "--diff" << "unified"
+ t.spec_opts = ["--diff", "unified"]
end
Spec::Rake::SpecTask.new("spec:rcov") do |t|
@@ -44,7 +48,7 @@ end
RCov::VerifyTask.new(:rcov) do |t|
# Can't get threshold up to 100 until the RSpec < 1.0 compatibility
# code is dropped
- t.threshold = 97
+ t.threshold = 99
t.require_exact_threshold = false
end
task "spec:rcov" do
@@ -53,6 +57,7 @@ end
task :rcov => "spec:rcov"
task :generate_output do
+ rm_f "acceptance/reports/*.xml"
ENV['CI_REPORTS'] = "acceptance/reports"
begin
`ruby -Ilib acceptance/test_unit_example_test.rb` rescue nil
@@ -7,4 +7,12 @@
it "should fail" do
violated
end
+
+ it "should be pending"
+
+ describe "nested" do
+ it "should succeed" do
+ true.should be_true
+ end
+ end
end
@@ -34,8 +34,9 @@
end
describe "RSpec acceptance" do
- it "should generate one XML file" do
+ it "should generate two XML files" do
File.exist?(File.join(REPORTS_DIR, 'SPEC-RSpec-example.xml')).should == true
+ File.exist?(File.join(REPORTS_DIR, 'SPEC-RSpec-example-nested.xml')).should == true
end
it "should have two tests and one failure" do
@@ -44,10 +45,20 @@
end
doc.root.attributes["errors"].should == "0"
doc.root.attributes["failures"].should == "1"
- doc.root.attributes["tests"].should == "2"
- doc.root.elements.to_a("/testsuite/testcase").size.should == 2
+ doc.root.attributes["tests"].should == "3"
+ doc.root.elements.to_a("/testsuite/testcase").size.should == 3
failures = doc.root.elements.to_a("/testsuite/testcase/failure")
failures.size.should == 1
failures.first.attributes["type"].should == "Spec::Expectations::ExpectationNotMetError"
end
+
+ it "should have one test in the nested example report" do
+ doc = File.open(File.join(REPORTS_DIR, 'SPEC-RSpec-example-nested.xml')) do |f|
+ REXML::Document.new(f)
+ end
+ doc.root.attributes["errors"].should == "0"
+ doc.root.attributes["failures"].should == "0"
+ doc.root.attributes["tests"].should == "1"
+ doc.root.elements.to_a("/testsuite/testcase").size.should == 1
+ end
end
@@ -4,13 +4,20 @@
namespace :ci do
namespace :setup do
- task :rspec do
+ task :spec_report_cleanup do
rm_rf ENV["CI_REPORTS"] || "spec/reports"
+ end
+
+ task :rspec => :spec_report_cleanup do
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']} #{spec_opts}"
+ end
+
+ task :rspecdoc => :spec_report_cleanup do
+ spec_opts = ["--require", "#{File.dirname(__FILE__)}/rspec_loader.rb",
+ "--format", "CI::Reporter::RSpecDoc"].join(" ")
+ ENV["SPEC_OPTS"] = "#{ENV['SPEC_OPTS']} #{spec_opts}"
end
end
end
@@ -2,5 +2,5 @@
# See the file LICENSE.txt included with the distribution for
# software license details.
-$: << File.dirname(__FILE__) + "/../../../lib"
+$: << File.dirname(__FILE__) + "/../../.."
require 'ci/reporter/rspec'
@@ -2,7 +2,7 @@
# See the file LICENSE.txt included with the distribution for
# software license details.
-$: << File.dirname(__FILE__) + "/../../../lib"
+$: << File.dirname(__FILE__) + "/../../.."
require 'ci/reporter/test_unit'
module Test #:nodoc:all
View
@@ -3,13 +3,19 @@
# software license details.
require 'ci/reporter/core'
+tried_gem = false
begin
- gem 'rspec'
-rescue Gem::LoadError
- # Needed for non-gem RSpec (e.g., reporting on RSpec's own specs);
- # if spec isn't found, the next require will blow up
+ require 'spec'
+ require 'spec/runner/formatter/progress_bar_formatter'
+ require 'spec/runner/formatter/specdoc_formatter'
+rescue LoadError
+ unless tried_gem
+ tried_gem = true
+ require 'rubygems'
+ gem 'rspec'
+ retry
+ end
end
-require 'spec'
module CI
module Reporter
@@ -33,101 +39,78 @@ def location() @failure.exception.backtrace.join("\n") end
end
# Custom +RSpec+ formatter used to hook into the spec runs and capture results.
- class RSpec < Spec::Runner::Formatter::ProgressBarFormatter
- def initialize(output, dry_run=false, colour=false, report_mgr=nil)
- if respond_to? :dry_run=
- super(output)
- self.dry_run=dry_run
- self.colour=colour
- else
- super(output, dry_run, colour)
- end
- @report_manager = report_mgr || ReportManager.new("spec")
+ class RSpec < Spec::Runner::Formatter::BaseFormatter
+ attr_accessor :report_manager
+ attr_accessor :formatter
+ def initialize(*args)
+ super
+ @formatter ||= Spec::Runner::Formatter::ProgressBarFormatter.new(*args)
+ @report_manager = ReportManager.new("spec")
@suite = nil
end
- def deprecated
- unless @warned
- require 'ci/reporter/version'
- warn "warning: use of RSpec < 0.9 with CI::Reporter #{CI::Reporter::VERSION} is deprecated;"
- warn "a future version will not be compatible."
- end
- @warned = true
- end
-
def start(spec_count)
- super
+ @formatter.start(spec_count)
end
- # Pre-0.9 hook
- def add_context(name, first)
- super
- deprecated
- new_suite(name)
- end
-
- # Post-0.9 hook
def add_behaviour(name)
- super
+ @formatter.add_behaviour(name)
new_suite(name)
end
- # Pre-0.9 hook
- def spec_started(name)
- super
- deprecated
- case_started(name)
+ def add_example_group(example_group)
+ @formatter.add_example_group(example_group)
+ new_suite(example_group.description)
end
- # Post-0.9 hook
def example_started(name)
- super
- case_started(name)
- end
-
- # Pre-0.9 hook
- def spec_failed(name, counter, failure)
- super
- deprecated
- case_failed(name, counter, failure)
+ @formatter.example_started(name)
+ spec = TestCase.new name
+ @suite.testcases << spec
+ spec.start
end
- # Post-0.9 hook
def example_failed(name, counter, failure)
- super
- case_failed(name, counter, failure)
+ @formatter.example_failed(name, counter, failure)
+ spec = @suite.testcases.last
+ spec.finish
+ spec.failures << RSpecFailure.new(failure)
end
- # Pre-0.9 hook
- def spec_passed(name)
- super
- deprecated
- case_passed(name)
+ def example_passed(name)
+ @formatter.example_passed(name)
+ spec = @suite.testcases.last
+ spec.finish
end
- # Post-0.9 hook
- def example_passed(name)
- super
- case_passed(name)
+ def example_pending(*args)
+ @formatter.example_pending(*args)
+ spec = @suite.testcases.last
+ spec.finish
+ spec.name = "#{spec.name} (PENDING)"
end
def start_dump
- super
+ @formatter.start_dump
end
- def dump_failure(counter, failure)
- super
+ def dump_failure(*args)
+ @formatter.dump_failure(*args)
end
- def dump_summary(duration, example_count, failure_count, not_implemented_count = 0)
- begin
- super
- rescue ArgumentError
- super(duration, example_count, failure_count)
- end
+ def dump_summary(*args)
+ @formatter.dump_summary(*args)
write_report
end
+ def dump_pending
+ @formatter.dump_pending
+ end
+
+ def close
+ @formatter.close
+ end
+
private
def write_report
@suite.finish
@@ -139,22 +122,12 @@ def new_suite(name)
@suite = TestSuite.new name
@suite.start
end
+ end
- def case_started(name)
- spec = TestCase.new name
- @suite.testcases << spec
- spec.start
- end
-
- def case_failed(name, counter, failure)
- spec = @suite.testcases.last
- spec.finish
- spec.failures << RSpecFailure.new(failure)
- end
-
- def case_passed(name)
- spec = @suite.testcases.last
- spec.finish
+ class RSpecDoc < RSpec
+ def initialize(*args)
+ @formatter = Spec::Runner::Formatter::SpecdocFormatter.new(*args)
+ super
end
end
end
@@ -1,5 +1,5 @@
module CI
module Reporter
- VERSION = "1.4"
+ VERSION = "1.5.1"
end
end
@@ -59,6 +59,11 @@ def restore_env(v)
@rake["ci:setup:rspec"].invoke
ENV["SPEC_OPTS"].should =~ /--require.*rspec_loader.*--format.*CI::Reporter::RSpec/
end
+
+ it "should set ENV['SPEC_OPTS'] to include rspec doc formatter if task is ci:setup:rspecdoc" do
+ @rake["ci:setup:rspecdoc"].invoke
+ ENV["SPEC_OPTS"].should =~ /--require.*rspec_loader.*--format.*CI::Reporter::RSpecDoc/
+ end
it "should append to ENV['SPEC_OPTS'] if it already contains a value" do
ENV["SPEC_OPTS"] = "somevalue".freeze
Oops, something went wrong.

0 comments on commit 28d371d

Please sign in to comment.