Sha256: 3c7ea3ae377d2fd7290a10f40ffeab521dd15219fa9ffe7c22fc288030823e13

Contents?: true

Size: 1.38 KB

Versions: 1

Compression:

Stored size: 1.38 KB

Contents

require 'spec_helper'

describe Twitter::Bootstrap::Markup::Rails::Helpers::InlineLabelHelpers do
  include BootstrapSpecHelper

  describe "#inline_label_tag" do
    before do
      @output_buffer = ''
    end

    it "has label class" do
      concat bootstrap_inline_label_tag("Hi There")
      output_buffer.should have_tag("span.label")
    end

    it "has a message" do
      concat bootstrap_inline_label_tag("Hi There")
      output_buffer.should have_tag("span", "Hi There")
    end

    it "should add html_options to the resulting SPAN tag when specified" do
      concat bootstrap_inline_label_tag("Testing", :html_options => {:"data-test" => "42"})
      output_buffer.should have_tag("span[data-test='42']")
    end
  end

  %w(success warning important notice info inverse).each do |type|
    describe "#inline_label_#{type}_tag" do
      before do
        @output_buffer = ''
      end

      it "has label class" do
        concat send("bootstrap_inline_label_#{type}_tag", "Message")
        output_buffer.should have_tag("span.label")
      end

      it "has #{type} class" do
        concat send("bootstrap_inline_label_#{type}_tag", "Message")
        output_buffer.should have_tag("span.#{type}")
      end

      it "has a message" do
        concat send("bootstrap_inline_label_#{type}_tag", "Message")
        output_buffer.should have_tag('span', /Message/)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
twitter-bootstrap-markup-rails-0.3.2.2 spec/helpers/inline_label_helpers_spec.rb