test/helpers/test_xml_sitemap.rb in nanoc-4.8.9 vs test/helpers/test_xml_sitemap.rb in nanoc-4.8.10
- old
+ new
@@ -13,16 +13,16 @@
layouts = Nanoc::Int::LayoutCollection.new(config)
dep_store = Nanoc::Int::DependencyStore.new(items, layouts, config)
dependency_tracker = Nanoc::Int::DependencyTracker.new(dep_store)
@reps = Nanoc::Int::ItemRepRepo.new
- @view_context = Nanoc::ViewContext.new(
- reps: @reps,
- items: nil,
- dependency_tracker: dependency_tracker,
+ @view_context = Nanoc::ViewContextForCompilation.new(
+ reps: @reps,
+ items: Nanoc::Int::ItemCollection.new(config),
+ dependency_tracker: dependency_tracker,
compilation_context: :__irrelevant__,
- snapshot_repo: :__irrelevant_snapshot_repo,
+ snapshot_repo: :__irrelevant_snapshot_repo,
)
@items = nil
@item = nil
@site = nil
@@ -33,36 +33,36 @@
if_have 'builder', 'nokogiri' do
# Create items
items = []
# Create item 1
- item = Nanoc::ItemWithRepsView.new(Nanoc::Int::Item.new('some content 1', {}, '/item-one'), @view_context)
+ item = Nanoc::CompilationItemView.new(Nanoc::Int::Item.new('some content 1', {}, '/item-one'), @view_context)
items << item
create_item_rep(item.unwrap, :one_a, '/item-one/a/')
create_item_rep(item.unwrap, :one_b, '/item-one/b/')
# Create item 2
- item = Nanoc::ItemWithRepsView.new(Nanoc::Int::Item.new('some content 2', { is_hidden: true }, '/item-two'), @view_context)
+ item = Nanoc::CompilationItemView.new(Nanoc::Int::Item.new('some content 2', { is_hidden: true }, '/item-two'), @view_context)
items << item
# Create item 3
attrs = { mtime: Time.parse('2004-07-12 00:00:00 +02:00'), changefreq: 'daily', priority: 0.5 }
- item = Nanoc::ItemWithRepsView.new(Nanoc::Int::Item.new('some content 3', attrs, '/item-three'), @view_context)
+ item = Nanoc::CompilationItemView.new(Nanoc::Int::Item.new('some content 3', attrs, '/item-three'), @view_context)
items << item
create_item_rep(item.unwrap, :three_a, '/item-three/a/')
create_item_rep(item.unwrap, :three_b, '/item-three/b/')
# Create item 4
- item = Nanoc::ItemWithRepsView.new(Nanoc::Int::Item.new('some content 4', {}, '/item-four'), @view_context)
+ item = Nanoc::CompilationItemView.new(Nanoc::Int::Item.new('some content 4', {}, '/item-four'), @view_context)
items << item
create_item_rep(item.unwrap, :four_a, nil)
# Create items
@items = Nanoc::Int::ItemCollection.new({}, items)
# Create sitemap item
- @item = Nanoc::ItemWithRepsView.new(Nanoc::Int::Item.new('sitemap content', {}, '/sitemap'), @view_context)
+ @item = Nanoc::CompilationItemView.new(Nanoc::Int::Item.new('sitemap content', {}, '/sitemap'), @view_context)
# Create site
config = Nanoc::Int::Configuration.new(hash: { base_url: 'http://example.com' })
@config = Nanoc::ConfigView.new(config, @view_context)
@@ -97,11 +97,11 @@
def test_sitemap_with_items_as_param
if_have 'builder', 'nokogiri' do
# Create items
items = []
items << nil
- item = Nanoc::ItemWithRepsView.new(Nanoc::Int::Item.new('some content 1', {}, '/item-one'), @view_context)
+ item = Nanoc::CompilationItemView.new(Nanoc::Int::Item.new('some content 1', {}, '/item-one'), @view_context)
items << item
create_item_rep(item.unwrap, :one_a, '/item-one/a/')
create_item_rep(item.unwrap, :one_b, '/item-one/b/')
items << nil
@items = Nanoc::Int::ItemCollection.new({})
@@ -134,17 +134,17 @@
end
def test_filter
if_have 'builder', 'nokogiri' do
# Create items
- item = Nanoc::ItemWithRepsView.new(Nanoc::Int::Item.new('some content 1', {}, '/item-one'), @view_context)
+ item = Nanoc::CompilationItemView.new(Nanoc::Int::Item.new('some content 1', {}, '/item-one'), @view_context)
@items = Nanoc::Int::ItemCollection.new({}, [item])
create_item_rep(item.unwrap, :one_a, '/item-one/a/')
create_item_rep(item.unwrap, :one_b, '/item-one/b/')
# Create sitemap item
- @item = Nanoc::ItemWithRepsView.new(Nanoc::Int::Item.new('sitemap content', {}, '/sitemap'), @view_context)
+ @item = Nanoc::CompilationItemView.new(Nanoc::Int::Item.new('sitemap content', {}, '/sitemap'), @view_context)
# Create site
config = Nanoc::Int::Configuration.new(hash: { base_url: 'http://example.com' })
@config = Nanoc::ConfigView.new(config, @view_context)
@@ -166,26 +166,26 @@
def test_sorted
if_have 'builder', 'nokogiri' do
# Create items
items = []
- item = Nanoc::ItemWithRepsView.new(Nanoc::Int::Item.new('some content 1', {}, '/george'), @view_context)
+ item = Nanoc::CompilationItemView.new(Nanoc::Int::Item.new('some content 1', {}, '/george'), @view_context)
items << item
create_item_rep(item.unwrap, :a_alice, '/george/alice/')
create_item_rep(item.unwrap, :b_zoey, '/george/zoey/')
- item = Nanoc::ItemWithRepsView.new(Nanoc::Int::Item.new('some content 1', {}, '/walton'), @view_context)
+ item = Nanoc::CompilationItemView.new(Nanoc::Int::Item.new('some content 1', {}, '/walton'), @view_context)
items << item
create_item_rep(item.unwrap, :a_eve, '/walton/eve/')
create_item_rep(item.unwrap, :b_bob, '/walton/bob/')
- item = Nanoc::ItemWithRepsView.new(Nanoc::Int::Item.new('some content 1', {}, '/lucas'), @view_context)
+ item = Nanoc::CompilationItemView.new(Nanoc::Int::Item.new('some content 1', {}, '/lucas'), @view_context)
items << item
create_item_rep(item.unwrap, :a_trudy, '/lucas/trudy/')
create_item_rep(item.unwrap, :b_mallory, '/lucas/mallory/')
@items = Nanoc::Int::ItemCollection.new({}, items)
# Create sitemap item
- @item = Nanoc::ItemWithRepsView.new(Nanoc::Int::Item.new('sitemap content', {}, '/sitemap'), @view_context)
+ @item = Nanoc::CompilationItemView.new(Nanoc::Int::Item.new('sitemap content', {}, '/sitemap'), @view_context)
# Create site
config = Nanoc::Int::Configuration.new(hash: { base_url: 'http://example.com' })
@config = Nanoc::ConfigView.new(config, @view_context)
@@ -208,15 +208,15 @@
end
def test_url_escape
if_have 'builder', 'nokogiri' do
# Create items
- item = Nanoc::ItemWithRepsView.new(Nanoc::Int::Item.new('some content 1', {}, '/george'), @view_context)
+ item = Nanoc::CompilationItemView.new(Nanoc::Int::Item.new('some content 1', {}, '/george'), @view_context)
@items = Nanoc::Int::ItemCollection.new({}, [item])
create_item_rep(item.unwrap, :default, '/cool projects/проверка')
# Create sitemap item
- @item = Nanoc::ItemWithRepsView.new(Nanoc::Int::Item.new('sitemap content', {}, '/sitemap'), @view_context)
+ @item = Nanoc::CompilationItemView.new(Nanoc::Int::Item.new('sitemap content', {}, '/sitemap'), @view_context)
# Create site
config = Nanoc::Int::Configuration.new(hash: { base_url: 'http://example.com' })
@config = Nanoc::ConfigView.new(config, @view_context)