Bugfix: Rspec pending examples should not result in specs reported as failing

Refs http://github.com/ngauthier/hydra/issues/issue/7
This commit is contained in:
Laust Rud Jacobsen 2010-04-20 12:33:28 +02:00
parent 9068de745d
commit f8cebe3b59
5 changed files with 42 additions and 0 deletions

View File

@ -6,6 +6,10 @@ module Spec
# Stifle the post-test summary
def dump_summary(duration, example, failure, pending)
end
# Stifle the output of pending examples
def example_pending(*args)
end
end
end
end

View File

@ -0,0 +1,11 @@
require 'tmpdir'
require 'spec'
context "file writing" do
it "writes to a file" do
File.open(File.join(Dir.tmpdir, 'hydra_test.txt'), 'a') do |f|
f.write "HYDRA"
end
end
it 'could do so much more' # pending spec
end

View File

@ -20,6 +20,17 @@ class MasterTest < Test::Unit::TestCase
assert_equal "HYDRA", File.read(target_file)
end
should "run a spec with pending examples" do
progress_bar = Hydra::Listener::ProgressBar.new(StringIO.new)
Hydra::Master.new(
:files => [rspec_file_with_pending],
:listeners => [progress_bar]
)
assert File.exists?(target_file)
assert_equal "HYDRA", File.read(target_file)
assert_equal false, progress_bar.instance_variable_get('@errors')
end
should "generate a report" do
Hydra::Master.new(:files => [test_file])
assert File.exists?(target_file)

View File

@ -51,6 +51,18 @@ class RunnerTest < Test::Unit::TestCase
assert !File.exists?(target_file)
end
should "run rspec tests with pending examples" do
runner = Hydra::Runner.new(:io => File.new('/dev/null', 'w'))
assert File.exists?(rspec_file_with_pending)
runner.run_file(rspec_file_with_pending)
assert File.exists?(target_file)
assert_equal "HYDRA", File.read(target_file)
FileUtils.rm_f(target_file)
end
should "run two cucumber tests" do
# because of all the crap cucumber pulls in
# we run this in a fork to not contaminate

View File

@ -31,6 +31,10 @@ class Test::Unit::TestCase
File.expand_path(File.join(File.dirname(__FILE__), 'fixtures', 'write_file_alternate_spec.rb'))
end
def rspec_file_with_pending
File.expand_path(File.join(File.dirname(__FILE__), 'fixtures', 'write_file_with_pending_spec.rb'))
end
def cucumber_feature_file
File.expand_path(File.join(File.dirname(__FILE__), 'fixtures', 'features', 'write_file.feature'))
end