gigantron 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. data/test/test_generator_helper.rb +29 -29
  2. data/test/test_gigantron_generator.rb +118 -114
  3. data/test/test_helper.rb +4 -4
  4. data/test/test_mapreduce_task_generator.rb +50 -50
  5. data/test/test_migration_generator.rb +49 -49
  6. data/test/test_model_generator.rb +53 -53
  7. data/test/test_task_generator.rb +48 -48
  8. metadata +48 -109
  9. data/History.txt +0 -15
  10. data/License.txt +0 -20
  11. data/Manifest.txt +0 -62
  12. data/PostInstall.txt +0 -4
  13. data/README.txt +0 -77
  14. data/Rakefile +0 -4
  15. data/app_generators/gigantron/USAGE +0 -7
  16. data/app_generators/gigantron/gigantron_generator.rb +0 -81
  17. data/app_generators/gigantron/templates/Rakefile +0 -12
  18. data/app_generators/gigantron/templates/database.yml +0 -8
  19. data/app_generators/gigantron/templates/initialize.rb +0 -34
  20. data/app_generators/gigantron/templates/tasks/import.rake +0 -10
  21. data/app_generators/gigantron/templates/test/tasks/test_import.rb +0 -23
  22. data/app_generators/gigantron/templates/test/test_helper.rb +0 -7
  23. data/bin/gigantron +0 -15
  24. data/config/hoe.rb +0 -82
  25. data/config/requirements.rb +0 -15
  26. data/gigantron_generators/mapreduce_task/USAGE +0 -5
  27. data/gigantron_generators/mapreduce_task/mapreduce_task_generator.rb +0 -54
  28. data/gigantron_generators/mapreduce_task/templates/mapreduce/mr_task.rb +0 -22
  29. data/gigantron_generators/mapreduce_task/templates/tasks/task.rake +0 -5
  30. data/gigantron_generators/mapreduce_task/templates/test/tasks/test_task.rb +0 -22
  31. data/gigantron_generators/migration/USAGE +0 -5
  32. data/gigantron_generators/migration/migration_generator.rb +0 -61
  33. data/gigantron_generators/migration/templates/db/migrate/migration.rb +0 -7
  34. data/gigantron_generators/model/USAGE +0 -11
  35. data/gigantron_generators/model/model_generator.rb +0 -54
  36. data/gigantron_generators/model/templates/models/model.rb +0 -3
  37. data/gigantron_generators/model/templates/test/models/test_model.rb +0 -13
  38. data/gigantron_generators/task/USAGE +0 -10
  39. data/gigantron_generators/task/task_generator.rb +0 -51
  40. data/gigantron_generators/task/templates/tasks/task.rake +0 -4
  41. data/gigantron_generators/task/templates/test/tasks/test_task.rb +0 -22
  42. data/lib/gigantron/migrator.rb +0 -10
  43. data/lib/gigantron/tasks/db.rb +0 -11
  44. data/lib/gigantron/tasks/test.rb +0 -30
  45. data/lib/gigantron/version.rb +0 -9
  46. data/lib/gigantron.rb +0 -0
  47. data/script/console +0 -10
  48. data/script/destroy +0 -14
  49. data/script/generate +0 -14
  50. data/script/txt2html +0 -82
  51. data/setup.rb +0 -1585
  52. data/tasks/deployment.rake +0 -34
  53. data/tasks/environment.rake +0 -7
  54. data/tasks/website.rake +0 -17
  55. data/test/template_database.yml +0 -9
  56. data/test/template_database.yml.example +0 -9
  57. data/test/template_migration.rb +0 -16
  58. data/website/index.html +0 -213
  59. data/website/index.txt +0 -145
  60. data/website/javascripts/rounded_corners_lite.inc.js +0 -285
  61. data/website/stylesheets/screen.css +0 -138
  62. data/website/template.html.erb +0 -48
@@ -1,29 +1,29 @@
1
- begin
2
- require File.dirname(__FILE__) + '/test_helper'
3
- rescue LoadError
4
- require 'test/unit'
5
- end
6
- require 'fileutils'
7
-
8
- # Must set before requiring generator libs.
9
- TMP_ROOT = File.dirname(__FILE__) + "/tmp" unless defined?(TMP_ROOT)
10
- PROJECT_NAME = "myproject" unless defined?(PROJECT_NAME)
11
- app_root = File.join(TMP_ROOT, PROJECT_NAME)
12
- if defined?(APP_ROOT)
13
- APP_ROOT.replace(app_root)
14
- else
15
- APP_ROOT = app_root
16
- end
17
- if defined?(RAILS_ROOT)
18
- RAILS_ROOT.replace(app_root)
19
- else
20
- RAILS_ROOT = app_root
21
- end
22
-
23
- begin
24
- require 'rubigen'
25
- rescue LoadError
26
- require 'rubygems'
27
- require 'rubigen'
28
- end
29
- require 'rubigen/helpers/generator_test_helper'
1
+ begin
2
+ require File.dirname(__FILE__) + '/test_helper'
3
+ rescue LoadError
4
+ require 'test/unit'
5
+ end
6
+ require 'fileutils'
7
+
8
+ # Must set before requiring generator libs.
9
+ TMP_ROOT = File.dirname(__FILE__) + "/tmp" unless defined?(TMP_ROOT)
10
+ PROJECT_NAME = "myproject" unless defined?(PROJECT_NAME)
11
+ app_root = File.join(TMP_ROOT, PROJECT_NAME)
12
+ if defined?(APP_ROOT)
13
+ APP_ROOT.replace(app_root)
14
+ else
15
+ APP_ROOT = app_root
16
+ end
17
+ if defined?(RAILS_ROOT)
18
+ RAILS_ROOT.replace(app_root)
19
+ else
20
+ RAILS_ROOT = app_root
21
+ end
22
+
23
+ begin
24
+ require 'rubigen'
25
+ rescue LoadError
26
+ require 'rubygems'
27
+ require 'rubigen'
28
+ end
29
+ require 'rubigen/helpers/generator_test_helper'
@@ -1,114 +1,118 @@
1
- require File.join(File.dirname(__FILE__), "test_generator_helper.rb")
2
-
3
- class TestGigantronGenerator < 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
- should "generate correct directory and file structure" do
15
- run_generator('gigantron', [APP_ROOT], sources)
16
- assert_directory_exists "tasks/"
17
- assert_generated_file "tasks/import.rake"
18
- assert_directory_exists "test/"
19
- assert_generated_file "test/test_helper.rb"
20
- assert_directory_exists "test/tasks/"
21
- assert_generated_file "test/tasks/test_import.rb"
22
- assert_directory_exists "test/models/"
23
- assert_directory_exists "lib/"
24
- assert_directory_exists "models/"
25
- assert_directory_exists "db/"
26
- assert_directory_exists "script/"
27
- assert_generated_file "script/generate"
28
- assert_generated_file "database.yml"
29
- assert_generated_file "Rakefile"
30
- assert_generated_file "initialize.rb"
31
- end
32
-
33
- context "Generated project" do
34
- setup do
35
- run_generator('gigantron', [APP_ROOT], sources)
36
-
37
- silence_warnings { GTRON_ENV = :test }
38
- ENV["GTRON_ENV"] = "test"
39
-
40
- initialize_gigantron
41
- configure_gigantron_db
42
- get_db_conn(GTRON_ENV)
43
- end
44
-
45
- context "with migration and model" do
46
- setup do
47
- run_generator('model', ['Foo'], sources)
48
-
49
- create_test_migration
50
- get_db_conn(GTRON_ENV)
51
-
52
- ENV["VERBOSE"] = "false"
53
- Gigantron.migrate_dbs
54
- end
55
-
56
- should "create test db" do
57
- assert File.exists?("#{APP_ROOT}/db/test.sqlite3")
58
- end
59
-
60
- should "create table foos and populate" do
61
- assert_equal Foo.find(:all).size, 2
62
- end
63
- end
64
-
65
- context "with Rake tasks" do
66
- setup do
67
- @rake = Rake::Application.new
68
- Rake.application = @rake
69
- load "#{APP_ROOT}/tasks/import.rake"
70
- end
71
-
72
- teardown { Rake.application = nil }
73
-
74
- should "run empty import task" do
75
- assert @rake['import'].invoke
76
- end
77
- end
78
- end
79
-
80
- private
81
- def sources
82
- [RubiGen::PathSource.new(:test, File.join(File.dirname(__FILE__),"..", generator_path)),
83
- RubiGen::PathSource.new(:test_components, File.join(File.dirname(__FILE__),"..", "gigantron_generators"))]
84
- end
85
-
86
- def generator_path
87
- "app_generators"
88
- end
89
-
90
- def initialize_gigantron
91
- require File.join(APP_ROOT, "initialize.rb")
92
- require 'gigantron/migrator'
93
- end
94
-
95
- def configure_gigantron_db
96
- if !File.exists? "test/template_database.yml"
97
- flunk "No Database Configuration. Configure test DB in 'test/template_database.yml'!"
98
- end
99
- File.open("#{APP_ROOT}/database.yml", "w") do |f|
100
- f.write ERB.new(
101
- File.read("test/template_database.yml")).result(binding)
102
- end
103
- end
104
-
105
- def create_test_migration
106
- if !File.exists? "#{APP_ROOT}/db/migrate/001_create_foos.rb"
107
- run_generator('migration', ['CreateFoos'], sources)
108
- end
109
-
110
- assert File.exists?("#{APP_ROOT}/db/migrate/001_create_foos.rb")
111
- FileUtils.cp("test/template_migration.rb",
112
- "#{APP_ROOT}/db/migrate/001_create_foos.rb")
113
- end
114
- end
1
+ require File.join(File.dirname(__FILE__), "test_generator_helper.rb")
2
+
3
+ class TestGigantronGenerator < 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
+ should "generate correct directory and file structure" do
15
+ run_generator('gigantron', [APP_ROOT], sources)
16
+ assert_directory_exists "tasks/"
17
+ assert_generated_file "tasks/import.rake"
18
+ assert_directory_exists "test/"
19
+ assert_generated_file "test/test_helper.rb"
20
+ assert_directory_exists "test/tasks/"
21
+ assert_generated_file "test/tasks/test_import.rb"
22
+ assert_directory_exists "test/models/"
23
+ assert_directory_exists "lib/"
24
+ assert_directory_exists "lib/shoulda/"
25
+ assert_generated_file "lib/shoulda/general.rb"
26
+ assert_generated_file "lib/shoulda/private_helpers.rb"
27
+ assert_generated_file "lib/shoulda/active_record_helpers.rb"
28
+ assert_directory_exists "models/"
29
+ assert_directory_exists "db/"
30
+ assert_directory_exists "script/"
31
+ assert_generated_file "script/generate"
32
+ assert_generated_file "database.yml.example"
33
+ assert_generated_file "Rakefile"
34
+ assert_generated_file "initialize.rb"
35
+ end
36
+
37
+ context "Generated project" do
38
+ setup do
39
+ run_generator('gigantron', [APP_ROOT], sources)
40
+
41
+ silence_warnings { GTRON_ENV = :test }
42
+ ENV["GTRON_ENV"] = "test"
43
+
44
+ initialize_gigantron
45
+ configure_gigantron_db
46
+ get_db_conn(GTRON_ENV)
47
+ end
48
+
49
+ context "with migration and model" do
50
+ setup do
51
+ run_generator('model', ['Foo'], sources)
52
+
53
+ create_test_migration
54
+ get_db_conn(GTRON_ENV)
55
+
56
+ ENV["VERBOSE"] = "false"
57
+ Gigantron.migrate_dbs
58
+ end
59
+
60
+ should "create test db" do
61
+ assert File.exists?("#{APP_ROOT}/db/test.sqlite3")
62
+ end
63
+
64
+ should "create table foos and populate" do
65
+ assert_equal Foo.find(:all).size, 2
66
+ end
67
+ end
68
+
69
+ context "with Rake tasks" do
70
+ setup do
71
+ @rake = Rake::Application.new
72
+ Rake.application = @rake
73
+ load "#{APP_ROOT}/tasks/import.rake"
74
+ end
75
+
76
+ teardown { Rake.application = nil }
77
+
78
+ should "run empty import task" do
79
+ assert @rake['import'].invoke
80
+ end
81
+ end
82
+ end
83
+
84
+ private
85
+ def sources
86
+ [RubiGen::PathSource.new(:test, File.join(File.dirname(__FILE__),"..", generator_path)),
87
+ RubiGen::PathSource.new(:test_components, File.join(File.dirname(__FILE__),"..", "gigantron_generators"))]
88
+ end
89
+
90
+ def generator_path
91
+ "app_generators"
92
+ end
93
+
94
+ def initialize_gigantron
95
+ require File.join(APP_ROOT, "initialize.rb")
96
+ require 'gigantron/migrator'
97
+ end
98
+
99
+ def configure_gigantron_db
100
+ if !File.exists? "test/template_database.yml"
101
+ flunk "No Database Configuration. Configure test DB in 'test/template_database.yml'!"
102
+ end
103
+ File.open("#{APP_ROOT}/database.yml", "w") do |f|
104
+ f.write ERB.new(
105
+ File.read("test/template_database.yml")).result(binding)
106
+ end
107
+ end
108
+
109
+ def create_test_migration
110
+ if !File.exists? "#{APP_ROOT}/db/migrate/001_create_foos.rb"
111
+ run_generator('migration', ['CreateFoos'], sources)
112
+ end
113
+
114
+ assert File.exists?("#{APP_ROOT}/db/migrate/001_create_foos.rb")
115
+ FileUtils.cp("test/template_migration.rb",
116
+ "#{APP_ROOT}/db/migrate/001_create_foos.rb")
117
+ end
118
+ end
data/test/test_helper.rb CHANGED
@@ -1,4 +1,4 @@
1
- require 'test/unit'
2
- require 'rubygems'
3
- require 'shoulda'
4
- require File.dirname(__FILE__) + '/../lib/gigantron'
1
+ require 'test/unit'
2
+ require 'rubygems'
3
+ require 'shoulda'
4
+ require File.dirname(__FILE__) + '/../lib/gigantron'
@@ -1,50 +1,50 @@
1
- require File.join(File.dirname(__FILE__), "test_generator_helper.rb")
2
-
3
-
4
- class TestMapreduceTaskGenerator < 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('mapreduce_task', [name], sources)
32
- assert_directory_exists "mapreduce/"
33
- assert_generated_file "mapreduce/mr_#{name}.rb"
34
- assert_directory_exists "tasks/"
35
- assert_generated_file "tasks/#{name}.rake"
36
- assert_directory_exists "test/"
37
- assert_directory_exists "test/tasks/"
38
- assert_generated_file "test/tasks/test_#{name}.rb"
39
- end
40
-
41
- private
42
- def sources
43
- [RubiGen::PathSource.new(:test, File.join(File.dirname(__FILE__),"..", generator_path))
44
- ]
45
- end
46
-
47
- def generator_path
48
- "gigantron_generators"
49
- end
50
- end
1
+ require File.join(File.dirname(__FILE__), "test_generator_helper.rb")
2
+
3
+
4
+ class TestMapreduceTaskGenerator < 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('mapreduce_task', [name], sources)
32
+ assert_directory_exists "mapreduce/"
33
+ assert_generated_file "mapreduce/mr_#{name}.rb"
34
+ assert_directory_exists "tasks/"
35
+ assert_generated_file "tasks/#{name}.rake"
36
+ assert_directory_exists "test/"
37
+ assert_directory_exists "test/tasks/"
38
+ assert_generated_file "test/tasks/test_#{name}.rb"
39
+ end
40
+
41
+ private
42
+ def sources
43
+ [RubiGen::PathSource.new(:test, File.join(File.dirname(__FILE__),"..", generator_path))
44
+ ]
45
+ end
46
+
47
+ def generator_path
48
+ "gigantron_generators"
49
+ end
50
+ end
@@ -1,49 +1,49 @@
1
- require File.join(File.dirname(__FILE__), "test_generator_helper.rb")
2
-
3
-
4
- class TestMigrationGenerator < 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 = "CreateFoo"
31
- run_generator('migration', [name], sources)
32
- assert_directory_exists "db/"
33
- assert_directory_exists "db/migrate/"
34
- assert_generated_file "db/migrate/001_create_foo.rb"
35
- name2 = "AlterFoo"
36
- run_generator('migration', [name2], sources)
37
- assert_generated_file "db/migrate/002_alter_foo.rb"
38
- end
39
-
40
- private
41
- def sources
42
- [RubiGen::PathSource.new(:test, File.join(File.dirname(__FILE__),"..", generator_path))
43
- ]
44
- end
45
-
46
- def generator_path
47
- "gigantron_generators"
48
- end
49
- end
1
+ require File.join(File.dirname(__FILE__), "test_generator_helper.rb")
2
+
3
+
4
+ class TestMigrationGenerator < 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 = "CreateFoo"
31
+ run_generator('migration', [name], sources)
32
+ assert_directory_exists "db/"
33
+ assert_directory_exists "db/migrate/"
34
+ assert_generated_file "db/migrate/001_create_foo.rb"
35
+ name2 = "AlterFoo"
36
+ run_generator('migration', [name2], sources)
37
+ assert_generated_file "db/migrate/002_alter_foo.rb"
38
+ end
39
+
40
+ private
41
+ def sources
42
+ [RubiGen::PathSource.new(:test, File.join(File.dirname(__FILE__),"..", generator_path))
43
+ ]
44
+ end
45
+
46
+ def generator_path
47
+ "gigantron_generators"
48
+ end
49
+ end
@@ -1,53 +1,53 @@
1
- require File.join(File.dirname(__FILE__), "test_generator_helper.rb")
2
-
3
-
4
- class TestModelGenerator < 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 = "FooBaz"
31
- run_generator('model', [name], sources)
32
- assert_directory_exists "models/"
33
- assert_generated_file "models/foo_baz.rb"
34
- assert_directory_exists "test/"
35
- assert_directory_exists "test/models/"
36
- assert_generated_file "test/models/test_foo_baz.rb"
37
-
38
- #check migration
39
- assert_directory_exists "db/"
40
- assert_directory_exists "db/migrate/"
41
- assert_generated_file "db/migrate/001_create_foo_bazs.rb"
42
- end
43
-
44
- private
45
- def sources
46
- [RubiGen::PathSource.new(:test, File.join(File.dirname(__FILE__),"..", generator_path))
47
- ]
48
- end
49
-
50
- def generator_path
51
- "gigantron_generators"
52
- end
53
- end
1
+ require File.join(File.dirname(__FILE__), "test_generator_helper.rb")
2
+
3
+
4
+ class TestModelGenerator < 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 = "FooBaz"
31
+ run_generator('model', [name], sources)
32
+ assert_directory_exists "models/"
33
+ assert_generated_file "models/foo_baz.rb"
34
+ assert_directory_exists "test/"
35
+ assert_directory_exists "test/models/"
36
+ assert_generated_file "test/models/test_foo_baz.rb"
37
+
38
+ #check migration
39
+ assert_directory_exists "db/"
40
+ assert_directory_exists "db/migrate/"
41
+ assert_generated_file "db/migrate/001_create_foo_bazs.rb"
42
+ end
43
+
44
+ private
45
+ def sources
46
+ [RubiGen::PathSource.new(:test, File.join(File.dirname(__FILE__),"..", generator_path))
47
+ ]
48
+ end
49
+
50
+ def generator_path
51
+ "gigantron_generators"
52
+ end
53
+ end