Permalink
Browse files

Running suite while ignoring 'warning: useless use of' warnings

  • Loading branch information...
1 parent 4274507 commit 5265af05e4114b5c482f322abf0117748901c9b1 Brian Takita committed Oct 19, 2009
Showing with 20 additions and 3 deletions.
  1. +20 −3 spec/spec_suite.rb
View
@@ -1,20 +1,37 @@
+require "rubygems"
+require "session"
+
class ExampleSuite
+ attr_reader :bash
+ def initialize
+ @bash = Session::Bash.new
+ end
+
def run
run_core_examples
run_rspec_examples
run_test_unit_examples
end
def run_core_examples
- system("ruby -W #{dir}/core_spec_suite.rb #{spec_opts}") || raise("Core suite Failed")
+ run_suite("#{dir}/core_spec_suite.rb #{spec_opts}") || raise("Core suite Failed")
end
def run_rspec_examples
- system("ruby -W #{dir}/rspec_spec_suite.rb #{spec_opts}") || raise("Rspec suite Failed")
+ run_suite("#{dir}/rspec_spec_suite.rb #{spec_opts}") || raise("Rspec suite Failed")
end
def run_test_unit_examples
- system("ruby -W #{dir}/test_unit_spec_suite.rb") || raise("Test::Unit suite Failed")
+ run_suite("#{dir}/test_unit_spec_suite.rb") || raise("Test::Unit suite Failed")
+ end
+
+ def run_suite(path)
+ # From http://www.eglug.org/node/946
+ bash.execute "exec 3>&1", :out => STDOUT, :err => STDERR
+ bash.execute "ruby -W #{path} 2>&1 >&3 3>&- | grep -v 'warning: useless use of' 3>&-; STATUS=${PIPESTATUS[0]}", :out => STDOUT, :err => STDERR
+ status = bash.execute("echo $STATUS")[0].to_s.strip.to_i
+ bash.execute "exec 3>&-", :out => STDOUT, :err => STDERR
+ return status == 0
end
def spec_opts

0 comments on commit 5265af0

Please sign in to comment.