Sha256: 43f8270a2a23071d897d97add3e5cac8194d0a04ed9d982fcada0fe5eee9ef96

Contents?: true

Size: 868 Bytes

Versions: 1

Compression:

Stored size: 868 Bytes

Contents

require 'spec_helper'
require 'wlang/html'
module WLang
  describe Html, "*{...}" do

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

    let(:numbers){ [1, 2, 3] }

    it 'renders the main block for each element' do
      render("*{numbers}{+{self}}", binding).should eq("123")
    end

    it 'renders the between block if present' do
      render("*{numbers}{+{self}}{,}", binding).should eq("1,2,3")
    end

    it 'preserves spacing in the third block' do
      pending{
        render("*{numbers}{+{self}}{, }", binding).should eq("1, 2, 3")
      }
    end

    it 'renders nothing on empty collections' do
      empty = []
      render("*{empty}{+{self}}", binding).should eq("")
    end

    it 'supports any enumerable' do
      elms = (1..5)
      render("*{elms}{+{self}}{,}", binding).should eq("1,2,3,4,5")
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
wlang-2.0.0.beta spec/integration/html/test_star.rb