Sha256: 6a7dc6769504d7a0122f7b35d593f3fb911afeb6e771edd6a2bfc1a10f15318f

Contents?: true

Size: 661 Bytes

Versions: 1

Compression:

Stored size: 661 Bytes

Contents

require_relative '../spec_helper'

require 'wright/util/erb_renderer'

describe Wright::Util::ErbRenderer do
  describe 'render' do
    it 'should render ERB templates' do
      template = "foo: <%= foo %>\n"
      hash = { foo: 'FOO' }
      renderer = Wright::Util::ErbRenderer.new(hash)
      expected = "foo: FOO\n"
      actual = renderer.render(template)
      actual.must_equal expected
    end

    it 'should throw exceptions when encountering undefined names' do
      template = '<%= undefined_name %>'
      hash = {}
      renderer = Wright::Util::ErbRenderer.new(hash)
      -> { renderer.render(template) }.must_raise NameError
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
wright-0.5.0 spec/util/erb_renderer_spec.rb