diff --git a/lib/hydra/spec/hydra_formatter.rb b/lib/hydra/spec/hydra_formatter.rb index c31c8a5..0bf27cc 100644 --- a/lib/hydra/spec/hydra_formatter.rb +++ b/lib/hydra/spec/hydra_formatter.rb @@ -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 diff --git a/test/fixtures/write_file_with_pending_spec.rb b/test/fixtures/write_file_with_pending_spec.rb new file mode 100644 index 0000000..3399ada --- /dev/null +++ b/test/fixtures/write_file_with_pending_spec.rb @@ -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 + diff --git a/test/master_test.rb b/test/master_test.rb index 8f7acf7..18b1611 100644 --- a/test/master_test.rb +++ b/test/master_test.rb @@ -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) diff --git a/test/runner_test.rb b/test/runner_test.rb index c293a87..91d90f4 100644 --- a/test/runner_test.rb +++ b/test/runner_test.rb @@ -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 diff --git a/test/test_helper.rb b/test/test_helper.rb index b989da1..017c148 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -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