Sha256: 0007a30e768d977db3053a5d01b7911ea81053ca718baeb880d14d93dc00e948
Contents?: true
Size: 1.78 KB
Versions: 3
Compression:
Stored size: 1.78 KB
Contents
# encoding: utf-8 require 'test/helper' class Nanoc3::Filters::ErubisTest < MiniTest::Unit::TestCase include Nanoc3::TestHelpers def test_filter_with_instance_variable if_have 'erubis' do # Create filter filter = ::Nanoc3::Filters::Erubis.new({ :location => 'a cheap motel' }) # Run filter result = filter.run('<%= "I was hiding in #{@location}." %>') assert_equal('I was hiding in a cheap motel.', result) end end def test_filter_with_instance_method if_have 'erubis' do # Create filter filter = ::Nanoc3::Filters::Erubis.new({ :location => 'a cheap motel' }) # Run filter result = filter.run('<%= "I was hiding in #{location}." %>') assert_equal('I was hiding in a cheap motel.', result) end end def test_filter_error if_have 'erubis' do # Create filter filter = ::Nanoc3::Filters::Erubis.new # Run filter raised = false begin filter.run('<%= this isn\'t really ruby so it\'ll break, muahaha %>') rescue SyntaxError => e e.message =~ /(.+?):\d+: / assert_match '?', $1 raised = true end assert raised end end def test_filter_with_yield if_have 'erubis' do # Create filter filter = ::Nanoc3::Filters::Erubis.new({ :content => 'a cheap motel' }) # Run filter result = filter.run('<%= "I was hiding in #{yield}." %>') assert_equal('I was hiding in a cheap motel.', result) end end def test_filter_with_yield_without_content if_have 'erubis' do # Create filter filter = ::Nanoc3::Filters::Erubis.new({ :location => 'a cheap motel' }) # Run filter assert_raises LocalJumpError do filter.run('<%= "I was hiding in #{yield}." %>') end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
nanoc3-3.1.9 | test/filters/test_erubis.rb |
nanoc3-3.1.8 | test/filters/test_erubis.rb |
nanoc3-3.2.0a4 | test/filters/test_erubis.rb |