Sha256: 1049b80ccec04d94e7865100b1886e9604c2b258d3f2f2734038c86934c61e50
Contents?: true
Size: 1.04 KB
Versions: 710
Compression:
Stored size: 1.04 KB
Contents
require File.expand_path(File.dirname(__FILE__) + '/../../test_helper') require 'rbbt/util/simpleDSL' require 'test/unit' class TestSimpleDSLClass 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 = TestSimpleDSLClass.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
710 entries across 710 versions & 1 rubygems