Sha256: 27ae734500360632d203aee241fc803c7328ed4fe58bdef12dbda6d2dc174d04

Contents?: true

Size: 855 Bytes

Versions: 12

Compression:

Stored size: 855 Bytes

Contents

require 'spec_helper'
module WLang
  describe Html, ">{...}" do

    def render(tpl, scope = {})
      Html.render(tpl, scope, "")
    end

    it 'renders a Template object by default' do
      who     = "World"
      partial = Html.compile("${who}")
      render("Hello >{partial}", binding).should eq("Hello World")
    end

    it 'recognizes a Tilt::WLangTemplate' do
      who     = "World"
      partial = Tilt::WLangTemplate.new{ "${who}" }
      render("Hello >{partial}", binding).should eq("Hello World")
    end

    it 'compiles a String to a Template' do
      who     = "World"
      partial = "${who}"
      render("Hello >{partial}", binding).should eq("Hello World")
    end

    it 'call a Proc as +{...} does' do
      partial = Proc.new{ "World" }
      render("Hello >{partial}", binding).should eq("Hello World")
    end

  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
wlang-3.0.1 spec/integration/html/test_greater.rb
wlang-3.0.0 spec/integration/html/test_greater.rb
wlang-2.3.1 spec/integration/html/test_greater.rb
wlang-2.3.0 spec/integration/html/test_greater.rb
wlang-2.2.4 spec/integration/html/test_greater.rb
wlang-2.2.3 spec/integration/html/test_greater.rb
wlang-2.2.2 spec/integration/html/test_greater.rb
wlang-2.2.1 spec/integration/html/test_greater.rb
wlang-2.2.0 spec/integration/html/test_greater.rb
wlang-2.1.2 spec/integration/html/test_greater.rb
wlang-2.1.1 spec/integration/html/test_greater.rb
wlang-2.1.0 spec/integration/html/test_greater.rb