test/helpers/test_capturing.rb in nanoc-4.5.2 vs test/helpers/test_capturing.rb in nanoc-4.5.3
- old
+ new
@@ -13,13 +13,18 @@
Nanoc::ViewContext.new(
reps: item_rep_repo_for(item),
items: :__irrelevant__,
dependency_tracker: :__irrelevant__,
compilation_context: :__irrelevant__,
+ snapshot_repo: snapshot_repo,
)
end
+ def snapshot_repo
+ @_snapshot_repo ||= Nanoc::Int::SnapshotRepo.new
+ end
+
def before
super
Nanoc::CLI::ErrorHandler.enable
end
@@ -72,11 +77,13 @@
<%= content_for @item, :outerbox %>
foot
EOS
item = Nanoc::Int::Item.new('content', {}, '/')
+ view_context = view_context_for(item)
@item = Nanoc::ItemWithRepsView.new(item, view_context_for(item))
+ @config = Nanoc::ConfigView.new(Nanoc::Int::Configuration.new, view_context)
result = ::ERB.new(content).result(binding)
expected = %w(head before basic after foot)
actual = result.scan(/[a-z]+/)
@@ -153,18 +160,18 @@
io.write "route '*' do ; item.identifier + 'index.html' ; end\n"
end
# Compile once
File.open('content/includer.erb', 'w') do |io|
- io.write 'Old-<%= content_for(@items.find { |i| i.identifier == \'/includee/\' }, :blah) %>'
+ io.write 'Old-<%= content_for(@items["/includee/"], :blah) %>'
end
Nanoc::CLI.run(%w(compile))
assert_equal '{}', File.read('output/includee/index.html')
assert_equal 'Old-Content', File.read('output/includer/index.html')
# Compile again
File.open('content/includer.erb', 'w') do |io|
- io.write 'New-<%= content_for(@items.find { |i| i.identifier == \'/includee/\' }, :blah) %>'
+ io.write 'New-<%= content_for(@items["/includee/"], :blah) %>'
end
Nanoc::CLI.run(%w(compile))
assert_equal '{}', File.read('output/includee/index.html')
assert_equal 'New-Content', File.read('output/includer/index.html')
end