Sha256: 0afc789b4dd4040c3ddacd0007753d9c3052274ad47f359ad32f87d485c10b39

Contents?: true

Size: 783 Bytes

Versions: 68

Compression:

Stored size: 783 Bytes

Contents

require 'test_helper'

class IndenterTest < ActiveSupport::TestCase

  Indenter = ExpressTemplates::Indenter

  test ".for(:name) takes a block receiving whitespace" do
    Indenter.for(:foo) do
      assert_equal "\n  ", Indenter.for(:foo) { |indent, indent_with_newline| indent_with_newline }
      assert_equal "  ", Indenter.for(:foo) { |indent, indent_with_newline| indent }
    end
  end

  test "nesting blocks increases whitespace accordingly" do
    nested_whitespace = Indenter.for(:foo) do |ws1|
      Indenter.for(:foo) do |ws2|
        ws2
      end
    end
    assert_equal "  ", nested_whitespace
  end

  test ".for(:name) returns current indent without newline when block is not given" do
    assert_equal "", Indenter.for(:foo) { |_| Indenter.for(:foo) }
  end

end

Version data entries

68 entries across 68 versions & 2 rubygems

Version Path
express_templates-0.11.10 test/indenter_test.rb
express_templates-0.11.9 test/indenter_test.rb
express_templates-0.11.8 test/indenter_test.rb
express_templates-0.11.7 test/indenter_test.rb
express_templates-0.11.6 test/indenter_test.rb
express_templates-0.11.5 test/indenter_test.rb
express_templates-0.11.4 test/indenter_test.rb
express_admin-1.7.5 vendor/gems/express_templates/test/indenter_test.rb
express_admin-1.7.4 vendor/gems/express_templates/express_templates/test/indenter_test.rb
express_admin-1.7.3 vendor/gems/express_templates/test/indenter_test.rb
express_admin-1.7.2 vendor/gems/express_templates/test/indenter_test.rb
express_admin-1.7.1 vendor/gems/express_templates/test/indenter_test.rb
express_admin-1.6.13 vendor/gems/express_templates/test/indenter_test.rb
express_admin-1.6.12 vendor/gems/express_templates/test/indenter_test.rb
express_admin-1.6.11 vendor/gems/express_templates/test/indenter_test.rb
express_admin-1.6.10 vendor/gems/express_templates/test/indenter_test.rb
express_admin-1.6.9 vendor/gems/express_templates/test/indenter_test.rb
express_admin-1.6.8 vendor/gems/express_templates/test/indenter_test.rb
express_admin-1.6.7 vendor/gems/express_templates/test/indenter_test.rb
express_templates-0.11.3 test/indenter_test.rb