test/helpers/test_xml_sitemap.rb in nanoc-3.7.4 vs test/helpers/test_xml_sitemap.rb in nanoc-3.7.5
- old
+ new
@@ -1,9 +1,8 @@
# encoding: utf-8
class Nanoc::Helpers::XMLSitemapTest < Nanoc::TestCase
-
include Nanoc::Helpers::XMLSitemap
def teardown
super
@items = nil
@@ -21,14 +20,14 @@
@items << Nanoc::Item.new('some content 1', {}, '/item-one/')
create_item_rep(@items.last, :one_a, '/item-one/a/')
create_item_rep(@items.last, :one_b, '/item-one/b/')
# Create item 2
- @items << Nanoc::Item.new('some content 2', { :is_hidden => true }, '/item-two/')
+ @items << Nanoc::Item.new('some content 2', { is_hidden: true }, '/item-two/')
# Create item 3
- attrs = { :mtime => Time.parse('2004-07-12'), :changefreq => 'daily', :priority => 0.5 }
+ attrs = { mtime: Time.parse('2004-07-12'), changefreq: 'daily', priority: 0.5 }
@items << Nanoc::Item.new('some content 3', attrs, '/item-three/')
create_item_rep(@items.last, :three_a, '/item-three/a/')
create_item_rep(@items.last, :three_b, '/item-three/b/')
# Create item 4
@@ -37,11 +36,11 @@
# Create sitemap item
@item = Nanoc::Item.new('sitemap content', {}, '/sitemap/')
# Create site
- @site = Nanoc::Site.new({ :base_url => 'http://example.com' })
+ @site = Nanoc::Site.new({ base_url: 'http://example.com' })
# Build sitemap
res = xml_sitemap
# Check
@@ -81,14 +80,14 @@
# Create sitemap item
@item = Nanoc::Item.new('sitemap content', {}, '/sitemap/')
# Create site
- @site = Nanoc::Site.new({ :base_url => 'http://example.com' })
+ @site = Nanoc::Site.new({ base_url: 'http://example.com' })
# Build sitemap
- res = xml_sitemap(:items => [@items[1]])
+ res = xml_sitemap(items: [@items[1]])
# Check
doc = Nokogiri::XML(res)
urlsets = doc.css('> urlset')
assert_equal 1, urlsets.size
@@ -114,14 +113,14 @@
# Create sitemap item
@item = Nanoc::Item.new('sitemap content', {}, '/sitemap/')
# Create site
- @site = Nanoc::Site.new({ :base_url => 'http://example.com' })
+ @site = Nanoc::Site.new({ base_url: 'http://example.com' })
# Build sitemap
- res = xml_sitemap(:rep_select => lambda { |rep| rep.name == :one_a } )
+ res = xml_sitemap(rep_select: ->(rep) { rep.name == :one_a })
# Check
doc = Nokogiri::XML(res)
urlsets = doc.css('> urlset')
assert_equal 1, urlsets.size
@@ -150,14 +149,14 @@
# Create sitemap item
@item = Nanoc::Item.new('sitemap content', {}, '/sitemap/')
# Create site
- @site = Nanoc::Site.new({ :base_url => 'http://example.com' })
+ @site = Nanoc::Site.new({ base_url: 'http://example.com' })
# Build sitemap
- res = xml_sitemap(:items => @items)
+ res = xml_sitemap(items: @items)
# Check
doc = Nokogiri::XML(res)
urlsets = doc.css('> urlset')
assert_equal 1, urlsets.size
@@ -174,12 +173,11 @@
protected
def create_item_rep(item, name, path)
rep = Nanoc::ItemRep.new(item, name)
- rep.paths = { :last => path }
- rep.raw_paths = { :last => path }
+ rep.paths = { last: path }
+ rep.raw_paths = { last: path }
item.reps << rep
rep
end
-
end