Sha256: b20c891513520d5beb499aab7e7510b3534dfe3ecab14fe89bff303fecc25b13

Contents?: true

Size: 1.69 KB

Versions: 12

Compression:

Stored size: 1.69 KB

Contents

require File.expand_path("#{File.dirname(__FILE__)}/../spec_helper")
require "erector/tag"

module Erector
  describe Tag do
    it "takes a name" do
      t = Tag.new("foo")
      t.name.should == "foo"
    end

    it "has default values for its options" do
      t = Tag.new("foo")
      t.self_closing?.should == false
      t.inline?.should == false
    end

    it "can take any combination of options" do
      t = Tag.new("foo", :self_closing)
      t.self_closing?.should == true
      t.inline?.should == false

      t = Tag.new("foo", :inline)
      t.self_closing?.should == false
      t.inline?.should == true

      t = Tag.new("foo", :self_closing, :inline)
      t.self_closing?.should == true
      t.inline?.should == true

      t = Tag.new("foo", :inline, :self_closing)
      t.self_closing?.should == true
      t.inline?.should == true
    end

    it "can take a method name" do
      t = Tag.new("foo", "bar")
      t.name.should == "foo"
      t.method_name.should == "bar"
      t.self_closing?.should == false
      t.inline?.should == false
    end

    it "can take a method name and options" do
      t = Tag.new("foo", "bar", :self_closing, :inline)
      t.name.should == "foo"
      t.method_name.should == "bar"
      t.self_closing?.should == true
      t.inline?.should == true
    end

    it "can underscorize its method name" do
      t = Tag.new("InclusiveLowerBound", :snake_case)
      t.name.should == "InclusiveLowerBound"
      t.method_name.should == "inclusive_lower_bound"
    end

    it "is smart about acronyms" do
      t = Tag.new("WatchCNNToday", :snake_case)
      t.name.should == "WatchCNNToday"
      t.method_name.should == "watch_cnn_today"
    end


  end
end


Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
erector-0.10.0 spec/erector/tag_spec.rb
erector-rails4-0.1.1 spec/erector/tag_spec.rb
erector-rails4-0.1.0 spec/erector/tag_spec.rb
erector-rails4-0.0.7 spec/erector/tag_spec.rb
erector-rails4-0.0.6 spec/erector/tag_spec.rb
erector-rails4-0.0.5 spec/erector/tag_spec.rb
erector-rails4-0.0.4 spec/erector/tag_spec.rb
erector-rails4-0.0.3 spec/erector/tag_spec.rb
erector-rails4-0.0.2 spec/erector/tag_spec.rb
erector-rails4-0.0.1 spec/erector/tag_spec.rb
erector-0.9.0 spec/erector/tag_spec.rb
erector-0.9.0.pre1 spec/erector/tag_spec.rb