Sha256: d6cf43cf4d040d63ee61fdf2bf0ecda503e7b67067448fcb2a7252df1a576260

Contents?: true

Size: 1.04 KB

Versions: 2

Compression:

Stored size: 1.04 KB

Contents

require File.dirname(__FILE__) + "/../../spec_helper"

module Simply
  describe HTMLBuilder, "with indentation" do
    before(:each) do
      @builder = HTMLBuilder.new(:indent => true)
    end
    
    it "should be indented when passed :indent => true" do
      builder = HTMLBuilder.new(:indent => true)
      builder.should be_indented
    end
    
    it "should not be indented when passed :indent => false" do
      builder = HTMLBuilder.new(:indent => false)
      builder.should_not be_indented
    end
    
    it "should not be indented by default" do
      builder = HTMLBuilder.new
      builder.should_not be_indented
    end
    
    it "should indent html when indented = true, and given a block structure" do
      @builder.html do
        body do
        end
      end
      
      @builder.to_s.should == (<<-HERE).chomp
<html>
  <body>
  </body>
</html>
HERE
    end
    
    it "should not indent tags which are on the same block level" do
      @builder.br
      @builder.br
      @builder.to_s.should == "<br />\n<br />"
    end
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
smtlaissezfaire-simply-0.1.1 spec/simply/html_builder/indentation_spec.rb
simply-0.1.3 spec/simply/html_builder/indentation_spec.rb