nanoc 4.4.5 → 4.4.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (233) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +6 -2
  3. data/Gemfile.lock +37 -18
  4. data/NEWS.md +6 -0
  5. data/Rakefile +8 -20
  6. data/lib/nanoc/base/entities/code_snippet.rb +0 -2
  7. data/lib/nanoc/base/entities/item_rep.rb +4 -22
  8. data/lib/nanoc/base/entities/processing_actions/snapshot.rb +9 -7
  9. data/lib/nanoc/base/entities/rule_memory.rb +15 -7
  10. data/lib/nanoc/base/entities/snapshot_def.rb +2 -8
  11. data/lib/nanoc/base/repos/store.rb +2 -28
  12. data/lib/nanoc/base/services/checksummer.rb +9 -10
  13. data/lib/nanoc/base/services/compiler.rb +14 -16
  14. data/lib/nanoc/base/services/executor.rb +2 -13
  15. data/lib/nanoc/base/views/mixins/with_reps_view_mixin.rb +1 -1
  16. data/lib/nanoc/checking/checks/external_links.rb +2 -1
  17. data/lib/nanoc/cli/commands/compile.rb +8 -14
  18. data/lib/nanoc/extra/parallel_collection.rb +57 -0
  19. data/lib/nanoc/extra.rb +1 -0
  20. data/lib/nanoc/filters/mustache.rb +1 -1
  21. data/lib/nanoc/rule_dsl/recording_executor.rb +6 -34
  22. data/lib/nanoc/rule_dsl/rule_memory_calculator.rb +42 -12
  23. data/lib/nanoc/spec.rb +1 -1
  24. data/lib/nanoc/version.rb +1 -1
  25. data/nanoc.gemspec +1 -2
  26. data/spec/contributors_spec.rb +18 -0
  27. data/spec/nanoc/base/checksummer_spec.rb +381 -0
  28. data/spec/nanoc/base/compiler_spec.rb +181 -0
  29. data/spec/nanoc/base/entities/configuration_spec.rb +49 -0
  30. data/spec/nanoc/base/entities/content_spec.rb +193 -0
  31. data/spec/nanoc/base/entities/document_spec.rb +206 -0
  32. data/spec/nanoc/base/entities/identifier_spec.rb +460 -0
  33. data/spec/nanoc/base/entities/item_rep_spec.rb +226 -0
  34. data/spec/nanoc/base/entities/item_spec.rb +3 -0
  35. data/spec/nanoc/base/entities/layout_spec.rb +3 -0
  36. data/spec/nanoc/base/entities/lazy_value_spec.rb +106 -0
  37. data/spec/nanoc/base/entities/outdatedness_status_spec.rb +113 -0
  38. data/spec/nanoc/base/entities/pattern_spec.rb +125 -0
  39. data/spec/nanoc/base/entities/processing_action_spec.rb +9 -0
  40. data/spec/nanoc/base/entities/processing_actions/filter_spec.rb +18 -0
  41. data/spec/nanoc/base/entities/processing_actions/layout_spec.rb +18 -0
  42. data/spec/nanoc/base/entities/processing_actions/snapshot_spec.rb +32 -0
  43. data/spec/nanoc/base/entities/props_spec.rb +195 -0
  44. data/spec/nanoc/base/entities/rule_memory_spec.rb +131 -0
  45. data/spec/nanoc/base/entities/site_spec.rb +73 -0
  46. data/spec/nanoc/base/feature_spec.rb +107 -0
  47. data/spec/nanoc/base/filter_spec.rb +99 -0
  48. data/spec/nanoc/base/item_rep_writer_spec.rb +131 -0
  49. data/spec/nanoc/base/plugin_registry_spec.rb +29 -0
  50. data/spec/nanoc/base/repos/checksum_store_spec.rb +133 -0
  51. data/spec/nanoc/base/repos/compiled_content_cache_spec.rb +55 -0
  52. data/spec/nanoc/base/repos/config_loader_spec.rb +243 -0
  53. data/spec/nanoc/base/repos/dependency_store_spec.rb +195 -0
  54. data/spec/nanoc/base/repos/site_loader_spec.rb +214 -0
  55. data/spec/nanoc/base/services/dependency_tracker_spec.rb +238 -0
  56. data/spec/nanoc/base/services/executor_spec.rb +495 -0
  57. data/spec/nanoc/base/services/item_rep_router_spec.rb +134 -0
  58. data/spec/nanoc/base/services/item_rep_selector_spec.rb +169 -0
  59. data/spec/nanoc/base/services/outdatedness_checker_spec.rb +370 -0
  60. data/spec/nanoc/base/services/outdatedness_rules_spec.rb +432 -0
  61. data/spec/nanoc/base/services/pruner_spec.rb +105 -0
  62. data/spec/nanoc/base/services/temp_filename_factory_spec.rb +87 -0
  63. data/spec/nanoc/base/views/config_view_spec.rb +96 -0
  64. data/spec/nanoc/base/views/document_view_spec.rb +332 -0
  65. data/spec/nanoc/base/views/identifiable_collection_view_spec.rb +190 -0
  66. data/spec/nanoc/base/views/item_collection_with_reps_view_spec.rb +18 -0
  67. data/spec/nanoc/base/views/item_collection_without_reps_view_spec.rb +18 -0
  68. data/spec/nanoc/base/views/item_rep_collection_view_spec.rb +143 -0
  69. data/spec/nanoc/base/views/item_rep_view_spec.rb +265 -0
  70. data/spec/nanoc/base/views/item_view_spec.rb +341 -0
  71. data/spec/nanoc/base/views/layout_collection_view_spec.rb +18 -0
  72. data/spec/nanoc/base/views/layout_view_spec.rb +14 -0
  73. data/spec/nanoc/base/views/mutable_config_view_spec.rb +16 -0
  74. data/spec/nanoc/base/views/mutable_document_view_spec.rb +92 -0
  75. data/spec/nanoc/base/views/mutable_identifiable_collection_view_spec.rb +36 -0
  76. data/spec/nanoc/base/views/mutable_item_collection_view_spec.rb +49 -0
  77. data/spec/nanoc/base/views/mutable_item_view_spec.rb +22 -0
  78. data/spec/nanoc/base/views/mutable_layout_collection_view_spec.rb +49 -0
  79. data/spec/nanoc/base/views/mutable_layout_view_spec.rb +13 -0
  80. data/spec/nanoc/base/views/post_compile_item_rep_collection_view_spec.rb +4 -0
  81. data/spec/nanoc/base/views/post_compile_item_rep_view_spec.rb +137 -0
  82. data/spec/nanoc/base/views/post_compile_item_view_spec.rb +56 -0
  83. data/spec/nanoc/cli/commands/compile/file_action_printer_spec.rb +76 -0
  84. data/spec/nanoc/cli/commands/compile/timing_recorder_spec.rb +66 -0
  85. data/spec/nanoc/cli/commands/compile_spec.rb +64 -0
  86. data/spec/nanoc/cli/commands/deploy_spec.rb +327 -0
  87. data/spec/nanoc/cli/commands/shell_spec.rb +54 -0
  88. data/spec/nanoc/cli/commands/show_data_spec.rb +126 -0
  89. data/spec/nanoc/cli/commands/show_rules_spec.rb +112 -0
  90. data/spec/nanoc/cli/commands/view_spec.rb +58 -0
  91. data/spec/nanoc/data_sources/filesystem_spec.rb +56 -0
  92. data/spec/nanoc/deploying/fog_spec.rb +193 -0
  93. data/spec/nanoc/extra/parallel_collection_spec.rb +108 -0
  94. data/spec/nanoc/filters/colorize_syntax/rouge_spec.rb +195 -0
  95. data/spec/nanoc/filters/less_spec.rb +120 -0
  96. data/spec/nanoc/helpers/blogging_spec.rb +216 -0
  97. data/spec/nanoc/helpers/breadcrumbs_spec.rb +133 -0
  98. data/spec/nanoc/helpers/capturing_spec.rb +181 -0
  99. data/spec/nanoc/helpers/child_parent_spec.rb +105 -0
  100. data/spec/nanoc/helpers/filtering_spec.rb +72 -0
  101. data/spec/nanoc/helpers/html_escape_spec.rb +35 -0
  102. data/spec/nanoc/helpers/link_to_spec.rb +275 -0
  103. data/spec/nanoc/helpers/rendering_spec.rb +141 -0
  104. data/spec/nanoc/helpers/tagging_spec.rb +104 -0
  105. data/spec/nanoc/helpers/text_spec.rb +58 -0
  106. data/spec/nanoc/integration/outdatedness_integration_spec.rb +208 -0
  107. data/spec/nanoc/regressions/gh_1015_spec.rb +17 -0
  108. data/spec/nanoc/regressions/gh_1031_spec.rb +54 -0
  109. data/spec/nanoc/regressions/gh_1035_spec.rb +33 -0
  110. data/spec/nanoc/regressions/gh_1040_spec.rb +22 -0
  111. data/spec/nanoc/regressions/gh_761_spec.rb +23 -0
  112. data/spec/nanoc/regressions/gh_767_spec.rb +19 -0
  113. data/spec/nanoc/regressions/gh_769_spec.rb +30 -0
  114. data/spec/nanoc/regressions/gh_776_spec.rb +43 -0
  115. data/spec/nanoc/regressions/gh_787_spec.rb +19 -0
  116. data/spec/nanoc/regressions/gh_795_spec.rb +19 -0
  117. data/spec/nanoc/regressions/gh_804_spec.rb +26 -0
  118. data/spec/nanoc/regressions/gh_807_spec.rb +17 -0
  119. data/spec/nanoc/regressions/gh_809_spec.rb +17 -0
  120. data/spec/nanoc/regressions/gh_813_spec.rb +22 -0
  121. data/spec/nanoc/regressions/gh_815_spec.rb +18 -0
  122. data/spec/nanoc/regressions/gh_828_spec.rb +23 -0
  123. data/spec/nanoc/regressions/gh_833_spec.rb +14 -0
  124. data/spec/nanoc/regressions/gh_841_spec.rb +15 -0
  125. data/spec/nanoc/regressions/gh_867_spec.rb +15 -0
  126. data/spec/nanoc/regressions/gh_882_spec.rb +29 -0
  127. data/spec/nanoc/regressions/gh_885_spec.rb +30 -0
  128. data/spec/nanoc/regressions/gh_891_spec.rb +26 -0
  129. data/spec/nanoc/regressions/gh_913_spec.rb +24 -0
  130. data/spec/nanoc/regressions/gh_928_spec.rb +5 -0
  131. data/spec/nanoc/regressions/gh_937_spec.rb +25 -0
  132. data/spec/nanoc/regressions/gh_942_spec.rb +21 -0
  133. data/spec/nanoc/regressions/gh_947_spec.rb +21 -0
  134. data/spec/nanoc/regressions/gh_948_spec.rb +16 -0
  135. data/spec/nanoc/regressions/gh_951_spec.rb +19 -0
  136. data/spec/nanoc/regressions/gh_954_spec.rb +33 -0
  137. data/spec/nanoc/regressions/gh_970a_spec.rb +17 -0
  138. data/spec/nanoc/regressions/gh_970b_spec.rb +50 -0
  139. data/spec/nanoc/regressions/gh_974_spec.rb +17 -0
  140. data/spec/nanoc/regressions/gh_981_spec.rb +21 -0
  141. data/spec/nanoc/rule_dsl/recording_executor_spec.rb +142 -0
  142. data/spec/nanoc/rule_dsl/rule_context_spec.rb +177 -0
  143. data/spec/nanoc/rule_dsl/rule_memory_calculator_spec.rb +233 -0
  144. data/spec/nanoc/rule_dsl/rules_collection_spec.rb +299 -0
  145. data/spec/regression_filenames_spec.rb +16 -0
  146. data/spec/spec_helper.rb +173 -0
  147. data/test/base/core_ext/array_spec.rb +2 -0
  148. data/test/base/core_ext/hash_spec.rb +2 -0
  149. data/test/base/core_ext/string_spec.rb +2 -0
  150. data/test/base/test_code_snippet.rb +2 -0
  151. data/test/base/test_compiler.rb +2 -0
  152. data/test/base/test_context.rb +4 -2
  153. data/test/base/test_data_source.rb +2 -0
  154. data/test/base/test_dependency_tracker.rb +2 -0
  155. data/test/base/test_directed_graph.rb +2 -0
  156. data/test/base/test_filter.rb +7 -5
  157. data/test/base/test_item.rb +2 -0
  158. data/test/base/test_item_array.rb +3 -1
  159. data/test/base/test_layout.rb +2 -0
  160. data/test/base/test_memoization.rb +2 -0
  161. data/test/base/test_notification_center.rb +2 -0
  162. data/test/base/test_outdatedness_checker.rb +2 -0
  163. data/test/base/test_plugin.rb +2 -0
  164. data/test/base/test_site.rb +2 -0
  165. data/test/base/test_store.rb +2 -0
  166. data/test/checking/checks/test_css.rb +2 -0
  167. data/test/checking/checks/test_external_links.rb +4 -2
  168. data/test/checking/checks/test_html.rb +2 -0
  169. data/test/checking/checks/test_internal_links.rb +5 -3
  170. data/test/checking/checks/test_mixed_content.rb +2 -0
  171. data/test/checking/checks/test_stale.rb +2 -0
  172. data/test/checking/test_check.rb +2 -0
  173. data/test/checking/test_dsl.rb +2 -0
  174. data/test/checking/test_runner.rb +2 -0
  175. data/test/cli/commands/test_check.rb +2 -0
  176. data/test/cli/commands/test_compile.rb +2 -0
  177. data/test/cli/commands/test_create_site.rb +2 -0
  178. data/test/cli/commands/test_help.rb +2 -0
  179. data/test/cli/commands/test_info.rb +2 -0
  180. data/test/cli/commands/test_prune.rb +2 -0
  181. data/test/cli/test_cleaning_stream.rb +2 -0
  182. data/test/cli/test_cli.rb +11 -9
  183. data/test/cli/test_error_handler.rb +2 -0
  184. data/test/cli/test_logger.rb +2 -0
  185. data/test/data_sources/test_filesystem.rb +8 -6
  186. data/test/data_sources/test_filesystem_tools.rb +2 -0
  187. data/test/deploying/test_fog.rb +2 -0
  188. data/test/deploying/test_rsync.rb +4 -2
  189. data/test/extra/core_ext/test_pathname.rb +2 -0
  190. data/test/extra/core_ext/test_time.rb +2 -0
  191. data/test/extra/test_link_collector.rb +2 -0
  192. data/test/extra/test_piper.rb +2 -0
  193. data/test/filters/colorize_syntax/test_coderay.rb +2 -0
  194. data/test/filters/colorize_syntax/test_common.rb +2 -0
  195. data/test/filters/colorize_syntax/test_pygmentize.rb +2 -0
  196. data/test/filters/colorize_syntax/test_pygments.rb +2 -0
  197. data/test/filters/colorize_syntax/test_simon.rb +2 -0
  198. data/test/filters/test_asciidoc.rb +2 -0
  199. data/test/filters/test_bluecloth.rb +2 -0
  200. data/test/filters/test_coffeescript.rb +2 -0
  201. data/test/filters/test_erb.rb +7 -5
  202. data/test/filters/test_erubis.rb +6 -4
  203. data/test/filters/test_haml.rb +7 -5
  204. data/test/filters/test_handlebars.rb +2 -0
  205. data/test/filters/test_kramdown.rb +2 -0
  206. data/test/filters/test_markaby.rb +2 -0
  207. data/test/filters/test_maruku.rb +2 -0
  208. data/test/filters/test_mustache.rb +4 -2
  209. data/test/filters/test_pandoc.rb +2 -0
  210. data/test/filters/test_rainpress.rb +2 -0
  211. data/test/filters/test_rdiscount.rb +2 -0
  212. data/test/filters/test_rdoc.rb +2 -0
  213. data/test/filters/test_redcarpet.rb +2 -0
  214. data/test/filters/test_redcloth.rb +2 -0
  215. data/test/filters/test_relativize_paths.rb +2 -0
  216. data/test/filters/test_rubypants.rb +2 -0
  217. data/test/filters/test_sass.rb +4 -2
  218. data/test/filters/test_slim.rb +4 -2
  219. data/test/filters/test_typogruby.rb +2 -0
  220. data/test/filters/test_uglify_js.rb +2 -0
  221. data/test/filters/test_xsl.rb +2 -0
  222. data/test/filters/test_yui_compressor.rb +5 -3
  223. data/test/helpers/test_blogging.rb +2 -0
  224. data/test/helpers/test_capturing.rb +2 -0
  225. data/test/helpers/test_link_to.rb +2 -0
  226. data/test/helpers/test_xml_sitemap.rb +2 -0
  227. data/test/rule_dsl/test_action_provider.rb +2 -0
  228. data/test/rule_dsl/test_compiler_dsl.rb +6 -4
  229. data/test/rule_dsl/test_rule.rb +2 -0
  230. data/test/rule_dsl/test_rules_collection.rb +2 -0
  231. data/test/test_gem.rb +2 -0
  232. metadata +124 -17
  233. data/test/base/test_item_rep.rb +0 -156
@@ -1,3 +1,5 @@
1
+ require 'helper'
2
+
1
3
  class Nanoc::Deploying::Deployers::FogTest < Nanoc::TestCase
2
4
  def test_read_etags_with_local_provider
3
5
  if_have 'fog' do
@@ -1,3 +1,5 @@
1
+ require 'helper'
2
+
1
3
  class Nanoc::Deploying::Deployers::RsyncTest < Nanoc::TestCase
2
4
  def test_run_without_dst
3
5
  # Create deployer
@@ -24,7 +26,7 @@ class Nanoc::Deploying::Deployers::RsyncTest < Nanoc::TestCase
24
26
  # Create deployer
25
27
  rsync = Nanoc::Deploying::Deployers::Rsync.new(
26
28
  'output/',
27
- { dst: 'asdf/' },
29
+ dst: 'asdf/',
28
30
  )
29
31
 
30
32
  # Mock run_shell_cmd
@@ -45,7 +47,7 @@ class Nanoc::Deploying::Deployers::RsyncTest < Nanoc::TestCase
45
47
  # Create deployer
46
48
  rsync = Nanoc::Deploying::Deployers::Rsync.new(
47
49
  'output',
48
- { dst: 'asdf' },
50
+ dst: 'asdf',
49
51
  )
50
52
 
51
53
  # Mock run_shell_cmd
@@ -1,3 +1,5 @@
1
+ require 'helper'
2
+
1
3
  class Nanoc::Extra::CoreExtPathnameTest < Nanoc::TestCase
2
4
  def test_components
3
5
  assert_equal %w(/ a bb ccc dd e), Pathname.new('/a/bb/ccc/dd/e').__nanoc_components
@@ -1,3 +1,5 @@
1
+ require 'helper'
2
+
1
3
  class Nanoc::ExtraCoreExtTimeTest < Nanoc::TestCase
2
4
  def test___nanoc_to_iso8601_date_utc
3
5
  assert_equal('2008-05-19', Time.utc(2008, 5, 19, 14, 20, 0, 0).__nanoc_to_iso8601_date)
@@ -1,3 +1,5 @@
1
+ require 'helper'
2
+
1
3
  class Nanoc::Extra::LinkCollectorTest < Nanoc::TestCase
2
4
  def test_all
3
5
  # Create dummy data
@@ -1,3 +1,5 @@
1
+ require 'helper'
2
+
1
3
  class Nanoc::Extra::PiperTest < Nanoc::TestCase
2
4
  def test_basic
3
5
  stdout = StringIO.new
@@ -1,3 +1,5 @@
1
+ require 'helper'
2
+
1
3
  class Nanoc::Filters::ColorizeSyntax::CoderayTest < Nanoc::TestCase
2
4
  CODERAY_PRE = '<div class="CodeRay"><div class="code">'.freeze
3
5
  CODERAY_POST = '</div></div>'.freeze
@@ -1,3 +1,5 @@
1
+ require 'helper'
2
+
1
3
  class Nanoc::Filters::ColorizeSyntax::CommonTest < Nanoc::TestCase
2
4
  def test_dummy
3
5
  if_have 'nokogiri' do
@@ -1,3 +1,5 @@
1
+ require 'helper'
2
+
1
3
  class Nanoc::Filters::ColorizeSyntax::PygmentizeTest < Nanoc::TestCase
2
4
  def test_pygmentize
3
5
  if_have 'nokogiri' do
@@ -1,3 +1,5 @@
1
+ require 'helper'
2
+
1
3
  class Nanoc::Filters::ColorizeSyntax::PygmentsTest < Nanoc::TestCase
2
4
  def test_pygmentsrb
3
5
  skip 'pygments.rb does not support Windows' if on_windows?
@@ -1,3 +1,5 @@
1
+ require 'helper'
2
+
1
3
  class Nanoc::Filters::ColorizeSyntax::SimonTest < Nanoc::TestCase
2
4
  def test_simon_highlight
3
5
  if_have 'nokogiri' do
@@ -1,3 +1,5 @@
1
+ require 'helper'
2
+
1
3
  class Nanoc::Filters::AsciiDocTest < Nanoc::TestCase
2
4
  def test_filter
3
5
  skip_unless_have_command 'asciidoc'
@@ -1,3 +1,5 @@
1
+ require 'helper'
2
+
1
3
  class Nanoc::Filters::BlueClothTest < Nanoc::TestCase
2
4
  def test_filter
3
5
  if_have 'bluecloth' do
@@ -1,3 +1,5 @@
1
+ require 'helper'
2
+
1
3
  class Nanoc::Filters::CoffeeScriptTest < Nanoc::TestCase
2
4
  def test_filter
3
5
  skip_v8_on_ruby24
@@ -1,7 +1,9 @@
1
+ require 'helper'
2
+
1
3
  class Nanoc::Filters::ERBTest < Nanoc::TestCase
2
4
  def test_filter_with_instance_variable
3
5
  # Create filter
4
- filter = ::Nanoc::Filters::ERB.new({ location: 'a cheap motel' })
6
+ filter = ::Nanoc::Filters::ERB.new(location: 'a cheap motel')
5
7
 
6
8
  # Run filter
7
9
  result = filter.setup_and_run('<%= "I was hiding in #{@location}." %>')
@@ -10,7 +12,7 @@ class Nanoc::Filters::ERBTest < Nanoc::TestCase
10
12
 
11
13
  def test_filter_with_instance_method
12
14
  # Create filter
13
- filter = ::Nanoc::Filters::ERB.new({ location: 'a cheap motel' })
15
+ filter = ::Nanoc::Filters::ERB.new(location: 'a cheap motel')
14
16
 
15
17
  # Run filter
16
18
  result = filter.setup_and_run('<%= "I was hiding in #{location}." %>')
@@ -45,7 +47,7 @@ class Nanoc::Filters::ERBTest < Nanoc::TestCase
45
47
 
46
48
  def test_filter_with_yield
47
49
  # Create filter
48
- filter = ::Nanoc::Filters::ERB.new({ content: 'a cheap motel' })
50
+ filter = ::Nanoc::Filters::ERB.new(content: 'a cheap motel')
49
51
 
50
52
  # Run filter
51
53
  result = filter.setup_and_run('<%= "I was hiding in #{yield}." %>')
@@ -54,7 +56,7 @@ class Nanoc::Filters::ERBTest < Nanoc::TestCase
54
56
 
55
57
  def test_filter_with_yield_without_content
56
58
  # Create filter
57
- filter = ::Nanoc::Filters::ERB.new({ location: 'a cheap motel' })
59
+ filter = ::Nanoc::Filters::ERB.new(location: 'a cheap motel')
58
60
 
59
61
  # Run filter
60
62
  assert_raises LocalJumpError do
@@ -83,7 +85,7 @@ class Nanoc::Filters::ERBTest < Nanoc::TestCase
83
85
 
84
86
  def test_trim_mode
85
87
  # Set up
86
- filter = ::Nanoc::Filters::ERB.new({ location: 'a cheap motel' })
88
+ filter = ::Nanoc::Filters::ERB.new(location: 'a cheap motel')
87
89
  $trim_mode_works = false
88
90
 
89
91
  # Without
@@ -1,8 +1,10 @@
1
+ require 'helper'
2
+
1
3
  class Nanoc::Filters::ErubisTest < Nanoc::TestCase
2
4
  def test_filter_with_instance_variable
3
5
  if_have 'erubis' do
4
6
  # Create filter
5
- filter = ::Nanoc::Filters::Erubis.new({ location: 'a cheap motel' })
7
+ filter = ::Nanoc::Filters::Erubis.new(location: 'a cheap motel')
6
8
 
7
9
  # Run filter
8
10
  result = filter.setup_and_run('<%= "I was hiding in #{@location}." %>')
@@ -13,7 +15,7 @@ class Nanoc::Filters::ErubisTest < Nanoc::TestCase
13
15
  def test_filter_with_instance_method
14
16
  if_have 'erubis' do
15
17
  # Create filter
16
- filter = ::Nanoc::Filters::Erubis.new({ location: 'a cheap motel' })
18
+ filter = ::Nanoc::Filters::Erubis.new(location: 'a cheap motel')
17
19
 
18
20
  # Run filter
19
21
  result = filter.setup_and_run('<%= "I was hiding in #{location}." %>')
@@ -42,7 +44,7 @@ class Nanoc::Filters::ErubisTest < Nanoc::TestCase
42
44
  def test_filter_with_yield
43
45
  if_have 'erubis' do
44
46
  # Create filter
45
- filter = ::Nanoc::Filters::Erubis.new({ content: 'a cheap motel' })
47
+ filter = ::Nanoc::Filters::Erubis.new(content: 'a cheap motel')
46
48
 
47
49
  # Run filter
48
50
  result = filter.setup_and_run('<%= "I was hiding in #{yield}." %>')
@@ -53,7 +55,7 @@ class Nanoc::Filters::ErubisTest < Nanoc::TestCase
53
55
  def test_filter_with_yield_without_content
54
56
  if_have 'erubis' do
55
57
  # Create filter
56
- filter = ::Nanoc::Filters::Erubis.new({ location: 'a cheap motel' })
58
+ filter = ::Nanoc::Filters::Erubis.new(location: 'a cheap motel')
57
59
 
58
60
  # Run filter
59
61
  assert_raises LocalJumpError do
@@ -1,8 +1,10 @@
1
+ require 'helper'
2
+
1
3
  class Nanoc::Filters::HamlTest < Nanoc::TestCase
2
4
  def test_filter
3
5
  if_have 'haml' do
4
6
  # Create filter
5
- filter = ::Nanoc::Filters::Haml.new({ question: 'Is this the Payne residence?' })
7
+ filter = ::Nanoc::Filters::Haml.new(question: 'Is this the Payne residence?')
6
8
 
7
9
  # Run filter (no assigns)
8
10
  result = filter.setup_and_run('%html')
@@ -21,7 +23,7 @@ class Nanoc::Filters::HamlTest < Nanoc::TestCase
21
23
  def test_filter_with_params
22
24
  if_have 'haml' do
23
25
  # Create filter
24
- filter = ::Nanoc::Filters::Haml.new({ foo: 'bar' })
26
+ filter = ::Nanoc::Filters::Haml.new(foo: 'bar')
25
27
 
26
28
  # Check with HTML5
27
29
  result = filter.setup_and_run('%img', format: :html5)
@@ -36,7 +38,7 @@ class Nanoc::Filters::HamlTest < Nanoc::TestCase
36
38
  def test_filter_error
37
39
  if_have 'haml' do
38
40
  # Create filter
39
- filter = ::Nanoc::Filters::Haml.new({ foo: 'bar' })
41
+ filter = ::Nanoc::Filters::Haml.new(foo: 'bar')
40
42
 
41
43
  # Run filter
42
44
  raised = false
@@ -54,7 +56,7 @@ class Nanoc::Filters::HamlTest < Nanoc::TestCase
54
56
  def test_filter_with_yield
55
57
  if_have 'haml' do
56
58
  # Create filter
57
- filter = ::Nanoc::Filters::Haml.new({ content: 'Is this the Payne residence?' })
59
+ filter = ::Nanoc::Filters::Haml.new(content: 'Is this the Payne residence?')
58
60
 
59
61
  # Run filter
60
62
  result = filter.setup_and_run('%p= yield')
@@ -65,7 +67,7 @@ class Nanoc::Filters::HamlTest < Nanoc::TestCase
65
67
  def test_filter_with_yield_without_content
66
68
  if_have 'haml' do
67
69
  # Create filter
68
- filter = ::Nanoc::Filters::Haml.new({ location: 'Is this the Payne residence?' })
70
+ filter = ::Nanoc::Filters::Haml.new(location: 'Is this the Payne residence?')
69
71
 
70
72
  # Run filter
71
73
  assert_raises LocalJumpError do
@@ -1,3 +1,5 @@
1
+ require 'helper'
2
+
1
3
  class Nanoc::Filters::HandlebarsTest < Nanoc::TestCase
2
4
  def test_filter
3
5
  skip_v8_on_ruby24
@@ -1,3 +1,5 @@
1
+ require 'helper'
2
+
1
3
  class Nanoc::Filters::KramdownTest < Nanoc::TestCase
2
4
  def test_filter
3
5
  if_have 'kramdown' do
@@ -1,3 +1,5 @@
1
+ require 'helper'
2
+
1
3
  class Nanoc::Filters::MarkabyTest < Nanoc::TestCase
2
4
  def test_filter
3
5
  if_have 'markaby' do
@@ -1,3 +1,5 @@
1
+ require 'helper'
2
+
1
3
  class Nanoc::Filters::MarukuTest < Nanoc::TestCase
2
4
  def test_filter
3
5
  if_have 'maruku' do
@@ -1,3 +1,5 @@
1
+ require 'helper'
2
+
1
3
  class Nanoc::Filters::MustacheTest < Nanoc::TestCase
2
4
  def test_filter
3
5
  if_have 'mustache' do
@@ -9,7 +11,7 @@ class Nanoc::Filters::MustacheTest < Nanoc::TestCase
9
11
  )
10
12
 
11
13
  # Create filter
12
- filter = ::Nanoc::Filters::Mustache.new({ item: item })
14
+ filter = ::Nanoc::Filters::Mustache.new(item: item)
13
15
 
14
16
  # Run filter
15
17
  result = filter.setup_and_run('The protagonist of {{title}} is {{protagonist}}.')
@@ -28,7 +30,7 @@ class Nanoc::Filters::MustacheTest < Nanoc::TestCase
28
30
 
29
31
  # Create filter
30
32
  filter = ::Nanoc::Filters::Mustache.new(
31
- { content: 'No Payne No Gayne', item: item },
33
+ content: 'No Payne No Gayne', item: item,
32
34
  )
33
35
 
34
36
  # Run filter
@@ -1,3 +1,5 @@
1
+ require 'helper'
2
+
1
3
  class Nanoc::Filters::PandocTest < Nanoc::TestCase
2
4
  def test_filter
3
5
  if_have 'pandoc-ruby' do
@@ -1,3 +1,5 @@
1
+ require 'helper'
2
+
1
3
  class Nanoc::Filters::RainpressTest < Nanoc::TestCase
2
4
  def test_filter
3
5
  if_have 'rainpress' do
@@ -1,3 +1,5 @@
1
+ require 'helper'
2
+
1
3
  class Nanoc::Filters::RDiscountTest < Nanoc::TestCase
2
4
  def test_filter
3
5
  if_have 'rdiscount' do
@@ -1,3 +1,5 @@
1
+ require 'helper'
2
+
1
3
  class Nanoc::Filters::RDocTest < Nanoc::TestCase
2
4
  def test_filter
3
5
  # Get filter
@@ -1,3 +1,5 @@
1
+ require 'helper'
2
+
1
3
  class Nanoc::Filters::RedcarpetTest < Nanoc::TestCase
2
4
  def test_find
3
5
  if_have 'redcarpet' do
@@ -1,3 +1,5 @@
1
+ require 'helper'
2
+
1
3
  class Nanoc::Filters::RedClothTest < Nanoc::TestCase
2
4
  def test_filter
3
5
  if_have 'redcloth' do
@@ -1,3 +1,5 @@
1
+ require 'helper'
2
+
1
3
  class Nanoc::Filters::RelativizePathsTest < Nanoc::TestCase
2
4
  def test_filter_html_with_double_quotes
3
5
  # Create filter with mock item
@@ -1,3 +1,5 @@
1
+ require 'helper'
2
+
1
3
  class Nanoc::Filters::RubyPantsTest < Nanoc::TestCase
2
4
  def test_filter
3
5
  if_have 'rubypants' do
@@ -1,3 +1,5 @@
1
+ require 'helper'
2
+
1
3
  class Nanoc::Filters::SassTest < Nanoc::TestCase
2
4
  def setup
3
5
  super
@@ -12,7 +14,7 @@ class Nanoc::Filters::SassTest < Nanoc::TestCase
12
14
  def test_filter
13
15
  if_have 'sass' do
14
16
  # Get filter
15
- filter = create_filter({ foo: 'bar' })
17
+ filter = create_filter(foo: 'bar')
16
18
 
17
19
  # Run filter
18
20
  result = filter.setup_and_run(".foo #bar\n color: #f00")
@@ -23,7 +25,7 @@ class Nanoc::Filters::SassTest < Nanoc::TestCase
23
25
  def test_filter_with_params
24
26
  if_have 'sass' do
25
27
  # Create filter
26
- filter = create_filter({ foo: 'bar' })
28
+ filter = create_filter(foo: 'bar')
27
29
 
28
30
  # Check with compact
29
31
  result = filter.setup_and_run(".foo #bar\n color: #f00", style: 'compact')
@@ -1,8 +1,10 @@
1
+ require 'helper'
2
+
1
3
  class Nanoc::Filters::SlimTest < Nanoc::TestCase
2
4
  def test_filter
3
5
  if_have 'slim' do
4
6
  # Create filter
5
- filter = ::Nanoc::Filters::Slim.new({ rabbit: 'The rabbit is on the branch.' })
7
+ filter = ::Nanoc::Filters::Slim.new(rabbit: 'The rabbit is on the branch.')
6
8
 
7
9
  # Run filter (no assigns)
8
10
  result = filter.setup_and_run('html')
@@ -20,7 +22,7 @@ class Nanoc::Filters::SlimTest < Nanoc::TestCase
20
22
 
21
23
  def test_filter_with_yield
22
24
  if_have 'slim' do
23
- filter = ::Nanoc::Filters::Slim.new({ content: 'The rabbit is on the branch.' })
25
+ filter = ::Nanoc::Filters::Slim.new(content: 'The rabbit is on the branch.')
24
26
 
25
27
  result = filter.setup_and_run('p = yield')
26
28
  assert_equal('<p>The rabbit is on the branch.</p>', result)
@@ -1,3 +1,5 @@
1
+ require 'helper'
2
+
1
3
  class Nanoc::Filters::TypogrubyTest < Nanoc::TestCase
2
4
  def test_filter
3
5
  if_have 'typogruby' do
@@ -1,3 +1,5 @@
1
+ require 'helper'
2
+
1
3
  class Nanoc::Filters::UglifyJSTest < Nanoc::TestCase
2
4
  def test_filter
3
5
  skip_v8_on_ruby24
@@ -1,3 +1,5 @@
1
+ require 'helper'
2
+
1
3
  require 'tempfile'
2
4
 
3
5
  class Nanoc::Filters::XSLTest < Nanoc::TestCase
@@ -1,3 +1,5 @@
1
+ require 'helper'
2
+
1
3
  class Nanoc::Filters::YUICompressorTest < Nanoc::TestCase
2
4
  def test_filter_javascript
3
5
  if_have 'yuicompressor' do
@@ -13,10 +15,10 @@ class Nanoc::Filters::YUICompressorTest < Nanoc::TestCase
13
15
  }
14
16
  JAVASCRIPT
15
17
 
16
- result = filter.setup_and_run(sample_js, { type: 'js', munge: true })
18
+ result = filter.setup_and_run(sample_js, type: 'js', munge: true)
17
19
  assert_match 'function factorial(c){var a=1;for(var b=2;b<=c;b++){a*=b}return a};', result
18
20
 
19
- result = filter.setup_and_run(sample_js, { type: 'js', munge: false })
21
+ result = filter.setup_and_run(sample_js, type: 'js', munge: false)
20
22
  assert_match 'function factorial(n){var result=1;for(var i=2;i<=n;i++){result*=i}return result};', result
21
23
  end
22
24
  end
@@ -31,7 +33,7 @@ class Nanoc::Filters::YUICompressorTest < Nanoc::TestCase
31
33
  }
32
34
  CSS
33
35
 
34
- result = filter.setup_and_run(sample_css, { type: 'css' })
36
+ result = filter.setup_and_run(sample_css, type: 'css')
35
37
  assert_match '*{margin:0}', result
36
38
  end
37
39
  end
@@ -1,3 +1,5 @@
1
+ require 'helper'
2
+
1
3
  class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
2
4
  include Nanoc::Helpers::Blogging
3
5
  include Nanoc::Helpers::Text
@@ -1,3 +1,5 @@
1
+ require 'helper'
2
+
1
3
  class Nanoc::Helpers::CapturingTest < Nanoc::TestCase
2
4
  include Nanoc::Helpers::Capturing
3
5
 
@@ -1,3 +1,5 @@
1
+ require 'helper'
2
+
1
3
  class Nanoc::Helpers::LinkToTest < Nanoc::TestCase
2
4
  include Nanoc::Helpers::LinkTo
3
5
 
@@ -1,3 +1,5 @@
1
+ require 'helper'
2
+
1
3
  class Nanoc::Helpers::XMLSitemapTest < Nanoc::TestCase
2
4
  include Nanoc::Helpers::XMLSitemap
3
5
 
@@ -1,3 +1,5 @@
1
+ require 'helper'
2
+
1
3
  class Nanoc::RuleDSL::ActionProviderTest < Nanoc::TestCase
2
4
  def new_action_provider(site)
3
5
  rules_collection = Nanoc::RuleDSL::RulesCollection.new
@@ -1,3 +1,5 @@
1
+ require 'helper'
2
+
1
3
  class Nanoc::RuleDSL::CompilerDSLTest < Nanoc::TestCase
2
4
  def test_compile
3
5
  # TODO: implement
@@ -290,7 +292,7 @@ EOS
290
292
  end
291
293
 
292
294
  def test_create_pattern_with_string_with_glob_string_pattern_type
293
- compiler_dsl = Nanoc::RuleDSL::CompilerDSL.new(nil, { string_pattern_type: 'glob' })
295
+ compiler_dsl = Nanoc::RuleDSL::CompilerDSL.new(nil, string_pattern_type: 'glob')
294
296
 
295
297
  pattern = compiler_dsl.create_pattern('/foo/*')
296
298
  assert pattern.match?('/foo/aaaa')
@@ -299,14 +301,14 @@ EOS
299
301
  end
300
302
 
301
303
  def test_create_pattern_with_regex
302
- compiler_dsl = Nanoc::RuleDSL::CompilerDSL.new(nil, { string_pattern_type: 'glob' })
304
+ compiler_dsl = Nanoc::RuleDSL::CompilerDSL.new(nil, string_pattern_type: 'glob')
303
305
 
304
306
  pattern = compiler_dsl.create_pattern(%r{\A/foo/a*/})
305
307
  assert pattern.match?('/foo/aaaa/')
306
308
  end
307
309
 
308
310
  def test_create_pattern_with_string_with_unknown_string_pattern_type
309
- compiler_dsl = Nanoc::RuleDSL::CompilerDSL.new(nil, { string_pattern_type: 'donkey' })
311
+ compiler_dsl = Nanoc::RuleDSL::CompilerDSL.new(nil, string_pattern_type: 'donkey')
310
312
 
311
313
  err = assert_raises(Nanoc::Int::Errors::GenericTrivial) do
312
314
  compiler_dsl.create_pattern('/foo/*')
@@ -437,7 +439,7 @@ EOS
437
439
 
438
440
  def test_config
439
441
  $venetian = 'unsnares'
440
- compiler_dsl = Nanoc::RuleDSL::CompilerDSL.new(nil, { venetian: 'snares' })
442
+ compiler_dsl = Nanoc::RuleDSL::CompilerDSL.new(nil, venetian: 'snares')
441
443
  compiler_dsl.instance_eval { $venetian = @config[:venetian] }
442
444
  assert_equal 'snares', $venetian
443
445
  end
@@ -1,3 +1,5 @@
1
+ require 'helper'
2
+
1
3
  class Nanoc::Int::RuleTest < Nanoc::TestCase
2
4
  def test_initialize
3
5
  # TODO: implement
@@ -1,3 +1,5 @@
1
+ require 'helper'
2
+
1
3
  class Nanoc::RuleDSL::RulesCollectionTest < Nanoc::TestCase
2
4
  def test_compilation_rule_for
3
5
  # Mock rules
data/test/test_gem.rb CHANGED
@@ -1,3 +1,5 @@
1
+ require 'helper'
2
+
1
3
  class Nanoc::GemTest < Nanoc::TestCase
2
4
  def setup
3
5
  super