Sha256: 4ce400f11ddb6edd6efa9b734d49fce55ff1d776e6acabea52e53ea5f5d27ab0

Contents?: true

Size: 1.11 KB

Versions: 2

Compression:

Stored size: 1.11 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
context 'TextTest' do
  include HelperMethods
  setup do
    setup_spec
  end

  specify 'should_generate_text_based_on_property' do
    target = create_element('target')
    template = create_element('text')
    template.attributes['property'] = 'property'
    text = Text.new({'property' => 'text'})
    text.process(target, template, nil)
    target.text.should_equal 'text'
  end
  
  specify 'should_throw_exception_if_property_not_set' do
    target = create_element('target')
    template = create_element('text')
    template.attributes['property'] = 'one'
    text = Text.new(Hash.new)
    begin
      text.process(target, template, nil)
      fail('TemplateError should have been thrown')
    rescue TemplateError => exception
      exception.message.include?('one').should_equal true
    end
  end
end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
BuildMaster-0.9.0 test/buildmaster/templatelets/tc_text.rb
BuildMaster-0.9.1 test/buildmaster/templatelets/tc_text.rb