Sha256: 466b21462feecccfd1b405574632fac78f4b900d49444083c8fa7b35206a9898

Contents?: true

Size: 1.22 KB

Versions: 6

Compression:

Stored size: 1.22 KB

Contents

require 'spec_helper'

# Merb::Router.prepare do
#   default_routes
# end

describe Merb::Helpers::Tag do
  include Merb::Helpers::Tag
  
  describe "#tag" do
    it 'generates <div>content</div> from tag :div, "content"' do
      response = request "/tag_helper/tag_with_content"

      response.should have_selector("div")
      response.body.to_s.should include("Astral Projection ~ Dancing Galaxy")
    end

    it 'outputs content returned by the block when block is given'  do
      response = request "/tag_helper/tag_with_content_in_the_block"

      response.should have_selector("div")
      response.body.should include("Astral Projection ~ Trust in Trance 1")
    end

    it 'generates tag attributes for all of keys of last Hash' do
      response = request "/tag_helper/tag_with_attributes"

      response.should have_selector("div.psy")
      response.should have_selector("div#bands")
      response.should have_selector("div[invalid_attr='at least in html']")
    end    

    it 'handles nesting of tags/blocks' do
      response = request "/tag_helper/nested_tags"

      response.should have_selector("div.discography ul.albums li.first")
      response.should have_selector("#tit:contains('Trust in Trance 2')")
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
merb-helpers-1.1.3 spec/merb_helpers_tag_helper_spec.rb
merb-helpers-1.1.2 spec/merb_helpers_tag_helper_spec.rb
merb-helpers-1.1.1 spec/merb_helpers_tag_helper_spec.rb
merb-helpers-1.1.0 spec/merb_helpers_tag_helper_spec.rb
merb-helpers-1.1.0.rc1 spec/merb_helpers_tag_helper_spec.rb
merb-helpers-1.1.0.pre spec/merb_helpers_tag_helper_spec.rb