Sha256: 725a729089b56220872060368c660f3daefcd548c7ea49fc054ee5396ef08af5
Contents?: true
Size: 1.02 KB
Versions: 128
Compression:
Stored size: 1.02 KB
Contents
require File.expand_path(File.dirname(__FILE__) + '/../../test_helper') require 'rbbt/util/simpleDSL' require 'test/unit' class TestClass include SimpleDSL def action(name, *args, &block) @actions ||= {} @actions[name] = args.first end def actions @actions end end class TestDSL < Test::Unit::TestCase def setup @parser = TestClass.new @parser.load_config(:action) do action1 "Hello" action2 "Good bye" end end def test_actions assert_equal({:action1=>"Hello", :action2=>"Good bye"}, @parser.actions) end def test_method_missing assert_raise(NoMethodError){@parser.cues} end def test_config config = <<-EOC action1("Hello") action2("Good bye") EOC begin assert(@parser.config(:action) == config) rescue SimpleDSL::NoRuby2Ruby end end def test_parse @parser.parse :action do action3 "Back again" end assert_equal({:action1 =>"Hello", :action2 =>"Good bye", :action3 =>"Back again"}, @parser.actions) end end
Version data entries
128 entries across 128 versions & 1 rubygems