Sha256: 6c54071b2497cc015f539a965eafd03f048bf7f867b9755aa4093bc93d5eca55
Contents?: true
Size: 1.78 KB
Versions: 1
Compression:
Stored size: 1.78 KB
Contents
require 'assert' require 'deas-erbtags/tag' require 'deas-erbtags/capture_tag' require 'deas-erbtags/link_to' module Deas::ErbTags::LinkTo class BaseTests < Assert::Context desc "the `LinkTo` module" setup do @template = Factory.template(Deas::ErbTags::LinkTo) end subject{ @template } should have_imeth :link_to should "include the `Tag` module" do assert_includes Deas::ErbTags::Tag, subject.class.included_modules end should "include the `CaptureTag` module" do assert_includes Deas::ErbTags::CaptureTag, subject.class.included_modules end should "create an anchor tag with no content or href" do no_href_content = subject.tag(:a) assert_equal no_href_content, subject.link_to end should "create an anchor tag with just an href" do href = subject.tag(:a, 'www.google.com', {:href => 'www.google.com'}) assert_equal href, subject.link_to('www.google.com') end should "create an anchor tag with an href and content" do href_content = subject.tag(:a, 'google', {:href => 'www.google.com'}) assert_equal href_content, subject.link_to('google', 'www.google.com') end should "create an anchor tag with an href, content, and attrs" do href_content_opts = subject.tag(:a, 'google', { :href => 'www.google.com', :id => 'google_link' }) link_to = subject.link_to('google', 'www.google.com', { :id => 'google_link' }) assert_equal href_content_opts, link_to end should "create an anchor tag with an href and captured content" do span = subject.tag(:span, 'google') exp = subject.tag(:a, "\n#{span}\n", {:href => 'www.google.com'}) + "\n" assert_equal exp, subject.link_to('www.google.com'){ span } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
deas-erbtags-0.2.0 | test/unit/link_to_tests.rb |