Sha256: 6c315f7c785c355eea7450c08335e495384996b4d60d7f9ff8509f7ca2632908
Contents?: true
Size: 1.39 KB
Versions: 1
Compression:
Stored size: 1.39 KB
Contents
require 'assert' require 'deas-erbtags/tag' require 'deas-erbtags/capture_tag' module Deas::ErbTags::CaptureTag class BaseTests < Assert::Context desc "the `CaptureTag` module" setup do @template = Factory.template(Deas::ErbTags::CaptureTag) end subject{ @template } should have_imeth :capture_tag should "include the `Tag` module" do assert_includes Deas::ErbTags::Tag, subject.class.included_modules end should "create content by capturing content from a given block" do div_div = subject.tag(:div, "\n#{subject.tag(:div, "\ninner\n")}\n\n", { :id => 'outer' }) + "\n" buf_content_div = subject.capture_tag(:div, :id => 'outer') do subject.capture_tag(:div){ subject._out_buf << 'inner' } end assert_equal div_div, buf_content_div end should "create content by returning content from a given block" do div_div = subject.tag(:div, "\n#{subject.tag(:div, "\ninner\n")}\n\n", { :id => 'outer' }) + "\n" returned_content_div = subject.capture_tag(:div, :id => 'outer') do subject.capture_tag(:div){ 'inner' } end assert_equal div_div, returned_content_div end should "create empty tags if no block given" do empty_div = subject.tag(:div, "\n\n", :id => 'outer') + "\n" assert_equal empty_div, subject.capture_tag(:div, :id => 'outer') end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
deas-erbtags-0.2.0 | test/unit/capture_tag_tests.rb |