Sha256: 5e84630e2718b778d9988ff907a0a30654ef82496051ad29da28a4b1f3e937bd

Contents?: true

Size: 733 Bytes

Versions: 1

Compression:

Stored size: 733 Bytes

Contents

require "assert"
require "stringio"
require 'undies/node_stack'

require "undies/template"

class Undies::Template

  class BuilderRenderTests < Assert::Context
    desc 'a template rendered using the builder approach'
    before do
      @src = Undies::Source.new(Proc.new {})
      @output = Undies::Output.new(@outstream = StringIO.new(@out = ""))
      @t = Undies::Template.new(@src, {}, @output)
    end
    subject { @t }

    should "maintain scope throughout the build blocks" do
      templ = Undies::Template.new(@output)
      templ._div {
        templ._div {
          templ.__ self.object_id
        }
      }
      templ.__flush

      assert_equal "<div><div>#{self.object_id}</div></div>", @out
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
undies-2.2.1 test/template_builder_render_test.rb