* adding code to try web tests 2x if a hang is detected

This commit is contained in:
Seth Call 2014-02-20 23:22:31 +00:00
parent a6b3abdc3a
commit 27afed64dc
2 changed files with 18 additions and 20 deletions

View File

@ -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

View File

@ -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,