script/functions.sh in rspec-legacy_formatters-1.0.1 vs script/functions.sh in rspec-legacy_formatters-1.0.2
- old
+ new
@@ -57,24 +57,26 @@
else
return 1
fi
}
+function rspec_version_defined {
+ if [ "$RSPEC_VERSION" != "" ]; then
+ return 0
+ else
+ return 1
+ fi
+}
+
function documentation_enforced {
if [ -x ./bin/yard ]; then
return 0
else
return 1
fi
}
-function clone_repo {
- if [ ! -d $1 ]; then # don't clone if the dir is already there
- travis_retry git clone git://github.com/rspec/$1 --depth 1 --branch $MAINTENANCE_BRANCH
- fi;
-}
-
function run_specs_and_record_done {
local rspec_bin=bin/rspec
# rspec-core needs to run with a special script that loads simplecov first,
# so that it can instrument rspec-core's code before rspec-core has been loaded.
@@ -83,10 +85,61 @@
fi;
$rspec_bin spec --backtrace --format progress --profile --format progress --out $SPECS_HAVE_RUN_FILE
}
+function run_specs_as_version {
+ if [ ! -f ./smoke_specs/$SPECS_HAVE_RUN_FILE ]; then # don't rerun specs that have already run
+ pushd ./smoke_specs
+ echo
+ echo "Running smoke specs for $RSPEC_VERSION"
+ echo
+ unset BUNDLE_GEMFILE
+ bundle_install_flags=`cat ../.travis.yml | grep bundler_args | tr -d '"' | grep -o " .*"`
+ travis_retry bundle install $bundle_install_flags
+ cp ../.rspec .rspec
+
+ # First check that we can run our spec suite
+ bin/rspec ../spec --format NyanCatFormatter --format NyanCatFormatter
+
+ set +e
+ # Then check RSpec 2.x formatters
+ bin/rspec spec -r ../lib/rspec/legacy_formatters/documentation_formatter.rb --format RSpec::Core::Formatters::DocumentationFormatter
+ local documentation_status=$?
+
+ bin/rspec spec -r ../lib/rspec/legacy_formatters/json_formatter.rb --format RSpec::Core::Formatters::JsonFormatter
+ local json_status=$?
+
+ bin/rspec spec -r ../lib/rspec/legacy_formatters/html_formatter.rb --format RSpec::Core::Formatters::HtmlFormatter
+ local html_status=$?
+
+ bin/rspec spec -r ../lib/rspec/legacy_formatters/progress_formatter.rb --format RSpec::Core::Formatters::ProgressFormatter
+ local progress_status=$?
+
+ # Then check we can run the smoke suite
+ bin/rspec spec --format NyanCatFormatter --format NyanCatFormatter --out $SPECS_HAVE_RUN_FILE
+ local status=$?
+ set -e
+ popd
+ # 42 is set in the rspec config for the smoke tests,
+ # so we can differentiate between crashes and real failures
+ if
+ (test $status = 42) &&
+ (test $documentation_status = 42) &&
+ (test $json_status = 42) &&
+ (test $html_status = 42) &&
+ (test $progress_status = 42)
+ then
+ echo "Build passed"
+ return 0
+ else
+ echo "Build failed"
+ return 1
+ fi
+ fi;
+}
+
function run_cukes {
if [ -d features ]; then
# force jRuby to use client mode JVM or a compilation mode thats as close as possible,
# idea taken from https://github.com/jruby/jruby/wiki/Improving-startup-time
#
@@ -105,29 +158,9 @@
RUBYOPT="-I${PWD}/../bundle -rbundler/setup" \
PATH="${PWD}/bin:$PATH" \
bin/cucumber --strict
fi
fi
-}
-
-function run_specs_one_by_one {
- for file in `find spec -iname '*_spec.rb'`; do
- bin/rspec $file -b --format progress
- done
-}
-
-function run_spec_suite_for {
- if [ ! -f ../$1/$SPECS_HAVE_RUN_FILE ]; then # don't rerun specs that have already run
- pushd ../$1
- echo
- echo "Running specs for $1"
- echo
- unset BUNDLE_GEMFILE
- bundle_install_flags=`cat .travis.yml | grep bundler_args | tr -d '"' | grep -o " .*"`
- travis_retry bundle install $bundle_install_flags
- run_specs_and_record_done
- popd
- fi;
}
function check_documentation_coverage {
bin/yard stats --list-undoc | ruby -e "
while line = gets