test/helpers/test_capturing.rb in nanoc-4.0.0b4 vs test/helpers/test_capturing.rb in nanoc-4.0.0rc1
- old
+ new
@@ -13,13 +13,13 @@
content = "head <% content_for :sidebar do %>\n" \
" <%= 1+2 %>\n" \
'<% end %> foot'
# Build site
- site = Nanoc::Int::Site.new({})
+ site = Nanoc::Int::SiteLoader.new.new_empty
item = Nanoc::Int::Item.new('moo', {}, '/blah/')
- @site = Nanoc::SiteView.new(Nanoc::Int::Site.new({}))
+ @site = Nanoc::SiteView.new(Nanoc::Int::SiteLoader.new.new_empty)
@item = Nanoc::ItemView.new(item)
# Evaluate content
result = ::ERB.new(content).result(binding)
@@ -30,11 +30,11 @@
def test_capture
require 'erb'
# Build site
- @site = Nanoc::SiteView.new(Nanoc::Int::Site.new({}))
+ @site = Nanoc::SiteView.new(Nanoc::Int::SiteLoader.new.new_empty)
@item = Nanoc::ItemView.new(Nanoc::Int::Item.new('moo', {}, '/blah/'))
# Capture
_erbout = 'foo'
captured_content = capture do
@@ -64,11 +64,11 @@
<% end %>
<%= content_for @item, :box %>
foot
EOS
- @site = Nanoc::SiteView.new(Nanoc::Int::Site.new({}))
+ @site = Nanoc::SiteView.new(Nanoc::Int::SiteLoader.new.new_empty)
@item = Nanoc::ItemView.new(Nanoc::Int::Item.new('content', {}, '/'))
result = ::ERB.new(content).result(binding)
expected = %w( head before basic after foot )
@@ -82,18 +82,18 @@
File.open('Rules', 'w') do |io|
io.write "compile '*' do ; filter :erb ; end\n"
io.write "route '*' do ; item.identifier + 'index.html' ; end\n"
end
- @site = Nanoc::SiteView.new(Nanoc::Int::Site.new({}))
+ @site = Nanoc::SiteView.new(Nanoc::Int::SiteLoader.new.new_empty)
@item = Nanoc::ItemView.new(Nanoc::Int::Item.new('content', {}, '/'))
content = '<% content_for :a do %>Content One<% end %>'
::ERB.new(content).result(binding)
assert_equal 'Content One', content_for(@item, :a)
assert_equal nil, content_for(@item, :b)
- @site = Nanoc::SiteView.new(Nanoc::Int::Site.new({}))
+ @site = Nanoc::SiteView.new(Nanoc::Int::SiteLoader.new.new_empty)
@item = Nanoc::ItemView.new(Nanoc::Int::Item.new('content', {}, '/'))
content = '<% content_for :b do %>Content Two<% end %>'
::ERB.new(content).result(binding)
assert_equal nil, content_for(@item, :a)