root/test/test_vintage_application_generator.rb

Revision 1, 1.5 kB (checked in by jeremymcanal..@gmail.com, 7 months ago)

--

Line 
1 require File.join(File.dirname(__FILE__), "test_generator_helper.rb")
2
3 class TestVintageApplicationGenerator < Test::Unit::TestCase
4   include RubiGen::GeneratorTestHelper
5
6   def setup
7     bare_setup
8   end
9  
10   def teardown
11     bare_teardown
12   end
13  
14   # Some generator-related assertions:
15   #   assert_generated_file(name, &block) # block passed the file contents
16   #   assert_directory_exists(name)
17   #   assert_generated_class(name, &block)
18   #   assert_generated_module(name, &block)
19   #   assert_generated_test_for(name, &block)
20   # The assert_generated_(class|module|test_for) &block is passed the body of the class/module within the file
21   #   assert_has_method(body, *methods) # check that the body has a list of methods (methods with parentheses not supported yet)
22   #
23   # Other helper methods are:
24   #   app_root_files - put this in teardown to show files generated by the test method (e.g. p app_root_files)
25   #   bare_setup - place this in setup method to create the APP_ROOT folder for each test
26   #   bare_teardown - place this in teardown method to destroy the TMP_ROOT or APP_ROOT folder after each test
27  
28   def test_generator_without_options
29     run_generator('vintage_application', [APP_ROOT], sources)
30     assert_directory_exists "path/to/included/folder"
31     assert_generated_file   "path/to/included/folder/some_file"
32   end
33  
34   private
35   def sources
36     [RubiGen::PathSource.new(:test, File.join(File.dirname(__FILE__),"..", generator_path))
37     ]
38   end
39  
40   def generator_path
41     "app_generators"
42   end
43 end
Note: See TracBrowser for help on using the browser.