diff --git a/web/build b/web/build index d529624da..e0d0ae888 100755 --- a/web/build +++ b/web/build @@ -57,7 +57,17 @@ if [ -z $SKIP_TESTS ]; then bundle exec rspec if [ "$?" = "0" ]; then echo "success: ran rspec tests" - else + elif [ "$?" = "20" ]; then + echo "retrying once more" + bundle exec rspec + + if [ "$?" = "0" ]; then + echo "success: ran rspec tests" + else + echo "running rspec tests for the second time failed." + exit 1 + fi + else echo "running rspec tests failed." exit 1 fi diff --git a/web/spec/spec_helper.rb b/web/spec/spec_helper.rb index be74fa3c9..298ff151a 100644 --- a/web/spec/spec_helper.rb +++ b/web/spec/spec_helper.rb @@ -19,38 +19,26 @@ db_config = YAML::load(File.open('config/database.yml'))["test"] # initialize ActiveRecord's db connection\ SpecDb::recreate_database(db_config) ActiveRecord::Base.establish_connection(YAML::load(File.open('config/database.yml'))["test"]) -#puts "0" require 'jam_ruby' # uncomment this to see active record logs # ActiveRecord::Base.logger = Logger.new(STDOUT) if defined?(ActiveRecord::Base) - -#puts "1" - include JamRuby - -#puts "2" # put ActionMailer into test mode ActionMailer::Base.delivery_method = :test - -#puts "3" RecordedTrack.observers.disable :all # only a few tests want this observer active -#puts "4" # a way to kill tests if they aren't running. capybara is hanging intermittently, I think - tests_started = false -#Thread.new { -# puts "thread starting" -# sleep 30 -# puts "thread waking" -# unless tests_started - # puts "tests are hung. exiting..." - # exit 20 - # end -#} +Thread.new { + sleep 30 + unless tests_started + puts "tests are hung. exiting..." + exit! 20 + end +} Spork.prefork do # Loading more in this block will cause your tests to run faster. However,