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

- old
+ new

@@ -15,29 +15,28 @@ content = "head <% content_for :sidebar do %>\n" \ " <%= 1+2 %>\n" \ '<% end %> foot' # Build site - @site = Nanoc3::Site.new({}) - @item = Nanoc::Item.new('moo', {}, '/blah/') + @site = Nanoc::Int::Site.new({}) + @item = Nanoc::Int::Item.new('moo', {}, '/blah/') @item.site = @site # Evaluate content result = ::ERB.new(content).result(binding) # Check assert_equal '3', content_for(@item, :sidebar).strip - assert_equal '3', @item[:content_for_sidebar].strip assert_match(/^head\s+foot$/, result) end def test_capture require 'erb' # Build site - @site = Nanoc3::Site.new({}) - @item = Nanoc::Item.new('moo', {}, '/blah/') + @site = Nanoc::Int::Site.new({}) + @item = Nanoc::Int::Item.new('moo', {}, '/blah/') # Capture _erbout = 'foo' captured_content = capture do _erbout << 'bar' @@ -66,12 +65,12 @@ <% end %> <%= content_for @item, :box %> foot EOS - @site = Nanoc3::Site.new({}) - @item = Nanoc::Item.new('content', {}, '/') + @site = Nanoc::Int::Site.new({}) + @item = Nanoc::Int::Item.new('content', {}, '/') result = ::ERB.new(content).result(binding) expected = %w( head before basic after foot ) actual = result.scan(/[a-z]+/) @@ -84,19 +83,19 @@ 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 = Nanoc3::Site.new({}) - @item = Nanoc::Item.new('content', {}, '/') + @site = Nanoc::Int::Site.new({}) + @item = 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 = Nanoc3::Site.new({}) - @item = Nanoc::Item.new('content', {}, '/') + @site = Nanoc::Int::Site.new({}) + @item = 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) assert_equal 'Content Two', content_for(@item, :b)