From 2236ee42845047c4102c924978ddb56b7c628bc2 Mon Sep 17 00:00:00 2001 From: Florian Thomas Date: Sat, 30 Jul 2016 15:48:21 +0200 Subject: [PATCH] migrate existing tests to `should` syntax --- test/test_plugin_manager.rb | 40 +++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/test/test_plugin_manager.rb b/test/test_plugin_manager.rb index 22ad617f..67dfa726 100644 --- a/test/test_plugin_manager.rb +++ b/test/test_plugin_manager.rb @@ -8,28 +8,34 @@ class TestPluginManager < JekyllUnitTest FileUtils.mv "Gemfile.old", "Gemfile" end - def test_requiring_from_bundler - with_env("JEKYLL_NO_BUNDLER_REQUIRE", nil) do - assert Jekyll::PluginManager.require_from_bundler, - "require_from_bundler should return true." - assert ENV["JEKYLL_NO_BUNDLER_REQUIRE"], "Gemfile plugins were not required." + context "JEKYLL_NO_BUNDLER_REQUIRE set to `nil`" do + should "require from bundler" do + with_env("JEKYLL_NO_BUNDLER_REQUIRE", nil) do + assert Jekyll::PluginManager.require_from_bundler, + "require_from_bundler should return true." + assert ENV["JEKYLL_NO_BUNDLER_REQUIRE"], "Gemfile plugins were not required." + end end end - def test_blocking_requiring_from_bundler - with_env("JEKYLL_NO_BUNDLER_REQUIRE", "true") do - assert_equal false, Jekyll::PluginManager.require_from_bundler, - "Gemfile plugins were required but shouldn't have been" - assert ENV["JEKYLL_NO_BUNDLER_REQUIRE"] - end - end - - def test_no_gemfile - with_env("JEKYLL_NO_BUNDLER_REQUIRE", nil) do - with_no_gemfile do + context "JEKYLL_NO_BUNDLER_REQUIRE set to `true`" do + should "not require from bundler" do + with_env("JEKYLL_NO_BUNDLER_REQUIRE", "true") do assert_equal false, Jekyll::PluginManager.require_from_bundler, "Gemfile plugins were required but shouldn't have been" - assert_nil ENV["JEKYLL_NO_BUNDLER_REQUIRE"] + assert ENV["JEKYLL_NO_BUNDLER_REQUIRE"] + end + end + end + + context "JEKYLL_NO_BUNDLER_REQUIRE set to `nil` and no Gemfile present" do + should "not require from bundler" do + with_env("JEKYLL_NO_BUNDLER_REQUIRE", nil) do + with_no_gemfile do + assert_equal false, Jekyll::PluginManager.require_from_bundler, + "Gemfile plugins were required but shouldn't have been" + assert_nil ENV["JEKYLL_NO_BUNDLER_REQUIRE"] + end end end end