diff --git a/.travis.yml b/.travis.yml index 6b24b213..f33cba09 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,3 @@ -before_script: bundle update bundler_args: --without benchmark:site:development script: script/cibuild cache: bundler @@ -9,17 +8,13 @@ rvm: - &ruby1 2.3.0 - &ruby2 2.2.4 - &ruby3 2.1.8 - - &jruby jruby-9.0.5.0 - - &rhead ruby-head matrix: - fast_finish: true - allow_failures: - - rvm: *jruby - - rvm: *rhead include: - rvm: 2.3.0 env: TEST_SUITE=fmt + - rvm: jruby-9.0.5.0 + env: TEST_SUITE=test env: matrix: - TEST_SUITE=test diff --git a/Gemfile b/Gemfile index 253826aa..3dc758ef 100644 --- a/Gemfile +++ b/Gemfile @@ -23,6 +23,8 @@ group :test do gem "nokogiri" gem "rspec" gem "test-theme", path: File.expand_path("./test/fixtures/test-theme", File.dirname(__FILE__)) + + gem "jruby-openssl" if RUBY_ENGINE == "jruby" end # diff --git a/script/rubies b/script/rubies new file mode 100755 index 00000000..fb00ac61 --- /dev/null +++ b/script/rubies @@ -0,0 +1,14 @@ +#!/bin/bash +# ----------------------------------------------------------------------------- +# If you send us a ruby then we use that, if you do not then we test with +# whatever we can detect, this way you can run both suites when you test out +# your source, we expect full coverage now, not just MRI. +# ----------------------------------------------------------------------------- + +rubies=() +for r in jruby ruby; do + if which "$r" > /dev/null 2>&1 + then + echo $r + fi +done diff --git a/script/test b/script/test index 5aab2f06..133b9807 100755 --- a/script/test +++ b/script/test @@ -31,26 +31,26 @@ then shift else - rubies=() - for r in jruby ruby; do - if which "$r" - then - rubies+=( - $r - ) - fi - done + rubies=($(script/rubies)) fi + for ruby in $rubies; do + if [[ "$ruby" == "jruby" ]] + then + testopts="" + else + testopts="--profile" + fi + if [[ $# -lt 1 ]] then set -x time $ruby -S bundle exec \ - rake TESTOPTS='--profile' test + rake TESTOPTS=$testopts test else set -x time $ruby -S bundle exec ruby -Itest \ - "$@" --profile + "$@" $testops fi done diff --git a/test/test_commands_serve.rb b/test/test_commands_serve.rb index 50fe9f83..f129a07e 100644 --- a/test/test_commands_serve.rb +++ b/test/test_commands_serve.rb @@ -1,6 +1,7 @@ require "webrick" require "mercenary" require "helper" +require "openssl" class TestCommandsServe < JekyllUnitTest def custom_opts(what) diff --git a/test/test_configuration.rb b/test/test_configuration.rb index eddb2c96..0e0a69c7 100644 --- a/test/test_configuration.rb +++ b/test/test_configuration.rb @@ -1,4 +1,5 @@ require "helper" +require "colorator" class TestConfiguration < JekyllUnitTest test_config = { @@ -260,7 +261,9 @@ class TestConfiguration < JekyllUnitTest allow(SafeYAML).to receive(:load_file).with(@path) do raise SystemCallError, "No such file or directory - #{@path}" end - allow($stderr).to receive(:puts).with("Configuration file: none".yellow) + allow($stderr).to receive(:puts).with( + Colorator.yellow("Configuration file: none") + ) assert_equal site_configuration, Jekyll.configuration(test_config) end @@ -275,13 +278,12 @@ class TestConfiguration < JekyllUnitTest allow($stderr) .to receive(:puts) .and_return( - ("WARNING: " - .rjust(20) + "Error reading configuration. Using defaults (and options).") - .yellow + "WARNING: ".rjust(20) + + Colorator.yellow("Error reading configuration. Using defaults (and options).") ) allow($stderr) .to receive(:puts) - .and_return("Configuration file: (INVALID) #{@path}".yellow) + .and_return(Colorator.yellow("Configuration file: (INVALID) #{@path}")) assert_equal site_configuration, Jekyll.configuration(test_config) end @@ -291,10 +293,10 @@ class TestConfiguration < JekyllUnitTest end allow($stderr) .to receive(:puts) - .with(( + .with(Colorator.red( "Fatal: ".rjust(20) + \ "The configuration file '#{@user_config}' could not be found." - ).red) + )) assert_raises LoadError do Jekyll.configuration({ "config" => [@user_config] }) end diff --git a/test/test_utils.rb b/test/test_utils.rb index e2a50c58..5fbb99fc 100644 --- a/test/test_utils.rb +++ b/test/test_utils.rb @@ -320,7 +320,7 @@ class TestUtils < JekyllUnitTest context "The \`Utils.safe_glob\` method" do should "not apply pattern to the dir" do dir = "test/safe_glob_test[" - assert_equal [], Dir.glob(dir + "/*") + assert_equal [], Dir.glob(dir + "/*") unless jruby? assert_equal ["test/safe_glob_test[/find_me.txt"], Utils.safe_glob(dir, "*") end