Sha256: c1a08bd19f48bda3329f628e78b05a903a05726380becc55a90006226cf9b4ec

Contents?: true

Size: 1.42 KB

Versions: 4

Compression:

Stored size: 1.42 KB

Contents

#
# testing ruote
#
# Wed Aug  5 08:35:38 JST 2009
#

require File.expand_path('../base', __FILE__)


class FtLoadDefsTest < Test::Unit::TestCase
  include FunctionalBase

  def test_load_definition

    pdef = %{
Ruote.process_definition :name => 'test' do
  sequence do
    echo 'a'
    echo 'b'
  end
end
    }

    path = File.join('work', 'tmp')
    fn = File.join(path, 'pdef.rb')

    FileUtils.mkdir_p(path)
    File.open(fn, 'w') { |f| f.write(pdef) }

    assert_equal(
      [ 'define', { 'name' => 'test' }, [
        ['sequence', {}, [
          ['echo', { 'a' => nil }, [] ],
          ['echo', { 'b' => nil}, [] ] ] ] ] ],
      @dashboard.load_definition(fn))
  end

  def test_load_definition_with_absolute_path

    pdef = %{
Ruote.process_definition do
  echo 'a'
end
    }

    path = File.join('work', 'tmp')
    fn = File.join(path, 'pdef.rb')

    FileUtils.mkdir_p(path)
    File.open(fn, 'w') { |f| f.write(pdef) }

    fn = File.expand_path(fn)

    assert_equal(
      [ 'define', {}, [ [ 'echo', { 'a' => nil }, [] ] ] ],
      @dashboard.load_definition(fn))
  end

  def test_load_illegal_definition

    pdef = %{
Ruote.process_definition :name => 'test' do
  exit
end
    }

    path = File.join('work', 'tmp')
    fn = File.join(path, 'pdef.rb')

    FileUtils.mkdir_p(path)
    File.open(fn, 'w') { |f| f.write(pdef) }

    assert_raise Ruote::Reader::Error do
      @dashboard.load_definition(fn)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ruote-2.3.0.3 test/functional/ft_23_load_defs.rb
ruote-2.3.0.2 test/functional/ft_23_load_defs.rb
ruote-2.3.0.1 test/functional/ft_23_load_defs.rb
ruote-2.3.0 test/functional/ft_23_load_defs.rb