Sha256: 13619cf3e1cd2f42d4a2852333f96a3258b142df41191efdddbe77dd89d58700

Contents?: true

Size: 883 Bytes

Versions: 5

Compression:

Stored size: 883 Bytes

Contents

require 'erb'

require File.expand_path('../simple', __FILE__)
require File.expand_path('../quoted', __FILE__)
require File.expand_path('../inline_block', __FILE__)

describe "ERB files" do
  before :each do
    @simple = Template['stdlib/erb/simple']
    @quoted = Template['stdlib/erb/quoted']
    @inline_block = Template['stdlib/erb/inline_block']
  end

  it "should be defined by their filename on Template namespace" do
    @simple.should be_kind_of(Template)
  end

  it "calling the block with a context should render the block" do
    @some_data = "hello"
    @simple.render(self).should == "<div>hello</div>\n"
  end

  it "should accept quotes in strings" do
    @name = "adam"
    @quoted.render(self).should == "<div class=\"foo\">hello there adam</div>\n"
  end

  it "should be able to handle inline blocks" do
    @inline_block.should be_kind_of(Template)
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
opal-0.6.0 spec/opal/stdlib/erb/erb_spec.rb
opal-0.5.5 spec/opal/stdlib/erb/erb_spec.rb
opal-0.5.4 spec/stdlib/erb/erb_spec.rb
opal-0.5.2 spec/stdlib/erb/erb_spec.rb
opal-0.5.0 spec/stdlib/erb/erb_spec.rb