From d98bd02e9fb5543808840b086a49a359767c9da4 Mon Sep 17 00:00:00 2001 From: Iain Beeston Date: Wed, 5 Jul 2017 09:42:15 +0100 Subject: [PATCH] Always download the common test suite before running tests In #377 I made it possible to run the tests without having internet access. But it seems that in the process I also disabled the code that downloads the common test suite when you first check out the codebase. This changes the behaviour so that if you run the test suite and you have internet access the common test suite is automatically downloaded. If you don't have internet access it continues without it. To update the common test suite to the latest version, you now need to run the tests with the `UPDATE_TEST_SUITE` env var set. --- Rakefile | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Rakefile b/Rakefile index b4a13a26..991e2188 100644 --- a/Rakefile +++ b/Rakefile @@ -4,8 +4,10 @@ require 'rake/testtask' Bundler::GemHelper.install_tasks -desc "Updates the json-schema common test suite to the latest version" -task :update_common_tests do +desc "Downloads the json-schema common test suite" +task :download_common_tests do + update_test_suite = !!ENV['UPDATE_TEST_SUITE'] + unless File.read(".git/config").include?('submodule "test/test-suite"') sh "git submodule init" end @@ -13,7 +15,7 @@ task :update_common_tests do puts "Updating json-schema common test suite..." begin - sh "git submodule update --remote --quiet" + sh "git submodule update --quiet" + (update_test_suite ? " --remote" : "") rescue StandardError STDERR.puts "Failed to update common test suite." end @@ -63,6 +65,4 @@ Rake::TestTask.new do |t| t.test_files = FileList.new('test/*_test.rb') end -task update: [:update_common_tests, :update_meta_schemas] - -task :default => :test +task :default => [:download_common_tests, :test]