Sha256: 2c5cfa262e394ad56a3f025db626487297e3a926a49f6a67ad0ad5caf6da312c

Contents?: true

Size: 865 Bytes

Versions: 1

Compression:

Stored size: 865 Bytes

Contents

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

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

    [true, "Something", []].each do |test|
      context "when #{test.inspect}" do
        it 'renders the then block' do
          render("?{test}{hello}", binding).should eq("hello")
        end
        it 'does not render the else block' do
          render("?{test}{hello}{otherwise}", binding).should eq("hello")
        end
      end
    end

    [false, nil].each do |test|
      context "when #{test.inspect}" do
        it 'do not render the then block' do
          render("?{test}{hello}", binding).should eq("")
        end
        it 'renders the else block if present' do
          render("?{test}{hello}{otherwise}", binding).should eq("otherwise")
        end
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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