test/helpers/test_xml_sitemap.rb in nanoc-3.8.0 vs test/helpers/test_xml_sitemap.rb in nanoc-4.0.0a1

- old
+ new

@@ -15,32 +15,32 @@ if_have 'builder', 'nokogiri' do # Create items @items = [] # Create item 1 - @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/') + @items << Nanoc::ItemView.new(Nanoc::Int::Item.new('some content 1', {}, '/item-one/')) + create_item_rep(@items.last.unwrap, :one_a, '/item-one/a/') + create_item_rep(@items.last.unwrap, :one_b, '/item-one/b/') # Create item 2 - @items << Nanoc::Item.new('some content 2', { is_hidden: true }, '/item-two/') + @items << Nanoc::ItemView.new(Nanoc::Int::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 } - @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/') + @items << Nanoc::ItemView.new(Nanoc::Int::Item.new('some content 3', attrs, '/item-three/')) + create_item_rep(@items.last.unwrap, :three_a, '/item-three/a/') + create_item_rep(@items.last.unwrap, :three_b, '/item-three/b/') # Create item 4 - @items << Nanoc::Item.new('some content 4', {}, '/item-four/') - create_item_rep(@items.last, :four_a, nil) + @items << Nanoc::ItemView.new(Nanoc::Int::Item.new('some content 4', {}, '/item-four/')) + create_item_rep(@items.last.unwrap, :four_a, nil) # Create sitemap item - @item = Nanoc::Item.new('sitemap content', {}, '/sitemap/') + @item = Nanoc::ItemView.new(Nanoc::Int::Item.new('sitemap content', {}, '/sitemap/')) # Create site - @site = Nanoc::Site.new({ base_url: 'http://example.com' }) + @config = Nanoc::ConfigView.new({ base_url: 'http://example.com' }) # Build sitemap res = xml_sitemap # Check @@ -71,20 +71,20 @@ def test_sitemap_with_items_as_param if_have 'builder', 'nokogiri' do # Create items @items = [] @items << nil - @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/') + @items << Nanoc::ItemView.new(Nanoc::Int::Item.new('some content 1', {}, '/item-one/')) + create_item_rep(@items.last.unwrap, :one_a, '/item-one/a/') + create_item_rep(@items.last.unwrap, :one_b, '/item-one/b/') @items << nil # Create sitemap item - @item = Nanoc::Item.new('sitemap content', {}, '/sitemap/') + @item = Nanoc::Int::Item.new('sitemap content', {}, '/sitemap/') # Create site - @site = Nanoc::Site.new({ base_url: 'http://example.com' }) + @config = Nanoc::ConfigView.new({ base_url: 'http://example.com' }) # Build sitemap res = xml_sitemap(items: [@items[1]]) # Check @@ -105,19 +105,20 @@ end def test_filter if_have 'builder', 'nokogiri' do # Create items - @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/') + @items = [] + @items << Nanoc::ItemView.new(Nanoc::Int::Item.new('some content 1', {}, '/item-one/')) + create_item_rep(@items.last.unwrap, :one_a, '/item-one/a/') + create_item_rep(@items.last.unwrap, :one_b, '/item-one/b/') # Create sitemap item - @item = Nanoc::Item.new('sitemap content', {}, '/sitemap/') + @item = Nanoc::ItemView.new(Nanoc::Int::Item.new('sitemap content', {}, '/sitemap/')) # Create site - @site = Nanoc::Site.new({ base_url: 'http://example.com' }) + @config = Nanoc::ConfigView.new({ base_url: 'http://example.com' }) # Build sitemap res = xml_sitemap(rep_select: ->(rep) { rep.name == :one_a }) # Check @@ -135,25 +136,25 @@ def test_sorted if_have 'builder', 'nokogiri' do # Create items @items = [] - @items << Nanoc::Item.new('some content 1', {}, '/george/') - create_item_rep(@items.last, :a_alice, '/george/alice/') - create_item_rep(@items.last, :b_zoey, '/george/zoey/') - @items << Nanoc::Item.new('some content 1', {}, '/walton/') - create_item_rep(@items.last, :a_eve, '/walton/eve/') - create_item_rep(@items.last, :b_bob, '/walton/bob/') - @items << Nanoc::Item.new('some content 1', {}, '/lucas/') - create_item_rep(@items.last, :a_trudy, '/lucas/trudy/') - create_item_rep(@items.last, :b_mallory, '/lucas/mallory/') + @items << Nanoc::ItemView.new(Nanoc::Int::Item.new('some content 1', {}, '/george/')) + create_item_rep(@items.last.unwrap, :a_alice, '/george/alice/') + create_item_rep(@items.last.unwrap, :b_zoey, '/george/zoey/') + @items << Nanoc::ItemView.new(Nanoc::Int::Item.new('some content 1', {}, '/walton/')) + create_item_rep(@items.last.unwrap, :a_eve, '/walton/eve/') + create_item_rep(@items.last.unwrap, :b_bob, '/walton/bob/') + @items << Nanoc::ItemView.new(Nanoc::Int::Item.new('some content 1', {}, '/lucas/')) + create_item_rep(@items.last.unwrap, :a_trudy, '/lucas/trudy/') + create_item_rep(@items.last.unwrap, :b_mallory, '/lucas/mallory/') # Create sitemap item - @item = Nanoc::Item.new('sitemap content', {}, '/sitemap/') + @item = Nanoc::ItemView.new(Nanoc::Int::Item.new('sitemap content', {}, '/sitemap/')) # Create site - @site = Nanoc::Site.new({ base_url: 'http://example.com' }) + @config = Nanoc::ConfigView.new({ base_url: 'http://example.com' }) # Build sitemap res = xml_sitemap(items: @items) # Check @@ -172,10 +173,10 @@ end protected def create_item_rep(item, name, path) - rep = Nanoc::ItemRep.new(item, name) + rep = Nanoc::Int::ItemRep.new(item, name) rep.paths = { last: path } rep.raw_paths = { last: path } item.reps << rep rep end