test/helpers.rb in foca-integrity-0.1.9.1 vs test/helpers.rb in foca-integrity-0.1.9.2

- old
+ new

@@ -1,29 +1,27 @@ -$:.unshift File.dirname(__FILE__) + "/../lib", File.dirname(__FILE__), - File.dirname(__FILE__) + "/../vendor/webrat/lib" +$:.unshift File.dirname(__FILE__) + "/../lib", File.dirname(__FILE__) %w(test/unit context pending matchy storyteller webrat/sinatra rr mocha -test/zentest_assertions dm-sweatshop).each { |dependency| begin require dependency - rescue LoadError + rescue LoadError => e puts "You're missing some gems required to run the tests." - puts "Please run `rake test:install_dependencies`" - puts "You'll probably need to run that command as root or with sudo." + puts "Please run `rake test:setup`" + puts "NOTE: You'll probably need to run that command as root or with sudo." puts "Thanks :)" puts - exit 1 + raise end } begin require "ruby-debug" @@ -36,9 +34,24 @@ require "integrity/notifier/test/fixtures" module TestHelper def ignore_logs! Integrity.config[:log] = "/tmp/integrity.test.log" + end + + def capture_stdout + output = StringIO.new + $stdout = output + yield + $stdout = STDOUT + output + end + + def silence_warnings + $VERBOSE, v = nil, $VERBOSE + yield + ensure + $VERBOSE = v end end class Test::Unit::TestCase class << self