File: test_plugin_manager.rb

package info (click to toggle)
jekyll 3.1.6%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 3,820 kB
  • ctags: 997
  • sloc: ruby: 10,045; sh: 145; xml: 59; makefile: 28
file content (33 lines) | stat: -rw-r--r-- 1,062 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
require 'helper'

class TestPluginManager < JekyllUnitTest
  def with_no_gemfile
    FileUtils.mv "Gemfile", "Gemfile.old"
    yield
  ensure
    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.'
    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
        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