jekyll-minibundle 2.2.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +162 -63
  3. data/README.md +62 -57
  4. data/Rakefile +27 -14
  5. data/jekyll-minibundle.gemspec +15 -13
  6. data/lib/jekyll/minibundle.rb +2 -0
  7. data/lib/jekyll/minibundle/asset_bundle.rb +16 -10
  8. data/lib/jekyll/minibundle/asset_file_drop.rb +5 -2
  9. data/lib/jekyll/minibundle/asset_file_properties.rb +2 -0
  10. data/lib/jekyll/minibundle/asset_file_registry.rb +9 -7
  11. data/lib/jekyll/minibundle/asset_stamp.rb +2 -0
  12. data/lib/jekyll/minibundle/asset_tag_markup.rb +6 -4
  13. data/lib/jekyll/minibundle/bundle_file.rb +8 -0
  14. data/lib/jekyll/minibundle/development_file.rb +4 -0
  15. data/lib/jekyll/minibundle/development_file_collection.rb +2 -0
  16. data/lib/jekyll/minibundle/environment.rb +5 -1
  17. data/lib/jekyll/minibundle/exceptions.rb +2 -0
  18. data/lib/jekyll/minibundle/files.rb +2 -0
  19. data/lib/jekyll/minibundle/hashes.rb +3 -0
  20. data/lib/jekyll/minibundle/log.rb +3 -1
  21. data/lib/jekyll/minibundle/mini_bundle_block.rb +8 -1
  22. data/lib/jekyll/minibundle/mini_stamp_tag.rb +3 -1
  23. data/lib/jekyll/minibundle/stamp_file.rb +4 -0
  24. data/lib/jekyll/minibundle/variable_template.rb +15 -12
  25. data/lib/jekyll/minibundle/variable_template_registry.rb +2 -0
  26. data/lib/jekyll/minibundle/version.rb +3 -1
  27. data/test/fixture/site/_bin/remove_comments +1 -0
  28. data/test/fixture/site/_bin/with_count +1 -0
  29. data/test/fixture/site/_config.yml +2 -1
  30. data/test/integration/minibundle_development_mode_test.rb +115 -29
  31. data/test/integration/minibundle_production_mode_test.rb +157 -69
  32. data/test/integration/ministamp_development_mode_test.rb +4 -2
  33. data/test/integration/ministamp_production_mode_test.rb +6 -4
  34. data/test/integration/static_files_as_asset_sources_test.rb +6 -4
  35. data/test/support/assertions.rb +2 -0
  36. data/test/support/fixture_config.rb +14 -12
  37. data/test/support/static_file_config.rb +18 -16
  38. data/test/support/test_case.rb +5 -3
  39. data/test/unit/asset_bundle_test.rb +14 -12
  40. data/test/unit/asset_file_drop_test.rb +4 -3
  41. data/test/unit/asset_file_registry_test.rb +16 -19
  42. data/test/unit/asset_tag_markup_test.rb +8 -6
  43. data/test/unit/bundle_file_properties_test.rb +6 -4
  44. data/test/unit/bundle_file_writing_test.rb +6 -4
  45. data/test/unit/development_file_properties_test.rb +5 -3
  46. data/test/unit/development_file_writing_test.rb +4 -2
  47. data/test/unit/environment_test.rb +6 -4
  48. data/test/unit/files_test.rb +3 -1
  49. data/test/unit/hashes_test.rb +3 -1
  50. data/test/unit/jekyll_static_file_api_test.rb +13 -9
  51. data/test/unit/mini_bundle_block_test.rb +42 -35
  52. data/test/unit/mini_stamp_tag_test.rb +4 -2
  53. data/test/unit/stamp_file_properties_test.rb +5 -3
  54. data/test/unit/stamp_file_writing_test.rb +4 -2
  55. data/test/unit/variable_template_test.rb +8 -8
  56. metadata +13 -14
@@ -1,5 +1,7 @@
1
- require 'support/test_case'
2
- require 'support/fixture_config'
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../support/test_case'
4
+ require_relative '../support/fixture_config'
3
5
 
4
6
  module Jekyll::Minibundle::Test
5
7
  class MinistampDevelopmentModeTest < TestCase
@@ -1,5 +1,7 @@
1
- require 'support/test_case'
2
- require 'support/fixture_config'
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../support/test_case'
4
+ require_relative '../support/fixture_config'
3
5
 
4
6
  module Jekyll::Minibundle::Test
5
7
  class MinistampProductionModeTest < TestCase
@@ -239,11 +241,11 @@ module Jekyll::Minibundle::Test
239
241
  find_and_gsub_in_file(
240
242
  source_path('_layouts/default.html'),
241
243
  ' <link rel="stylesheet" href="{% ministamp _tmp/site.css assets/screen.css %}" media="screen">',
242
- <<-END
244
+ <<-LIQUID
243
245
  {% assign stamp_source_filename = 'site' %}
244
246
  {% assign stamp_destination_url = 'assets/screen.css' %}
245
247
  <link rel="stylesheet" href="{% ministamp { source_path: '_tmp/{{ stamp_source_filename }}.css', destination_path: '{{ stamp_destination_url }}' } %}" media="screen">
246
- END
248
+ LIQUID
247
249
  )
248
250
 
249
251
  generate_site(:production)
@@ -1,5 +1,7 @@
1
- require 'support/test_case'
2
- require 'support/fixture_config'
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../support/test_case'
4
+ require_relative '../support/fixture_config'
3
5
 
4
6
  module Jekyll::Minibundle::Test
5
7
  class StaticFilesAsAssetSourcesTest < TestCase
@@ -17,7 +19,7 @@ module Jekyll::Minibundle::Test
17
19
  end
18
20
  end
19
21
 
20
- [:development, :production].each do |env|
22
+ %i[development production].each do |env|
21
23
  define_method :"test_ministamp_allows_using_static_file_as_asset_source_in_#{env}_mode" do
22
24
  with_site_dir do
23
25
  contents = 'h2 {}'
@@ -26,7 +28,7 @@ module Jekyll::Minibundle::Test
26
28
 
27
29
  generate_site(env)
28
30
 
29
- asset_files = Dir[destination_path('assets') + '/screen*.css']
31
+ asset_files = Dir["#{destination_path('assets')}/screen*.css"]
30
32
 
31
33
  assert_equal(1, asset_files.size)
32
34
  assert_equal(contents, File.read(destination_path('assets/shared.css')))
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Jekyll::Minibundle::Test
2
4
  module Assertions
3
5
  def assert_contains_only(collection, expected_elements)
@@ -1,18 +1,20 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Jekyll::Minibundle::Test
2
4
  module FixtureConfig
3
- STAMP_SOURCE_PATH = '_tmp/site.css'.freeze
4
- STAMP_DESTINATION_PATH = 'assets/screen.css'.freeze
5
- STAMP_FINGERPRINT = 'd57c1404fe726e66d57128a1bd190cbb'.freeze
6
- STAMP_DESTINATION_FINGERPRINT_PATH = "assets/screen-#{STAMP_FINGERPRINT}.css".freeze
5
+ STAMP_SOURCE_PATH = '_tmp/site.css'
6
+ STAMP_DESTINATION_PATH = 'assets/screen.css'
7
+ STAMP_FINGERPRINT = 'd57c1404fe726e66d57128a1bd190cbb'
8
+ STAMP_DESTINATION_FINGERPRINT_PATH = "assets/screen-#{STAMP_FINGERPRINT}.css"
7
9
 
8
- CSS_BUNDLE_SOURCE_DIR = '_assets/styles'.freeze
9
- CSS_BUNDLE_DESTINATION_PATH = 'assets/site'.freeze
10
- CSS_BUNDLE_FINGERPRINT = 'b2e0ecc1c100effc2c7353caad20c327'.freeze
11
- CSS_BUNDLE_DESTINATION_FINGERPRINT_PATH = "#{CSS_BUNDLE_DESTINATION_PATH}-#{CSS_BUNDLE_FINGERPRINT}.css".freeze
10
+ CSS_BUNDLE_SOURCE_DIR = '_assets/styles'
11
+ CSS_BUNDLE_DESTINATION_PATH = 'assets/site'
12
+ CSS_BUNDLE_FINGERPRINT = 'b2e0ecc1c100effc2c7353caad20c327'
13
+ CSS_BUNDLE_DESTINATION_FINGERPRINT_PATH = "#{CSS_BUNDLE_DESTINATION_PATH}-#{CSS_BUNDLE_FINGERPRINT}.css"
12
14
 
13
- JS_BUNDLE_SOURCE_DIR = '_assets/scripts'.freeze
14
- JS_BUNDLE_DESTINATION_PATH = 'assets/site'.freeze
15
- JS_BUNDLE_FINGERPRINT = '4782a1f67803038d4f8351051e67deb8'.freeze
16
- JS_BUNDLE_DESTINATION_FINGERPRINT_PATH = "#{JS_BUNDLE_DESTINATION_PATH}-#{JS_BUNDLE_FINGERPRINT}.js".freeze
15
+ JS_BUNDLE_SOURCE_DIR = '_assets/scripts'
16
+ JS_BUNDLE_DESTINATION_PATH = 'assets/site'
17
+ JS_BUNDLE_FINGERPRINT = '4782a1f67803038d4f8351051e67deb8'
18
+ JS_BUNDLE_DESTINATION_FINGERPRINT_PATH = "#{JS_BUNDLE_DESTINATION_PATH}-#{JS_BUNDLE_FINGERPRINT}.js"
17
19
  end
18
20
  end
@@ -1,21 +1,23 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Jekyll::Minibundle::Test
2
4
  module StaticFileConfig
3
- STATIC_FILE_PROPERTIES = [
4
- :basename,
5
- :data,
6
- :defaults,
7
- :destination_rel_dir,
8
- :extname,
9
- :modified_time,
10
- :mtime,
11
- :name,
12
- :path,
13
- :placeholders,
14
- :relative_path,
15
- :to_liquid,
16
- :type,
17
- :url,
18
- :write?
5
+ STATIC_FILE_PROPERTIES = %i[
6
+ basename
7
+ data
8
+ defaults
9
+ destination_rel_dir
10
+ extname
11
+ modified_time
12
+ mtime
13
+ name
14
+ path
15
+ placeholders
16
+ relative_path
17
+ to_liquid
18
+ type
19
+ url
20
+ write?
19
21
  ].freeze
20
22
  end
21
23
  end
@@ -1,11 +1,13 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'fileutils'
2
4
  require 'ostruct'
3
5
  require 'tempfile'
4
- require 'minitest/autorun'
5
6
  require 'nokogiri'
6
- require 'support/assertions'
7
7
  require 'jekyll'
8
8
  require 'jekyll/minibundle'
9
+ require 'minitest/autorun'
10
+ require_relative 'assertions'
9
11
 
10
12
  module Jekyll::Minibundle::Test
11
13
  class TestCase < ::Minitest::Test
@@ -104,7 +106,7 @@ module Jekyll::Minibundle::Test
104
106
 
105
107
  def generate_site(mode, options = {})
106
108
  env = {
107
- 'JEKYLL_MINIBUNDLE_MODE' => mode && mode.to_s,
109
+ 'JEKYLL_MINIBUNDLE_MODE' => mode&.to_s,
108
110
  'JEKYLL_MINIBUNDLE_CMD_CSS' => options.fetch(:minifier_cmd_css, minifier_cmd_to_remove_comments),
109
111
  'JEKYLL_MINIBUNDLE_CMD_JS' => options.fetch(:minifier_cmd_js, minifier_cmd_to_remove_comments)
110
112
  }
@@ -1,4 +1,6 @@
1
- require 'support/test_case'
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../support/test_case'
2
4
  require 'jekyll/minibundle/asset_bundle'
3
5
 
4
6
  module Jekyll::Minibundle::Test
@@ -15,11 +17,11 @@ module Jekyll::Minibundle::Test
15
17
  _, actual_stderr = capture_io do
16
18
  assert_raises(RuntimeError) { make_bundle(cmd) }
17
19
  end
18
- expected_stderr = <<-END
19
- Minibundle: Bundling "assets/site.js" failed with exit status 1, command: #{cmd.inspect}, last 16 bytes of minifier output:
20
- Minibundle: line 1\\x07
21
- Minibundle: line 2\\xa4
22
- END
20
+ expected_stderr = <<~MESSAGE
21
+ Minibundle: Bundling "assets/site.js" failed with exit status 1, command: #{cmd.inspect}, last 16 bytes of minifier output:
22
+ Minibundle: line 1\\x07
23
+ Minibundle: line 2\\xa4
24
+ MESSAGE
23
25
  assert_equal(expected_stderr, actual_stderr.gsub(/\e\[\d+m/, '').gsub(/^ +/, ''))
24
26
  end
25
27
 
@@ -30,12 +32,12 @@ Minibundle: line 2\\xa4
30
32
 
31
33
  def test_raise_exception_if_bundle_command_not_configured
32
34
  err = assert_raises(RuntimeError) { make_bundle(nil) }
33
- expected_errmsg = <<-END
34
- Missing minification command for bundling "assets/site.js". Specify it in
35
- 1) minibundle.minifier_commands.js setting in _config.yml,
36
- 2) $JEKYLL_MINIBUNDLE_CMD_JS environment variable, or
37
- 3) minifier_cmd setting inside minibundle block.
38
- END
35
+ expected_errmsg = <<~MESSAGE
36
+ Missing minification command for bundling "assets/site.js". Specify it in
37
+ 1) minibundle.minifier_commands.js setting in _config.yml,
38
+ 2) $JEKYLL_MINIBUNDLE_CMD_JS environment variable, or
39
+ 3) minifier_cmd setting inside minibundle block.
40
+ MESSAGE
39
41
  assert_equal(expected_errmsg, err.to_s)
40
42
  end
41
43
 
@@ -1,6 +1,7 @@
1
- require 'json'
2
- require 'support/test_case'
3
- require 'support/fixture_config'
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../support/test_case'
4
+ require_relative '../support/fixture_config'
4
5
  require 'jekyll/minibundle/asset_file_drop'
5
6
  require 'jekyll/minibundle/stamp_file'
6
7
 
@@ -1,5 +1,7 @@
1
- require 'support/test_case'
2
- require 'support/fixture_config'
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../support/test_case'
4
+ require_relative '../support/fixture_config'
3
5
  require 'jekyll/minibundle/asset_file_registry'
4
6
 
5
7
  module Jekyll::Minibundle::Test
@@ -75,7 +77,7 @@ module Jekyll::Minibundle::Test
75
77
  end
76
78
 
77
79
  [
78
- {description: 'assets', config_diff: {'assets' => %w{b1 b2}}},
80
+ {description: 'assets', config_diff: {'assets' => %w[b1 b2]}},
79
81
  {description: 'source_directory', config_diff: {'source_dir' => '_assets/src2'}}
80
82
  ].each do |spec|
81
83
  define_method :"test_raise_exception_if_registering_bundle_file_with_same_destination_path_but_with_different_#{spec.fetch(:description)}" do
@@ -86,19 +88,14 @@ module Jekyll::Minibundle::Test
86
88
  err = assert_raises(RuntimeError) do
87
89
  AssetFileRegistry.register_bundle_file(site, second_config)
88
90
  end
89
- assert_equal(<<-END, err.to_s)
90
- Two or more minibundle blocks with the same destination path "assets/site.js", but having different asset configuration: #{second_config.inspect} vs. #{first_config.inspect}
91
- END
91
+ assert_equal(<<~MESSAGE, err.to_s)
92
+ Two or more minibundle blocks with the same destination path "assets/site.js", but having different asset configuration: #{second_config.inspect} vs. #{first_config.inspect}
93
+ MESSAGE
92
94
  assert_equal(1, asset_file_registry_size)
93
95
  assert_contains_only(site.static_files, [first_file])
94
96
  end
95
97
  end
96
- end
97
98
 
98
- [
99
- {description: 'assets', config_diff: {'assets' => %w{b1 b2}}},
100
- {description: 'source_directory', config_diff: {'source_dir' => '_assets/src2'}}
101
- ].each do |spec|
102
99
  define_method :"test_raise_exception_if_registering_development_file_collection_with_same_destination_path_but_with_different_#{spec.fetch(:description)}" do
103
100
  with_fake_site do |site|
104
101
  first_config = bundle_config
@@ -107,9 +104,9 @@ Two or more minibundle blocks with the same destination path "assets/site.js", b
107
104
  err = assert_raises(RuntimeError) do
108
105
  AssetFileRegistry.register_development_file_collection(site, second_config)
109
106
  end
110
- assert_equal(<<-END, err.to_s)
111
- Two or more minibundle blocks with the same destination path "assets/site.js", but having different asset configuration: #{second_config.inspect} vs. #{first_config.inspect}
112
- END
107
+ assert_equal(<<~MESSAGE, err.to_s)
108
+ Two or more minibundle blocks with the same destination path "assets/site.js", but having different asset configuration: #{second_config.inspect} vs. #{first_config.inspect}
109
+ MESSAGE
113
110
  assert_equal(1, asset_file_registry_size)
114
111
  assert_contains_only(site.static_files, first_file.files)
115
112
  end
@@ -142,7 +139,7 @@ Two or more minibundle blocks with the same destination path "assets/site.js", b
142
139
 
143
140
  define_method :"test_raise_exception_if_registering_#{spec.fetch(:description)}s_with_different_source_and_same_destination_paths" do
144
141
  with_fake_site do |site|
145
- source_paths = %w{src1.css src2.css}.map do |file|
142
+ source_paths = %w[src1.css src2.css].map do |file|
146
143
  File.join(CSS_BUNDLE_SOURCE_DIR, file)
147
144
  end
148
145
  source_paths.each { |path| FileUtils.touch(path) }
@@ -150,9 +147,9 @@ Two or more minibundle blocks with the same destination path "assets/site.js", b
150
147
  err = assert_raises(RuntimeError) do
151
148
  AssetFileRegistry.send(spec.fetch(:method), site, source_paths[1], 'assets/dest1.css')
152
149
  end
153
- assert_equal(<<-END, err.to_s)
154
- Two or more ministamp tags with the same destination path "assets/dest1.css", but different asset source paths: "#{source_paths[1]}" vs. "#{source_paths[0]}"
155
- END
150
+ assert_equal(<<~MESSAGE, err.to_s)
151
+ Two or more ministamp tags with the same destination path "assets/dest1.css", but different asset source paths: "#{source_paths[1]}" vs. "#{source_paths[0]}"
152
+ MESSAGE
156
153
  assert_equal(1, asset_file_registry_size)
157
154
  assert_contains_only(site.static_files, [first])
158
155
  end
@@ -227,7 +224,7 @@ Two or more ministamp tags with the same destination path "assets/dest1.css", bu
227
224
  {
228
225
  'type' => :js,
229
226
  'source_dir' => JS_BUNDLE_SOURCE_DIR,
230
- 'assets' => %w{dependency app},
227
+ 'assets' => %w[dependency app],
231
228
  'destination_path' => JS_BUNDLE_DESTINATION_PATH,
232
229
  'minifier_cmd' => 'unused_minifier_cmd'
233
230
  }
@@ -1,36 +1,38 @@
1
- require 'support/test_case'
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../support/test_case'
2
4
  require 'jekyll/minibundle/asset_tag_markup'
3
5
 
4
6
  module Jekyll::Minibundle::Test
5
7
  class AssetTagMarkupTest < TestCase
6
8
  def test_escape_url
7
9
  actual = AssetTagMarkup.make_markup(:css, 'https://example.com/path?a=this+"thing"&b=<br>', {})
8
- expected = %{<link rel="stylesheet" href="https://example.com/path?a=this+&quot;thing&quot;&amp;b=&lt;br&gt;">}
10
+ expected = %(<link rel="stylesheet" href="https://example.com/path?a=this+&quot;thing&quot;&amp;b=&lt;br&gt;">)
9
11
  assert_equal(expected, actual)
10
12
  end
11
13
 
12
14
  def test_escape_attribute_value
13
15
  attributes = {media: 'screen, projection', extra: '">attack<br'}
14
16
  actual = AssetTagMarkup.make_markup(:css, '/asset.css', attributes)
15
- expected = %{<link rel="stylesheet" href="/asset.css" media="screen, projection" extra="&quot;&gt;attack&lt;br">}
17
+ expected = %(<link rel="stylesheet" href="/asset.css" media="screen, projection" extra="&quot;&gt;attack&lt;br">)
16
18
  assert_equal(expected, actual)
17
19
  end
18
20
 
19
21
  def test_output_just_attribute_name_for_nil_value
20
22
  actual = AssetTagMarkup.make_markup(:css, '/asset.css', async: nil)
21
- expected = %{<link rel="stylesheet" href="/asset.css" async>}
23
+ expected = %(<link rel="stylesheet" href="/asset.css" async>)
22
24
  assert_equal(expected, actual)
23
25
  end
24
26
 
25
27
  def test_convert_attribute_value_to_string
26
28
  actual = AssetTagMarkup.make_markup(:css, '/asset.css', boolean: false)
27
- expected = %{<link rel="stylesheet" href="/asset.css" boolean="false">}
29
+ expected = %(<link rel="stylesheet" href="/asset.css" boolean="false">)
28
30
  assert_equal(expected, actual)
29
31
  end
30
32
 
31
33
  def test_output_empty_attribute_value
32
34
  actual = AssetTagMarkup.make_markup(:css, '/asset.css', empty: '')
33
- expected = %{<link rel="stylesheet" href="/asset.css" empty="">}
35
+ expected = %(<link rel="stylesheet" href="/asset.css" empty="">)
34
36
  assert_equal(expected, actual)
35
37
  end
36
38
 
@@ -1,6 +1,8 @@
1
- require 'support/test_case'
2
- require 'support/fixture_config'
3
- require 'support/static_file_config'
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../support/test_case'
4
+ require_relative '../support/fixture_config'
5
+ require_relative '../support/static_file_config'
4
6
  require 'jekyll/minibundle/bundle_file'
5
7
 
6
8
  module Jekyll::Minibundle::Test
@@ -97,7 +99,7 @@ module Jekyll::Minibundle::Test
97
99
  {
98
100
  'type' => :js,
99
101
  'source_dir' => JS_BUNDLE_SOURCE_DIR,
100
- 'assets' => %w{dependency app},
102
+ 'assets' => %w[dependency app],
101
103
  'destination_path' => JS_BUNDLE_DESTINATION_PATH,
102
104
  'minifier_cmd' => minifier_cmd
103
105
  }
@@ -1,5 +1,7 @@
1
- require 'support/test_case'
2
- require 'support/fixture_config'
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../support/test_case'
4
+ require_relative '../support/fixture_config'
3
5
  require 'jekyll/minibundle/bundle_file'
4
6
 
5
7
  module Jekyll::Minibundle::Test
@@ -18,7 +20,7 @@ module Jekyll::Minibundle::Test
18
20
  def test_raise_error_if_asset_source_file_does_not_exist
19
21
  err = assert_raises(ArgumentError) do
20
22
  with_fake_site do |site|
21
- make_bundle_file(site, 'assets' => %w{no-such})
23
+ make_bundle_file(site, 'assets' => %w[no-such])
22
24
  end
23
25
  end
24
26
  assert_match(%r{\ABundle asset source file does not exist: .+/#{Regexp.escape(JS_BUNDLE_SOURCE_DIR)}/no-such.js\z}, err.to_s)
@@ -139,7 +141,7 @@ module Jekyll::Minibundle::Test
139
141
  bundle_config = {
140
142
  'type' => :js,
141
143
  'source_dir' => JS_BUNDLE_SOURCE_DIR,
142
- 'assets' => %w{dependency app},
144
+ 'assets' => %w[dependency app],
143
145
  'destination_path' => JS_BUNDLE_DESTINATION_PATH,
144
146
  'minifier_cmd' => minifier_cmd_to_remove_comments_and_count
145
147
  }
@@ -1,6 +1,8 @@
1
- require 'support/test_case'
2
- require 'support/fixture_config'
3
- require 'support/static_file_config'
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../support/test_case'
4
+ require_relative '../support/fixture_config'
5
+ require_relative '../support/static_file_config'
4
6
  require 'jekyll/minibundle/development_file'
5
7
 
6
8
  module Jekyll::Minibundle::Test
@@ -1,5 +1,7 @@
1
- require 'support/test_case'
2
- require 'support/fixture_config'
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../support/test_case'
4
+ require_relative '../support/fixture_config'
3
5
  require 'jekyll/minibundle/development_file'
4
6
 
5
7
  module Jekyll::Minibundle::Test
@@ -1,19 +1,21 @@
1
- require 'support/test_case'
1
+ # frozen_string_literal: true
2
+
3
+ require_relative '../support/test_case'
2
4
  require 'jekyll/minibundle/environment'
3
5
 
4
6
  module Jekyll::Minibundle::Test
5
7
  class EnvironmentTest < TestCase
6
8
  def test_find_site_config_returns_value_when_found
7
- assert_equal(1, Environment.find_site_config(make_site(top: {leaf: 1}), [:top, :leaf], Integer))
9
+ assert_equal(1, Environment.find_site_config(make_site(top: {leaf: 1}), %i[top leaf], Integer))
8
10
  end
9
11
 
10
12
  def test_find_site_config_returns_nil_when_not_found
11
- assert_nil(Environment.find_site_config(make_site, [:top, :leaf], Integer))
13
+ assert_nil(Environment.find_site_config(make_site, %i[top leaf], Integer))
12
14
  end
13
15
 
14
16
  def test_find_site_config_raises_exception_if_found_value_is_of_unexpected_type
15
17
  err = assert_raises(RuntimeError) do
16
- Environment.find_site_config(make_site(top: {leaf: '1'}), [:top, :leaf], Integer)
18
+ Environment.find_site_config(make_site(top: {leaf: '1'}), %i[top leaf], Integer)
17
19
  end
18
20
  assert_equal('Invalid site configuration for key top.leaf; expecting type Integer', err.to_s)
19
21
  end