/vendor/daemon_kit/test/test_amqp_generator.rb
Ruby | 48 lines | 27 code | 8 blank | 13 comment | 0 complexity | 9a9cf727173efa1fdbb0b66d561caa32 MD5 | raw file
1require File.join(File.dirname(__FILE__), "test_generator_helper.rb") 2 3 4class TestAmqpGenerator < Test::Unit::TestCase 5 include RubiGen::GeneratorTestHelper 6 7 def setup 8 bare_setup 9 end 10 11 def teardown 12 bare_teardown 13 end 14 15 # Some generator-related assertions: 16 # assert_generated_file(name, &block) # block passed the file contents 17 # assert_directory_exists(name) 18 # assert_generated_class(name, &block) 19 # assert_generated_module(name, &block) 20 # assert_generated_test_for(name, &block) 21 # The assert_generated_(class|module|test_for) &block is passed the body of the class/module within the file 22 # assert_has_method(body, *methods) # check that the body has a list of methods (methods with parentheses not supported yet) 23 # 24 # Other helper methods are: 25 # app_root_files - put this in teardown to show files generated by the test method (e.g. p app_root_files) 26 # bare_setup - place this in setup method to create the APP_ROOT folder for each test 27 # bare_teardown - place this in teardown method to destroy the TMP_ROOT or APP_ROOT folder after each test 28 29 def test_generator_without_options 30 name = "myapp" 31 run_generator('amqp', [name], sources) 32 assert_directory_exists "config" 33 assert_directory_exists "config/initializers" 34 assert_generated_file "config/amqp.yml" 35 assert_generated_file "config/initializers/myapp.rb" 36 assert_generated_file "libexec/myapp-daemon.rb" 37 end 38 39 private 40 def sources 41 [RubiGen::PathSource.new(:test, File.join(File.dirname(__FILE__),"..", generator_path)) 42 ] 43 end 44 45 def generator_path 46 "daemon_generators" 47 end 48end