Sha256: 01d0a2ec2a4c1d83baea9821ec21a62958c50e2dd64bd65ae4577dc8fcd51667

Contents?: true

Size: 1.07 KB

Versions: 2

Compression:

Stored size: 1.07 KB

Contents

$:.unshift File.dirname(__FILE__)

require 'common_templatelet_test'

$:.unshift File.join(File.dirname(__FILE__), '..', '..', '..', 'lib')

require 'rexml/document'
require 'rexml/xpath'
require 'buildmaster/site_spec'
require 'buildmaster/source_content'

module BuildMaster
class TextTest < CommonTemplateletTest
  def test_should_generate_text_based_on_property
    target = create_element('target')
    template = create_element('text')
    template.attributes['property'] = 'property'
    text = Text.new({'property' => 'text'})
    text.process(target, template, nil)
    assert_equal('text', target.text)
  end
  
  def test_should_throw_exception_if_property_not_set
    target = create_element('target')
    template = create_element('text')
    template.attributes['property'] = 'one'
    text = Text.new(Hash.new)
    begin
      text.process(target, template, nil)
      fail('TemplateException should have been thrown')
    rescue TemplateException => exception
      assert_equal(true, exception.message.include?('one'))
    end
  end
end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
BuildMaster-0.8.0 test/buildmaster/templatelets/tc_text.rb
BuildMaster-0.8.1 test/buildmaster/templatelets/tc_text.rb