Sha256: 9c6a9321499fcaca983c00bb569e61be3f5799f2386f1d704a02074a0b4f9dbf

Contents?: true

Size: 797 Bytes

Versions: 1

Compression:

Stored size: 797 Bytes

Contents

require 'test_helper'

class WrapperTest < ActiveSupport::TestCase

  test "name compiles to just name" do
    assert_equal '"#{foo}"', ExpressTemplates::Components::Wrapper.new('foo').compile
  end

  test "simple args are preserved" do
    wrapper =  ExpressTemplates::Components::Wrapper.new('foo', "xyzzy", 'bar', "baz", 1, false, 3)
    assert_equal '"#{foo("xyzzy", "bar", "baz", 1, false, 3)}"', wrapper.compile
  end

  test "args are preserved" do
    wrapper =  ExpressTemplates::Components::Wrapper.new('foo', "xyzzy", bar: "baz")
    assert_equal '"#{foo("xyzzy", bar: "baz")}"', wrapper.compile
  end

  test "something returning nil when wrapped and compiled, evals to an empty string" do
    assert_equal '', eval(ExpressTemplates::Components::Wrapper.new('nil').compile)
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
express_templates-0.2.0 test/wrapper_test.rb