nanoc 3.7.4 → 3.7.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (284) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +19 -18
  3. data/LICENSE +1 -1
  4. data/NEWS.md +14 -0
  5. data/Rakefile +1 -1
  6. data/doc/yardoc_handlers/identifier.rb +1 -5
  7. data/lib/nanoc.rb +1 -3
  8. data/lib/nanoc/base.rb +1 -4
  9. data/lib/nanoc/base/checksummer.rb +10 -12
  10. data/lib/nanoc/base/compilation/checksum_store.rb +0 -4
  11. data/lib/nanoc/base/compilation/compiled_content_cache.rb +0 -4
  12. data/lib/nanoc/base/compilation/compiler.rb +27 -31
  13. data/lib/nanoc/base/compilation/compiler_dsl.rb +3 -7
  14. data/lib/nanoc/base/compilation/dependency_tracker.rb +2 -6
  15. data/lib/nanoc/base/compilation/filter.rb +1 -7
  16. data/lib/nanoc/base/compilation/item_rep_proxy.rb +0 -4
  17. data/lib/nanoc/base/compilation/item_rep_recorder_proxy.rb +0 -4
  18. data/lib/nanoc/base/compilation/outdatedness_checker.rb +0 -4
  19. data/lib/nanoc/base/compilation/outdatedness_reasons.rb +0 -6
  20. data/lib/nanoc/base/compilation/rule.rb +1 -5
  21. data/lib/nanoc/base/compilation/rule_context.rb +7 -11
  22. data/lib/nanoc/base/compilation/rule_memory_calculator.rb +0 -4
  23. data/lib/nanoc/base/compilation/rule_memory_store.rb +0 -4
  24. data/lib/nanoc/base/compilation/rules_collection.rb +5 -9
  25. data/lib/nanoc/base/context.rb +0 -3
  26. data/lib/nanoc/base/core_ext.rb +0 -1
  27. data/lib/nanoc/base/core_ext/array.rb +0 -2
  28. data/lib/nanoc/base/core_ext/hash.rb +0 -2
  29. data/lib/nanoc/base/core_ext/pathname.rb +0 -2
  30. data/lib/nanoc/base/core_ext/string.rb +0 -2
  31. data/lib/nanoc/base/directed_graph.rb +0 -4
  32. data/lib/nanoc/base/errors.rb +1 -39
  33. data/lib/nanoc/base/memoization.rb +0 -4
  34. data/lib/nanoc/base/notification_center.rb +1 -7
  35. data/lib/nanoc/base/plugin_registry.rb +4 -10
  36. data/lib/nanoc/base/result_data/item_rep.rb +8 -16
  37. data/lib/nanoc/base/source_data/code_snippet.rb +1 -5
  38. data/lib/nanoc/base/source_data/configuration.rb +0 -4
  39. data/lib/nanoc/base/source_data/data_source.rb +2 -5
  40. data/lib/nanoc/base/source_data/item.rb +3 -7
  41. data/lib/nanoc/base/source_data/item_array.rb +1 -5
  42. data/lib/nanoc/base/source_data/layout.rb +2 -6
  43. data/lib/nanoc/base/source_data/site.rb +20 -23
  44. data/lib/nanoc/base/store.rb +1 -5
  45. data/lib/nanoc/base/temp_filename_factory.rb +0 -4
  46. data/lib/nanoc/cli.rb +3 -5
  47. data/lib/nanoc/cli/ansi_string_colorizer.rb +6 -10
  48. data/lib/nanoc/cli/cleaning_stream.rb +2 -6
  49. data/lib/nanoc/cli/command_runner.rb +1 -5
  50. data/lib/nanoc/cli/commands/autocompile.rb +2 -6
  51. data/lib/nanoc/cli/commands/check.rb +0 -4
  52. data/lib/nanoc/cli/commands/compile.rb +12 -27
  53. data/lib/nanoc/cli/commands/create-item.rb +1 -5
  54. data/lib/nanoc/cli/commands/create-layout.rb +0 -4
  55. data/lib/nanoc/cli/commands/create-site.rb +2 -8
  56. data/lib/nanoc/cli/commands/deploy.rb +3 -7
  57. data/lib/nanoc/cli/commands/prune.rb +2 -6
  58. data/lib/nanoc/cli/commands/shell.rb +4 -8
  59. data/lib/nanoc/cli/commands/show-data.rb +3 -7
  60. data/lib/nanoc/cli/commands/show-plugins.rb +3 -7
  61. data/lib/nanoc/cli/commands/show-rules.rb +11 -15
  62. data/lib/nanoc/cli/commands/sync.rb +0 -4
  63. data/lib/nanoc/cli/commands/update.rb +1 -7
  64. data/lib/nanoc/cli/commands/validate-css.rb +0 -4
  65. data/lib/nanoc/cli/commands/validate-html.rb +0 -4
  66. data/lib/nanoc/cli/commands/validate-links.rb +0 -4
  67. data/lib/nanoc/cli/commands/view.rb +3 -7
  68. data/lib/nanoc/cli/commands/watch.rb +4 -10
  69. data/lib/nanoc/cli/error_handler.rb +9 -13
  70. data/lib/nanoc/cli/logger.rb +8 -12
  71. data/lib/nanoc/cli/stream_cleaners.rb +0 -4
  72. data/lib/nanoc/cli/stream_cleaners/abstract.rb +1 -5
  73. data/lib/nanoc/cli/stream_cleaners/ansi_colors.rb +0 -4
  74. data/lib/nanoc/cli/stream_cleaners/utf8.rb +1 -5
  75. data/lib/nanoc/data_sources.rb +2 -4
  76. data/lib/nanoc/data_sources/deprecated/delicious.rb +6 -10
  77. data/lib/nanoc/data_sources/deprecated/last_fm.rb +7 -11
  78. data/lib/nanoc/data_sources/deprecated/twitter.rb +2 -6
  79. data/lib/nanoc/data_sources/filesystem.rb +10 -13
  80. data/lib/nanoc/data_sources/filesystem_unified.rb +0 -4
  81. data/lib/nanoc/data_sources/filesystem_verbose.rb +0 -4
  82. data/lib/nanoc/data_sources/static.rb +4 -8
  83. data/lib/nanoc/extra.rb +2 -4
  84. data/lib/nanoc/extra/auto_compiler.rb +2 -6
  85. data/lib/nanoc/extra/checking.rb +0 -4
  86. data/lib/nanoc/extra/checking/check.rb +0 -4
  87. data/lib/nanoc/extra/checking/checks.rb +0 -2
  88. data/lib/nanoc/extra/checking/checks/css.rb +6 -6
  89. data/lib/nanoc/extra/checking/checks/external_links.rb +3 -11
  90. data/lib/nanoc/extra/checking/checks/html.rb +6 -6
  91. data/lib/nanoc/extra/checking/checks/internal_links.rb +3 -7
  92. data/lib/nanoc/extra/checking/checks/stale.rb +3 -7
  93. data/lib/nanoc/extra/checking/dsl.rb +0 -4
  94. data/lib/nanoc/extra/checking/issue.rb +0 -4
  95. data/lib/nanoc/extra/checking/runner.rb +4 -7
  96. data/lib/nanoc/extra/chick.rb +7 -17
  97. data/lib/nanoc/extra/core_ext.rb +0 -1
  98. data/lib/nanoc/extra/core_ext/pathname.rb +0 -4
  99. data/lib/nanoc/extra/core_ext/time.rb +0 -2
  100. data/lib/nanoc/extra/deployer.rb +0 -4
  101. data/lib/nanoc/extra/deployers.rb +0 -4
  102. data/lib/nanoc/extra/deployers/fog.rb +7 -11
  103. data/lib/nanoc/extra/deployers/rsync.rb +1 -5
  104. data/lib/nanoc/extra/file_proxy.rb +1 -5
  105. data/lib/nanoc/extra/filesystem_tools.rb +37 -12
  106. data/lib/nanoc/extra/jruby_nokogiri_warner.rb +0 -4
  107. data/lib/nanoc/extra/link_collector.rb +3 -7
  108. data/lib/nanoc/extra/piper.rb +0 -6
  109. data/lib/nanoc/extra/pruner.rb +1 -7
  110. data/lib/nanoc/extra/validators.rb +0 -4
  111. data/lib/nanoc/extra/validators/links.rb +0 -4
  112. data/lib/nanoc/extra/validators/w3c.rb +0 -4
  113. data/lib/nanoc/extra/vcs.rb +3 -7
  114. data/lib/nanoc/extra/vcses.rb +0 -2
  115. data/lib/nanoc/extra/vcses/bazaar.rb +0 -4
  116. data/lib/nanoc/extra/vcses/dummy.rb +0 -4
  117. data/lib/nanoc/extra/vcses/git.rb +0 -4
  118. data/lib/nanoc/extra/vcses/mercurial.rb +0 -4
  119. data/lib/nanoc/extra/vcses/subversion.rb +0 -4
  120. data/lib/nanoc/filters.rb +0 -2
  121. data/lib/nanoc/filters/asciidoc.rb +1 -5
  122. data/lib/nanoc/filters/bluecloth.rb +0 -2
  123. data/lib/nanoc/filters/coderay.rb +0 -2
  124. data/lib/nanoc/filters/coffeescript.rb +0 -4
  125. data/lib/nanoc/filters/colorize_syntax.rb +17 -15
  126. data/lib/nanoc/filters/erb.rb +1 -3
  127. data/lib/nanoc/filters/erubis.rb +2 -4
  128. data/lib/nanoc/filters/haml.rb +2 -4
  129. data/lib/nanoc/filters/handlebars.rb +0 -4
  130. data/lib/nanoc/filters/kramdown.rb +7 -4
  131. data/lib/nanoc/filters/less.rb +1 -3
  132. data/lib/nanoc/filters/markaby.rb +0 -2
  133. data/lib/nanoc/filters/maruku.rb +0 -2
  134. data/lib/nanoc/filters/mustache.rb +1 -5
  135. data/lib/nanoc/filters/pandoc.rb +0 -2
  136. data/lib/nanoc/filters/rainpress.rb +0 -2
  137. data/lib/nanoc/filters/rdiscount.rb +0 -2
  138. data/lib/nanoc/filters/rdoc.rb +0 -2
  139. data/lib/nanoc/filters/redcarpet.rb +0 -4
  140. data/lib/nanoc/filters/redcloth.rb +0 -2
  141. data/lib/nanoc/filters/relativize_paths.rb +2 -4
  142. data/lib/nanoc/filters/rubypants.rb +0 -2
  143. data/lib/nanoc/filters/sass.rb +2 -4
  144. data/lib/nanoc/filters/sass/sass_filesystem_importer.rb +0 -2
  145. data/lib/nanoc/filters/slim.rb +2 -6
  146. data/lib/nanoc/filters/typogruby.rb +0 -4
  147. data/lib/nanoc/filters/uglify_js.rb +0 -2
  148. data/lib/nanoc/filters/xsl.rb +1 -5
  149. data/lib/nanoc/filters/yui_compressor.rb +0 -4
  150. data/lib/nanoc/helpers.rb +0 -2
  151. data/lib/nanoc/helpers/blogging.rb +12 -20
  152. data/lib/nanoc/helpers/breadcrumbs.rb +0 -4
  153. data/lib/nanoc/helpers/capturing.rb +2 -10
  154. data/lib/nanoc/helpers/filtering.rb +0 -4
  155. data/lib/nanoc/helpers/html_escape.rb +3 -7
  156. data/lib/nanoc/helpers/link_to.rb +0 -4
  157. data/lib/nanoc/helpers/rendering.rb +8 -12
  158. data/lib/nanoc/helpers/tagging.rb +0 -4
  159. data/lib/nanoc/helpers/text.rb +1 -5
  160. data/lib/nanoc/helpers/xml_sitemap.rb +3 -7
  161. data/lib/nanoc/tasks/clean.rb +1 -7
  162. data/lib/nanoc/tasks/deploy/rsync.rake +0 -2
  163. data/lib/nanoc/tasks/validate.rake +0 -4
  164. data/lib/nanoc/version.rb +1 -3
  165. data/nanoc.gemspec +12 -9
  166. data/tasks/rubocop.rake +1 -1
  167. data/tasks/test.rake +6 -7
  168. data/test/base/checksummer_spec.rb +28 -44
  169. data/test/base/core_ext/array_spec.rb +1 -9
  170. data/test/base/core_ext/hash_spec.rb +7 -19
  171. data/test/base/core_ext/pathname_spec.rb +2 -4
  172. data/test/base/core_ext/string_spec.rb +0 -4
  173. data/test/base/temp_filename_factory_spec.rb +0 -8
  174. data/test/base/test_checksum_store.rb +0 -2
  175. data/test/base/test_code_snippet.rb +0 -2
  176. data/test/base/test_compiler.rb +15 -17
  177. data/test/base/test_compiler_dsl.rb +7 -9
  178. data/test/base/test_context.rb +2 -4
  179. data/test/base/test_data_source.rb +0 -2
  180. data/test/base/test_dependency_tracker.rb +0 -2
  181. data/test/base/test_directed_graph.rb +2 -4
  182. data/test/base/test_filter.rb +5 -7
  183. data/test/base/test_item.rb +17 -13
  184. data/test/base/test_item_array.rb +2 -4
  185. data/test/base/test_item_rep.rb +79 -73
  186. data/test/base/test_layout.rb +3 -5
  187. data/test/base/test_memoization.rb +13 -21
  188. data/test/base/test_notification_center.rb +0 -2
  189. data/test/base/test_outdatedness_checker.rb +34 -36
  190. data/test/base/test_plugin.rb +0 -2
  191. data/test/base/test_rule.rb +3 -5
  192. data/test/base/test_rule_context.rb +4 -6
  193. data/test/base/test_site.rb +9 -17
  194. data/test/base/test_store.rb +2 -6
  195. data/test/cli/commands/test_check.rb +1 -3
  196. data/test/cli/commands/test_compile.rb +24 -15
  197. data/test/cli/commands/test_create_item.rb +1 -3
  198. data/test/cli/commands/test_create_layout.rb +0 -2
  199. data/test/cli/commands/test_create_site.rb +0 -3
  200. data/test/cli/commands/test_deploy.rb +9 -11
  201. data/test/cli/commands/test_help.rb +0 -2
  202. data/test/cli/commands/test_info.rb +0 -2
  203. data/test/cli/commands/test_prune.rb +6 -8
  204. data/test/cli/commands/test_sync.rb +0 -2
  205. data/test/cli/commands/test_update.rb +0 -2
  206. data/test/cli/commands/test_watch.rb +4 -6
  207. data/test/cli/test_cleaning_stream.rb +4 -6
  208. data/test/cli/test_cli.rb +9 -5
  209. data/test/cli/test_error_handler.rb +9 -7
  210. data/test/cli/test_logger.rb +0 -2
  211. data/test/data_sources/test_filesystem.rb +8 -10
  212. data/test/data_sources/test_filesystem_unified.rb +35 -34
  213. data/test/data_sources/test_filesystem_verbose.rb +31 -33
  214. data/test/data_sources/test_static.rb +20 -21
  215. data/test/extra/checking/checks/test_css.rb +23 -2
  216. data/test/extra/checking/checks/test_external_links.rb +2 -4
  217. data/test/extra/checking/checks/test_html.rb +4 -3
  218. data/test/extra/checking/checks/test_internal_links.rb +1 -3
  219. data/test/extra/checking/checks/test_stale.rb +4 -6
  220. data/test/extra/checking/test_check.rb +0 -2
  221. data/test/extra/checking/test_dsl.rb +1 -3
  222. data/test/extra/checking/test_runner.rb +0 -2
  223. data/test/extra/core_ext/test_pathname.rb +0 -3
  224. data/test/extra/core_ext/test_time.rb +0 -2
  225. data/test/extra/deployers/test_fog.rb +13 -15
  226. data/test/extra/deployers/test_rsync.rb +4 -6
  227. data/test/extra/test_auto_compiler.rb +47 -25
  228. data/test/extra/test_file_proxy.rb +1 -3
  229. data/test/extra/test_filesystem_tools.rb +47 -7
  230. data/test/extra/test_link_collector.rb +0 -2
  231. data/test/extra/test_piper.rb +3 -5
  232. data/test/extra/test_vcs.rb +0 -2
  233. data/test/extra/validators/test_links.rb +0 -1
  234. data/test/extra/validators/test_w3c.rb +2 -4
  235. data/test/filters/test_asciidoc.rb +0 -2
  236. data/test/filters/test_bluecloth.rb +0 -2
  237. data/test/filters/test_coderay.rb +2 -4
  238. data/test/filters/test_coffeescript.rb +0 -2
  239. data/test/filters/test_colorize_syntax.rb +16 -18
  240. data/test/filters/test_erb.rb +12 -14
  241. data/test/filters/test_erubis.rb +4 -6
  242. data/test/filters/test_haml.rb +7 -9
  243. data/test/filters/test_handlebars.rb +10 -12
  244. data/test/filters/test_kramdown.rb +13 -1
  245. data/test/filters/test_less.rb +9 -11
  246. data/test/filters/test_markaby.rb +0 -2
  247. data/test/filters/test_maruku.rb +0 -2
  248. data/test/filters/test_mustache.rb +4 -6
  249. data/test/filters/test_pandoc.rb +1 -3
  250. data/test/filters/test_rainpress.rb +1 -3
  251. data/test/filters/test_rdiscount.rb +1 -3
  252. data/test/filters/test_rdoc.rb +0 -2
  253. data/test/filters/test_redcarpet.rb +6 -8
  254. data/test/filters/test_redcloth.rb +1 -3
  255. data/test/filters/test_relativize_paths.rb +29 -34
  256. data/test/filters/test_rubypants.rb +0 -2
  257. data/test/filters/test_sass.rb +8 -10
  258. data/test/filters/test_slim.rb +2 -4
  259. data/test/filters/test_typogruby.rb +0 -3
  260. data/test/filters/test_uglify_js.rb +2 -4
  261. data/test/filters/test_xsl.rb +16 -18
  262. data/test/filters/test_yui_compressor.rb +3 -5
  263. data/test/fixtures/vcr_cassettes/css_run_parse_error.yml +65 -0
  264. data/test/gem_loader.rb +1 -1
  265. data/test/helper.rb +11 -15
  266. data/test/helpers/test_blogging.rb +61 -63
  267. data/test/helpers/test_breadcrumbs.rb +0 -2
  268. data/test/helpers/test_capturing.rb +4 -6
  269. data/test/helpers/test_filtering.rb +2 -4
  270. data/test/helpers/test_html_escape.rb +0 -2
  271. data/test/helpers/test_link_to.rb +5 -6
  272. data/test/helpers/test_rendering.rb +2 -4
  273. data/test/helpers/test_tagging.rb +9 -11
  274. data/test/helpers/test_text.rb +6 -8
  275. data/test/helpers/test_xml_sitemap.rb +11 -13
  276. data/test/tasks/test_clean.rb +0 -2
  277. data/test/test_gem.rb +1 -3
  278. metadata +15 -14
  279. data/Gemfile.lock +0 -252
  280. data/lib/nanoc/base/core_ext/date.rb +0 -29
  281. data/lib/nanoc/base/ordered_hash.rb +0 -228
  282. data/lib/nanoc/extra/core_ext/enumerable.rb +0 -33
  283. data/test/base/core_ext/date_spec.rb +0 -15
  284. data/test/extra/core_ext/test_enumerable.rb +0 -28
@@ -1,7 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  class Nanoc::Filters::RubyPantsTest < Nanoc::TestCase
4
-
5
4
  def test_filter
6
5
  if_have 'rubypants' do
7
6
  # Get filter
@@ -12,5 +11,4 @@ class Nanoc::Filters::RubyPantsTest < Nanoc::TestCase
12
11
  assert_equal('Wait&#8212;what?', result)
13
12
  end
14
13
  end
15
-
16
14
  end
@@ -1,11 +1,10 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  class Nanoc::Filters::SassTest < Nanoc::TestCase
4
-
5
4
  def test_filter
6
5
  if_have 'sass' do
7
6
  # Get filter
8
- filter = create_filter({ :foo => 'bar' })
7
+ filter = create_filter({ foo: 'bar' })
9
8
 
10
9
  # Run filter
11
10
  result = filter.setup_and_run(".foo #bar\n color: #f00")
@@ -16,14 +15,14 @@ class Nanoc::Filters::SassTest < Nanoc::TestCase
16
15
  def test_filter_with_params
17
16
  if_have 'sass' do
18
17
  # Create filter
19
- filter = create_filter({ :foo => 'bar' })
18
+ filter = create_filter({ foo: 'bar' })
20
19
 
21
20
  # Check with compact
22
- result = filter.setup_and_run(".foo #bar\n color: #f00", :style => 'compact')
21
+ result = filter.setup_and_run(".foo #bar\n color: #f00", style: 'compact')
23
22
  assert_match(/^\.foo #bar[\s]*\{[\s]*color:\s*(red|#f00);?[\s]*\}/m, result)
24
23
 
25
24
  # Check with compressed
26
- result = filter.setup_and_run(".foo #bar\n color: #f00", :style => 'compressed')
25
+ result = filter.setup_and_run(".foo #bar\n color: #f00", style: 'compressed')
27
26
  assert_match(/^\.foo #bar[\s]*\{[\s]*color:\s*(red|#f00);?[\s]*\}/m, result)
28
27
  end
29
28
  end
@@ -64,7 +63,7 @@ class Nanoc::Filters::SassTest < Nanoc::TestCase
64
63
  filter = create_filter
65
64
 
66
65
  # Create sample file
67
- File.open('moo.sass', 'w') { |io| io.write %Q(@import subdir/relative) }
66
+ File.open('moo.sass', 'w') { |io| io.write %(@import subdir/relative) }
68
67
  FileUtils.mkdir_p('subdir')
69
68
  File.open('subdir/relative.sass', 'w') { |io| io.write "body\n color: red" }
70
69
 
@@ -275,14 +274,13 @@ class Nanoc::Filters::SassTest < Nanoc::TestCase
275
274
 
276
275
  def create_filter(params = {})
277
276
  FileUtils.mkdir_p('content')
278
- File.open('content/xyzzy.sass', 'w') { |io| io.write('p\n color: green')}
277
+ File.open('content/xyzzy.sass', 'w') { |io| io.write('p\n color: green') }
279
278
 
280
279
  items = [Nanoc::Item.new(
281
280
  'blah',
282
- { :content_filename => 'content/xyzzy.sass' },
281
+ { content_filename: 'content/xyzzy.sass' },
283
282
  '/blah/')]
284
- params = { :item => items[0], :items => items }.merge(params)
283
+ params = { item: items[0], items: items }.merge(params)
285
284
  ::Nanoc::Filters::Sass.new(params)
286
285
  end
287
-
288
286
  end
@@ -1,11 +1,10 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  class Nanoc::Filters::SlimTest < Nanoc::TestCase
4
-
5
4
  def test_filter
6
5
  if_have 'slim' do
7
6
  # Create filter
8
- 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.' })
9
8
 
10
9
  # Run filter (no assigns)
11
10
  result = filter.setup_and_run('html')
@@ -23,11 +22,10 @@ class Nanoc::Filters::SlimTest < Nanoc::TestCase
23
22
 
24
23
  def test_filter_with_yield
25
24
  if_have 'slim' do
26
- 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.' })
27
26
 
28
27
  result = filter.setup_and_run('p = yield')
29
28
  assert_equal('<p>The rabbit is on the branch.</p>', result)
30
29
  end
31
30
  end
32
-
33
31
  end
@@ -1,7 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  class Nanoc::Filters::TypogrubyTest < Nanoc::TestCase
4
-
5
4
  def test_filter
6
5
  if_have 'typogruby' do
7
6
  # Get filter
@@ -14,6 +13,4 @@ class Nanoc::Filters::TypogrubyTest < Nanoc::TestCase
14
13
  assert_equal(b, result)
15
14
  end
16
15
  end
17
-
18
16
  end
19
-
@@ -1,7 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  class Nanoc::Filters::UglifyJSTest < Nanoc::TestCase
4
-
5
4
  def test_filter
6
5
  if_have 'uglifier' do
7
6
  # Create filter
@@ -19,12 +18,11 @@ class Nanoc::Filters::UglifyJSTest < Nanoc::TestCase
19
18
  filter = ::Nanoc::Filters::UglifyJS.new
20
19
  input = "if(donkey) alert('It is a donkey!');"
21
20
 
22
- result = filter.setup_and_run(input, :output => { :beautify => false })
21
+ result = filter.setup_and_run(input, output: { beautify: false })
23
22
  assert_equal 'donkey&&alert("It is a donkey!");', result
24
23
 
25
- result = filter.setup_and_run(input, :output => { :beautify => true })
24
+ result = filter.setup_and_run(input, output: { beautify: true })
26
25
  assert_equal 'donkey && alert("It is a donkey!");', result
27
26
  end
28
27
  end
29
-
30
28
  end
@@ -3,7 +3,6 @@
3
3
  require 'tempfile'
4
4
 
5
5
  class Nanoc::Filters::XSLTest < Nanoc::TestCase
6
-
7
6
  SAMPLE_XSL = <<-EOS
8
7
  <?xml version="1.0" encoding="utf-8"?>
9
8
  <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
@@ -88,17 +87,17 @@ EOS
88
87
  if_have 'nokogiri' do
89
88
  # Create our data objects
90
89
  item = Nanoc::Item.new(SAMPLE_XML_IN,
91
- { },
90
+ {},
92
91
  '/content/')
93
92
  layout = Nanoc::Layout.new(SAMPLE_XSL,
94
- { },
93
+ {},
95
94
  '/layout/')
96
95
 
97
96
  # Create an instance of the filter
98
97
  assigns = {
99
- :item => item,
100
- :layout => layout,
101
- :content => item.raw_content
98
+ item: item,
99
+ layout: layout,
100
+ content: item.raw_content
102
101
  }
103
102
  filter = ::Nanoc::Filters::XSL.new(assigns)
104
103
 
@@ -112,23 +111,23 @@ EOS
112
111
  if_have 'nokogiri' do
113
112
  # Create our data objects
114
113
  item = Nanoc::Item.new(SAMPLE_XML_IN_WITH_PARAMS,
115
- { },
114
+ {},
116
115
  '/content/')
117
116
  layout = Nanoc::Layout.new(SAMPLE_XSL_WITH_PARAMS,
118
- { },
117
+ {},
119
118
  '/layout/')
120
119
 
121
120
  # Create an instance of the filter
122
121
  assigns = {
123
- :item => item,
124
- :layout => layout,
125
- :content => item.raw_content
122
+ item: item,
123
+ layout: layout,
124
+ content: item.raw_content
126
125
  }
127
126
  filter = ::Nanoc::Filters::XSL.new(assigns)
128
127
 
129
128
  # Run the filter and validate the results
130
129
  result = filter.setup_and_run(layout.raw_content,
131
- :foo => 'bar')
130
+ foo: 'bar')
132
131
  assert_match SAMPLE_XML_OUT_WITH_PARAMS, result
133
132
  end
134
133
  end
@@ -137,17 +136,17 @@ EOS
137
136
  if_have 'nokogiri' do
138
137
  # Create our data objects
139
138
  item = Nanoc::Item.new(SAMPLE_XML_IN_WITH_OMIT_XML_DECL,
140
- { },
139
+ {},
141
140
  '/content/')
142
141
  layout = Nanoc::Layout.new(SAMPLE_XSL_WITH_OMIT_XML_DECL,
143
- { },
142
+ {},
144
143
  '/layout/')
145
144
 
146
145
  # Create an instance of the filter
147
146
  assigns = {
148
- :item => item,
149
- :layout => layout,
150
- :content => item.raw_content
147
+ item: item,
148
+ layout: layout,
149
+ content: item.raw_content
151
150
  }
152
151
  filter = ::Nanoc::Filters::XSL.new(assigns)
153
152
 
@@ -156,5 +155,4 @@ EOS
156
155
  assert_match SAMPLE_XML_OUT_WITH_OMIT_XML_DECL, result
157
156
  end
158
157
  end
159
-
160
158
  end
@@ -1,7 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  class Nanoc::Filters::YUICompressorTest < Nanoc::TestCase
4
-
5
4
  def test_filter_javascript
6
5
  if_have 'yuicompressor' do
7
6
  filter = ::Nanoc::Filters::YUICompressor.new
@@ -16,10 +15,10 @@ class Nanoc::Filters::YUICompressorTest < Nanoc::TestCase
16
15
  }
17
16
  JAVASCRIPT
18
17
 
19
- result = filter.setup_and_run(sample_js, { :type => 'js', :munge => true })
18
+ result = filter.setup_and_run(sample_js, { type: 'js', munge: true })
20
19
  assert_match 'function factorial(c){var a=1;for(var b=2;b<=c;b++){a*=b}return a};', result
21
20
 
22
- result = filter.setup_and_run(sample_js, { :type => 'js', :munge => false })
21
+ result = filter.setup_and_run(sample_js, { type: 'js', munge: false })
23
22
  assert_match 'function factorial(n){var result=1;for(var i=2;i<=n;i++){result*=i}return result};', result
24
23
  end
25
24
  end
@@ -34,9 +33,8 @@ class Nanoc::Filters::YUICompressorTest < Nanoc::TestCase
34
33
  }
35
34
  CSS
36
35
 
37
- result = filter.setup_and_run(sample_css, { :type => 'css' })
36
+ result = filter.setup_and_run(sample_css, { type: 'css' })
38
37
  assert_match '*{margin:0}', result
39
38
  end
40
39
  end
41
-
42
40
  end
@@ -0,0 +1,65 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://jigsaw.w3.org/css-validator/validator?output=soap12&profile=css3&text=h1%20%7B%20%3B%20%7B
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Cache-Control:
22
+ - no-cache
23
+ Date:
24
+ - Sat, 06 Dec 2014 11:12:00 GMT
25
+ Pragma:
26
+ - no-cache
27
+ Transfer-Encoding:
28
+ - chunked
29
+ Content-Language:
30
+ - en
31
+ Content-Type:
32
+ - application/soap+xml;charset=utf-8
33
+ Server:
34
+ - Jigsaw/2.3.0-beta2
35
+ Vary:
36
+ - Accept-Language
37
+ X-W3c-Validator-Errors:
38
+ - '1'
39
+ X-W3c-Validator-Status:
40
+ - Invalid
41
+ body:
42
+ encoding: UTF-8
43
+ string: "<?xml version='1.0' encoding=\"utf-8\"?>\n<env:Envelope xmlns:env=\"http://www.w3.org/2003/05/soap-envelope\">\n
44
+ \ <env:Body>\n <m:cssvalidationresponse\n env:encodingStyle=\"http://www.w3.org/2003/05/soap-encoding\"\n
45
+ \ xmlns:m=\"http://www.w3.org/2005/07/css-validator\">\n <m:uri>file://localhost/TextArea</m:uri>\n
46
+ \ <m:checkedby>http://jigsaw.w3.org/css-validator/</m:checkedby>\n
47
+ \ <m:csslevel>css3</m:csslevel>\n <m:date>2014-12-06T11:12:00Z</m:date>\n
48
+ \ <m:validity>false</m:validity>\n <m:result>\n <m:errors
49
+ xml:lang=\"en\">\n <m:errorcount>1</m:errorcount>\n \n
50
+ \ <m:errorlist>\n <m:uri>file://localhost/TextArea</m:uri>\n
51
+ \ \n <m:error>\n <m:line>1</m:line>\n
52
+ \ <m:errortype>parse-error</m:errortype>\n <m:context>h1</m:context>
53
+ \ \n <m:errorsubtype>\n unrecognized\n
54
+ \ </m:errorsubtype>\n <m:skippedstring>\n
55
+ \ ; {\n </m:skippedstring>\n
56
+ \ <m:type>generator.unrecognize</m:type>\n \n
57
+ \ <m:message>\n \n Parse
58
+ Error\n </m:message>\n </m:error>\n
59
+ \ \n </m:errorlist>\n \n </m:errors>\n
60
+ \ <m:warnings xml:lang=\"en\">\n <m:warningcount>0</m:warningcount>\n
61
+ \ </m:warnings>\n </m:result>\n </m:cssvalidationresponse>\n
62
+ \ </env:Body>\n</env:Envelope>\n\n"
63
+ http_version:
64
+ recorded_at: Sat, 06 Dec 2014 11:12:00 GMT
65
+ recorded_with: VCR 2.9.3
@@ -7,5 +7,5 @@ begin
7
7
  Gem::Specification.load(gemspec).dependencies.each do |dep|
8
8
  gem dep.name, *dep.requirement.as_list
9
9
  end
10
- rescue LoadError => e
10
+ rescue LoadError
11
11
  end
@@ -30,7 +30,6 @@ VCR.configure do |c|
30
30
  end
31
31
 
32
32
  module Nanoc::TestHelpers
33
-
34
33
  LIB_DIR = File.expand_path(File.dirname(__FILE__) + '/../lib')
35
34
 
36
35
  def disable_nokogiri?
@@ -58,7 +57,7 @@ module Nanoc::TestHelpers
58
57
  def if_implemented
59
58
  yield
60
59
  rescue NotImplementedError, NameError
61
- skip $!
60
+ skip $ERROR_INFO
62
61
  return
63
62
  end
64
63
 
@@ -159,7 +158,7 @@ EOS
159
158
  end
160
159
  end
161
160
 
162
- def capturing_stdio(&block)
161
+ def capturing_stdio(&_block)
163
162
  # Store
164
163
  orig_stdout = $stdout
165
164
  orig_stderr = $stderr
@@ -168,7 +167,7 @@ EOS
168
167
  $stdout = StringIO.new
169
168
  $stderr = StringIO.new
170
169
  yield
171
- { :stdout => $stdout.string, :stderr => $stderr.string }
170
+ { stdout: $stdout.string, stderr: $stderr.string }
172
171
  ensure
173
172
  # Restore
174
173
  $stdout = orig_stdout
@@ -192,7 +191,7 @@ EOS
192
191
  pieces << line
193
192
  end
194
193
  end
195
- lines = pieces.map { |p| p.last }
194
+ lines = pieces.map(&:last)
196
195
 
197
196
  # Test
198
197
  b = binding
@@ -208,14 +207,14 @@ EOS
208
207
 
209
208
  def assert_contains_exactly(expected, actual)
210
209
  assert_equal expected.size, actual.size,
211
- 'Expected %s to be of same size as %s' % [actual.inspect, expected.inspect]
210
+ format('Expected %s to be of same size as %s', actual.inspect, expected.inspect)
212
211
  remaining = actual.dup.to_a
213
212
  expected.each do |e|
214
213
  index = remaining.index(e)
215
214
  remaining.delete_at(index) if index
216
215
  end
217
216
  assert remaining.empty?,
218
- 'Expected %s to contain all the elements of %s' % [actual.inspect, expected.inspect]
217
+ format('Expected %s to contain all the elements of %s', actual.inspect, expected.inspect)
219
218
  end
220
219
 
221
220
  def assert_raises_frozen_error
@@ -223,12 +222,12 @@ EOS
223
222
  assert_match(/(^can't modify frozen |^unable to modify frozen object$)/, error.message)
224
223
  end
225
224
 
226
- def with_env_vars(hash, &block)
225
+ def with_env_vars(hash, &_block)
227
226
  orig_env_hash = ENV.to_hash
228
- hash.each_pair { |k,v| ENV[k] = v }
227
+ hash.each_pair { |k, v| ENV[k] = v }
229
228
  yield
230
229
  ensure
231
- orig_env_hash.each_pair { |k,v| ENV[k] = v }
230
+ orig_env_hash.each_pair { |k, v| ENV[k] = v }
232
231
  end
233
232
 
234
233
  def on_windows?
@@ -236,7 +235,7 @@ EOS
236
235
  end
237
236
 
238
237
  def command?(cmd)
239
- which, null = on_windows? ? ['where', 'NUL'] : ['which', '/dev/null']
238
+ which, null = on_windows? ? %w(where NUL) : ['which', '/dev/null']
240
239
  system("#{which} #{cmd} > #{null} 2>&1")
241
240
  end
242
241
 
@@ -255,13 +254,10 @@ EOS
255
254
  def skip_unless_symlinks_supported
256
255
  skip 'Symlinks are not supported by Ruby on Windows' unless symlinks_supported?
257
256
  end
258
-
259
257
  end
260
258
 
261
259
  class Nanoc::TestCase < MiniTest::Unit::TestCase
262
-
263
260
  include Nanoc::TestHelpers
264
-
265
261
  end
266
262
 
267
263
  # Unexpected system exit is unexpected
@@ -271,6 +267,6 @@ end
271
267
  #
272
268
  class Time
273
269
  def inspect
274
- strftime("%a %b %d %H:%M:%S.#{'%06d' % usec} %Z %Y")
270
+ strftime("%a %b %d %H:%M:%S.#{format('%06d', usec)} %Z %Y")
275
271
  end
276
272
  end
@@ -1,7 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
4
-
5
4
  include Nanoc::Helpers::Blogging
6
5
  include Nanoc::Helpers::Text
7
6
 
@@ -32,17 +31,17 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
32
31
  @items = [
33
32
  Nanoc::Item.new(
34
33
  'blah',
35
- { :kind => 'item' },
34
+ { kind: 'item' },
36
35
  '/0/'
37
36
  ),
38
37
  Nanoc::Item.new(
39
38
  'blah blah',
40
- { :kind => 'article' },
39
+ { kind: 'article' },
41
40
  '/1/'
42
41
  ),
43
42
  Nanoc::Item.new(
44
43
  'blah blah blah',
45
- { :kind => 'article' },
44
+ { kind: 'article' },
46
45
  '/2/'
47
46
  )
48
47
  ]
@@ -61,17 +60,17 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
61
60
  @items = [
62
61
  Nanoc::Item.new(
63
62
  'blah',
64
- { :kind => 'item' },
63
+ { kind: 'item' },
65
64
  '/0/'
66
65
  ),
67
66
  Nanoc::Item.new(
68
67
  'blah',
69
- { :kind => 'article', :created_at => (Date.today - 1).to_s },
68
+ { kind: 'article', created_at: (Date.today - 1).to_s },
70
69
  '/1/'
71
70
  ),
72
71
  Nanoc::Item.new(
73
72
  'blah',
74
- { :kind => 'article', :created_at => (Time.now - 500).to_s },
73
+ { kind: 'article', created_at: (Time.now - 500).to_s },
75
74
  '/2/'
76
75
  )
77
76
  ]
@@ -102,14 +101,14 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
102
101
  @items[1].stubs(:[]).with(:custom_url_in_feed).returns(nil)
103
102
  @items[1].stubs(:[]).with(:excerpt).returns(nil)
104
103
  @items[1].stubs(:path).returns('/item1/')
105
- @items[1].expects(:compiled_content).with(:snapshot => :pre).returns('item 1 content')
104
+ @items[1].expects(:compiled_content).with(snapshot: :pre).returns('item 1 content')
106
105
 
107
106
  # Create item 2
108
- @items[2].expects(:compiled_content).with(:snapshot => :pre).returns('item 2 content')
107
+ @items[2].expects(:compiled_content).with(snapshot: :pre).returns('item 2 content')
109
108
 
110
109
  # Mock site
111
110
  @site = mock
112
- @site.stubs(:config).returns({ :base_url => 'http://example.com' })
111
+ @site.stubs(:config).returns({ base_url: 'http://example.com' })
113
112
 
114
113
  # Create feed item
115
114
  @item = mock
@@ -141,7 +140,7 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
141
140
 
142
141
  # Mock site
143
142
  @site = mock
144
- @site.stubs(:config).returns({ :base_url => 'http://example.com' })
143
+ @site.stubs(:config).returns({ base_url: 'http://example.com' })
145
144
 
146
145
  # Create feed item
147
146
  @item = mock
@@ -163,7 +162,7 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
163
162
 
164
163
  # Mock site
165
164
  @site = mock
166
- @site.stubs(:config).returns({ :base_url => 'http://example.com' })
165
+ @site.stubs(:config).returns({ base_url: 'http://example.com' })
167
166
 
168
167
  # Create feed item
169
168
  @item = mock
@@ -189,7 +188,7 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
189
188
 
190
189
  # Mock site
191
190
  @site = mock
192
- @site.stubs(:config).returns({:base_url => nil})
191
+ @site.stubs(:config).returns({ base_url: nil })
193
192
 
194
193
  # Create feed item
195
194
  @item = mock
@@ -215,7 +214,7 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
215
214
 
216
215
  # Mock site
217
216
  @site = mock
218
- @site.stubs(:config).returns({ :base_url => 'http://example.com' })
217
+ @site.stubs(:config).returns({ base_url: 'http://example.com' })
219
218
 
220
219
  # Create feed item
221
220
  @item = mock
@@ -241,7 +240,7 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
241
240
 
242
241
  # Mock site
243
242
  @site = mock
244
- @site.stubs(:config).returns({ :base_url => 'http://example.com' })
243
+ @site.stubs(:config).returns({ base_url: 'http://example.com' })
245
244
 
246
245
  # Create feed item
247
246
  @item = mock
@@ -272,7 +271,7 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
272
271
 
273
272
  # Mock site
274
273
  @site = mock
275
- @site.stubs(:config).returns({ :base_url => 'http://example.com/' })
274
+ @site.stubs(:config).returns({ base_url: 'http://example.com/' })
276
275
 
277
276
  # Create feed item
278
277
  @item = mock
@@ -315,7 +314,7 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
315
314
 
316
315
  # Mock site
317
316
  @site = mock
318
- @site.stubs(:config).returns({ :base_url => 'http://example.com' })
317
+ @site.stubs(:config).returns({ base_url: 'http://example.com' })
319
318
 
320
319
  # Create feed item
321
320
  @item = mock
@@ -343,7 +342,7 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
343
342
 
344
343
  # Mock site
345
344
  @site = mock
346
- @site.stubs(:config).returns({ :base_url => 'http://example.com' })
345
+ @site.stubs(:config).returns({ base_url: 'http://example.com' })
347
346
 
348
347
  # Create feed item
349
348
  @item = mock
@@ -366,11 +365,11 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
366
365
  if_have 'builder' do
367
366
  # Create items
368
367
  @items = [mock_item, mock_article]
369
- @items[1].expects(:compiled_content).with(:snapshot => :pre).returns('asdf')
368
+ @items[1].expects(:compiled_content).with(snapshot: :pre).returns('asdf')
370
369
 
371
370
  # Mock site
372
371
  @site = mock
373
- @site.stubs(:config).returns({ :base_url => 'http://example.com' })
372
+ @site.stubs(:config).returns({ base_url: 'http://example.com' })
374
373
 
375
374
  # Create feed item
376
375
  @item = mock
@@ -381,9 +380,9 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
381
380
 
382
381
  # Check
383
382
  atom_feed(
384
- :author_name => 'Bob',
385
- :author_uri => 'http://example.com/~bob/',
386
- :title => 'My Blog Or Something'
383
+ author_name: 'Bob',
384
+ author_uri: 'http://example.com/~bob/',
385
+ title: 'My Blog Or Something'
387
386
  )
388
387
  end
389
388
  end
@@ -392,14 +391,14 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
392
391
  if_have 'builder' do
393
392
  # Create items
394
393
  @items = [mock_item, mock_article]
395
- @items[1].expects(:compiled_content).with(:snapshot => :pre).returns('asdf')
394
+ @items[1].expects(:compiled_content).with(snapshot: :pre).returns('asdf')
396
395
 
397
396
  # Mock site
398
397
  @config = {
399
- :author_name => 'Bob',
400
- :author_uri => 'http://example.com/~bob/',
401
- :title => 'My Blog Or Something',
402
- :base_url => 'http://example.com'
398
+ author_name: 'Bob',
399
+ author_uri: 'http://example.com/~bob/',
400
+ title: 'My Blog Or Something',
401
+ base_url: 'http://example.com'
403
402
  }
404
403
  @site = mock
405
404
  @site.stubs(:config).returns(@config)
@@ -423,11 +422,11 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
423
422
 
424
423
  @items[0].expects(:compiled_content).never
425
424
  @items[1].stubs(:[]).with(:title).returns('Item One')
426
- @items[1].expects(:compiled_content).with(:snapshot => :pre).returns('asdf')
425
+ @items[1].expects(:compiled_content).with(snapshot: :pre).returns('asdf')
427
426
 
428
427
  # Mock site
429
428
  @site = mock
430
- @site.stubs(:config).returns({ :base_url => 'http://example.com' })
429
+ @site.stubs(:config).returns({ base_url: 'http://example.com' })
431
430
 
432
431
  # Create feed item
433
432
  @item = mock
@@ -437,7 +436,7 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
437
436
  @item.stubs(:[]).with(:[]).with(:feed_url).returns('http://example.com/feed')
438
437
 
439
438
  # Check
440
- atom_feed :articles => [@items[1]]
439
+ atom_feed articles: [@items[1]]
441
440
  end
442
441
  end
443
442
 
@@ -452,7 +451,7 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
452
451
 
453
452
  # Mock site
454
453
  @site = mock
455
- @site.stubs(:config).returns({ :base_url => 'http://example.com' })
454
+ @site.stubs(:config).returns({ base_url: 'http://example.com' })
456
455
 
457
456
  # Create feed item
458
457
  @item = mock
@@ -462,7 +461,7 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
462
461
  @item.stubs(:[]).with(:feed_url).returns('http://example.com/feed')
463
462
 
464
463
  # Check
465
- result = atom_feed :limit => 1, :articles => @items
464
+ result = atom_feed limit: 1, articles: @items
466
465
  assert_match(
467
466
  Regexp.new('Article 0', Regexp::MULTILINE),
468
467
  result
@@ -486,7 +485,7 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
486
485
 
487
486
  # Mock site
488
487
  @site = mock
489
- @site.stubs(:config).returns({ :base_url => 'http://example.com' })
488
+ @site.stubs(:config).returns({ base_url: 'http://example.com' })
490
489
 
491
490
  # Create feed item
492
491
  @item = mock
@@ -511,7 +510,7 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
511
510
 
512
511
  # Mock site
513
512
  @site = mock
514
- @site.stubs(:config).returns({ :base_url => 'http://example.com' })
513
+ @site.stubs(:config).returns({ base_url: 'http://example.com' })
515
514
 
516
515
  # Create feed item
517
516
  @item = mock
@@ -521,7 +520,7 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
521
520
  @item.stubs(:[]).with(:feed_url).returns('http://example.com/feed')
522
521
 
523
522
  # Check
524
- result = atom_feed :content_proc => lambda { |a| 'foobar!' }
523
+ result = atom_feed content_proc: ->(_a) { 'foobar!' }
525
524
  assert_match 'foobar!</content>', result
526
525
  end
527
526
  end
@@ -533,7 +532,7 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
533
532
 
534
533
  # Mock site
535
534
  @site = mock
536
- @site.stubs(:config).returns({ :base_url => 'http://example.com' })
535
+ @site.stubs(:config).returns({ base_url: 'http://example.com' })
537
536
 
538
537
  # Create feed item
539
538
  @item = mock
@@ -543,7 +542,7 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
543
542
  @item.stubs(:[]).with(:[]).with(:feed_url).returns('http://example.com/feed')
544
543
 
545
544
  # Check
546
- result = atom_feed :excerpt_proc => lambda { |a| 'foobar!' }
545
+ result = atom_feed excerpt_proc: ->(_a) { 'foobar!' }
547
546
  assert_match 'foobar!</summary>', result
548
547
  end
549
548
  end
@@ -555,7 +554,7 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
555
554
 
556
555
  # Mock site
557
556
  @site = mock
558
- @site.stubs(:config).returns({ :base_url => 'http://example.com' })
557
+ @site.stubs(:config).returns({ base_url: 'http://example.com' })
559
558
 
560
559
  # Create feed item
561
560
  @item = mock
@@ -565,7 +564,7 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
565
564
  @item.stubs(:[]).with(:feed_url).returns('http://example.com/feed')
566
565
 
567
566
  # Check
568
- result = atom_feed :icon => 'http://example.com/icon.png'
567
+ result = atom_feed icon: 'http://example.com/icon.png'
569
568
  assert_match '<icon>http://example.com/icon.png</icon>', result
570
569
  end
571
570
  end
@@ -577,7 +576,7 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
577
576
 
578
577
  # Mock site
579
578
  @site = mock
580
- @site.stubs(:config).returns({ :base_url => 'http://example.com' })
579
+ @site.stubs(:config).returns({ base_url: 'http://example.com' })
581
580
 
582
581
  # Create feed item
583
582
  @item = mock
@@ -587,7 +586,7 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
587
586
  @item.stubs(:[]).with(:feed_url).returns('http://example.com/feed')
588
587
 
589
588
  # Check
590
- result = atom_feed :logo => 'http://example.com/logo.png'
589
+ result = atom_feed logo: 'http://example.com/logo.png'
591
590
  assert_match '<logo>http://example.com/logo.png</logo>', result
592
591
  end
593
592
  end
@@ -600,7 +599,7 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
600
599
 
601
600
  # Mock site
602
601
  @site = mock
603
- @site.stubs(:config).returns({ :base_url => 'http://example.com' })
602
+ @site.stubs(:config).returns({ base_url: 'http://example.com' })
604
603
 
605
604
  # Create feed item
606
605
  @item = mock
@@ -618,7 +617,7 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
618
617
 
619
618
  def test_url_for_without_custom_path_in_feed
620
619
  # Create site
621
- @site = Nanoc::Site.new({ :base_url => 'http://example.com' })
620
+ @site = Nanoc::Site.new({ base_url: 'http://example.com' })
622
621
 
623
622
  # Create article
624
623
  item = Nanoc::Item.new('content', {}, '/foo/')
@@ -634,11 +633,11 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
634
633
 
635
634
  def test_url_for_with_custom_path_in_feed
636
635
  # Create site
637
- @site = Nanoc::Site.new({ :base_url => 'http://example.com' })
636
+ @site = Nanoc::Site.new({ base_url: 'http://example.com' })
638
637
 
639
638
  # Create article
640
639
  item = Nanoc::Item.new(
641
- 'content', { :custom_path_in_feed => '/meow/woof/' }, '/foo/')
640
+ 'content', { custom_path_in_feed: '/meow/woof/' }, '/foo/')
642
641
  item.reps << Nanoc::ItemRep.new(item, :default)
643
642
 
644
643
  # Check
@@ -650,11 +649,11 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
650
649
 
651
650
  def test_url_for_with_custom_url_in_feed
652
651
  # Create site
653
- @site = Nanoc::Site.new({ :base_url => 'http://example.com' })
652
+ @site = Nanoc::Site.new({ base_url: 'http://example.com' })
654
653
 
655
654
  # Create article
656
655
  item = Nanoc::Item.new(
657
- 'content', { :custom_url_in_feed => 'http://example.org/x' }, '/foo/')
656
+ 'content', { custom_url_in_feed: 'http://example.org/x' }, '/foo/')
658
657
  item.reps << Nanoc::ItemRep.new(item, :default)
659
658
 
660
659
  # Check
@@ -676,7 +675,7 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
676
675
 
677
676
  def test_url_for_without_path
678
677
  # Create site
679
- @site = Nanoc::Site.new({ :base_url => 'http://example.com' })
678
+ @site = Nanoc::Site.new({ base_url: 'http://example.com' })
680
679
 
681
680
  # Create article
682
681
  item = Nanoc::Item.new('content', {}, '/foo/')
@@ -689,7 +688,7 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
689
688
 
690
689
  def test_feed_url_without_custom_feed_url
691
690
  # Create site
692
- @site = Nanoc::Site.new({ :base_url => 'http://example.com' })
691
+ @site = Nanoc::Site.new({ base_url: 'http://example.com' })
693
692
 
694
693
  # Create article
695
694
  @item = Nanoc::Item.new('content', {}, '/foo/')
@@ -705,10 +704,10 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
705
704
 
706
705
  def test_feed_url_with_custom_feed_url
707
706
  # Create site
708
- @site = Nanoc::Site.new({ :base_url => 'http://example.com' })
707
+ @site = Nanoc::Site.new({ base_url: 'http://example.com' })
709
708
 
710
709
  # Create feed item
711
- @item = Nanoc::Item.new('content', { :feed_url => 'http://example.com/feed/' }, '/foo/')
710
+ @item = Nanoc::Item.new('content', { feed_url: 'http://example.com/feed/' }, '/foo/')
712
711
  @item.reps << Nanoc::ItemRep.new(@item, :default)
713
712
  @item.reps[0].path = '/foo/bar/'
714
713
 
@@ -731,10 +730,10 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
731
730
 
732
731
  def test_atom_tag_for_with_path
733
732
  # Create site
734
- @site = Nanoc::Site.new({ :base_url => 'http://example.com' })
733
+ @site = Nanoc::Site.new({ base_url: 'http://example.com' })
735
734
 
736
735
  # Create article
737
- item = Nanoc::Item.new('content', { :created_at => '2008-05-19' }, '/foo/')
736
+ item = Nanoc::Item.new('content', { created_at: '2008-05-19' }, '/foo/')
738
737
  item.reps << Nanoc::ItemRep.new(item, :default)
739
738
  item.reps[0].path = '/foo/bar/'
740
739
 
@@ -744,10 +743,10 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
744
743
 
745
744
  def test_atom_tag_for_without_path
746
745
  # Create site
747
- @site = Nanoc::Site.new({ :base_url => 'http://example.com' })
746
+ @site = Nanoc::Site.new({ base_url: 'http://example.com' })
748
747
 
749
748
  # Create article
750
- item = Nanoc::Item.new('content', { :created_at => '2008-05-19' }, '/baz/qux/')
749
+ item = Nanoc::Item.new('content', { created_at: '2008-05-19' }, '/baz/qux/')
751
750
  item.reps << Nanoc::ItemRep.new(item, :default)
752
751
 
753
752
  # Check
@@ -756,10 +755,10 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
756
755
 
757
756
  def test_atom_tag_for_with_base_url_in_dir
758
757
  # Create site
759
- @site = Nanoc::Site.new({ :base_url => 'http://example.com/somedir' })
758
+ @site = Nanoc::Site.new({ base_url: 'http://example.com/somedir' })
760
759
 
761
760
  # Create article
762
- item = Nanoc::Item.new('content', { :created_at => '2008-05-19' }, '/foo/')
761
+ item = Nanoc::Item.new('content', { created_at: '2008-05-19' }, '/foo/')
763
762
  item.reps << Nanoc::ItemRep.new(item, :default)
764
763
  item.reps[0].path = '/foo/bar/'
765
764
 
@@ -769,10 +768,10 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
769
768
 
770
769
  def test_atom_tag_for_with_time
771
770
  # Create site
772
- @site = Nanoc::Site.new({ :base_url => 'http://example.com' })
771
+ @site = Nanoc::Site.new({ base_url: 'http://example.com' })
773
772
 
774
773
  # Create article
775
- item = Nanoc::Item.new('content', { :created_at => Time.parse('2008-05-19') }, '/foo/')
774
+ item = Nanoc::Item.new('content', { created_at: Time.parse('2008-05-19') }, '/foo/')
776
775
  item.reps << Nanoc::ItemRep.new(item, :default)
777
776
  item.reps[0].path = '/foo/bar/'
778
777
 
@@ -782,15 +781,14 @@ class Nanoc::Helpers::BloggingTest < Nanoc::TestCase
782
781
 
783
782
  def test_atom_tag_for_with_date
784
783
  # Create site
785
- @site = Nanoc::Site.new({ :base_url => 'http://example.com' })
784
+ @site = Nanoc::Site.new({ base_url: 'http://example.com' })
786
785
 
787
786
  # Create article
788
- item = Nanoc::Item.new('content', { :created_at => Date.parse('2008-05-19') }, '/foo/')
787
+ item = Nanoc::Item.new('content', { created_at: Date.parse('2008-05-19') }, '/foo/')
789
788
  item.reps << Nanoc::ItemRep.new(item, :default)
790
789
  item.reps[0].path = '/foo/bar/'
791
790
 
792
791
  # Check
793
792
  assert_equal('tag:example.com,2008-05-19:/foo/bar/', atom_tag_for(item))
794
793
  end
795
-
796
794
  end