2009-07-13 17:01:12 -04:00
|
|
|
require 'generators/generators_test_helper'
|
2010-03-23 08:40:19 -04:00
|
|
|
require 'rails/generators/rails/generator/generator_generator'
|
2009-07-13 17:01:12 -04:00
|
|
|
|
2010-01-18 18:07:11 -05:00
|
|
|
class GeneratorGeneratorTest < Rails::Generators::TestCase
|
|
|
|
include GeneratorsTestHelper
|
2010-01-03 10:34:32 -05:00
|
|
|
arguments %w(awesome)
|
2009-07-13 17:01:12 -04:00
|
|
|
|
|
|
|
def test_generator_skeleton_is_created
|
|
|
|
run_generator
|
|
|
|
|
|
|
|
%w(
|
|
|
|
lib/generators/awesome
|
|
|
|
lib/generators/awesome/USAGE
|
|
|
|
lib/generators/awesome/templates
|
|
|
|
).each{ |path| assert_file path }
|
|
|
|
|
|
|
|
assert_file "lib/generators/awesome/awesome_generator.rb",
|
|
|
|
/class AwesomeGenerator < Rails::Generators::NamedBase/
|
|
|
|
end
|
2010-12-10 08:42:10 -05:00
|
|
|
|
|
|
|
def test_namespaced_generator_skeleton
|
|
|
|
run_generator ["rails/awesome"]
|
|
|
|
|
|
|
|
%w(
|
|
|
|
lib/generators/rails/awesome
|
|
|
|
lib/generators/rails/awesome/USAGE
|
|
|
|
lib/generators/rails/awesome/templates
|
|
|
|
).each{ |path| assert_file path }
|
|
|
|
|
|
|
|
assert_file "lib/generators/rails/awesome/awesome_generator.rb",
|
|
|
|
/class Rails::AwesomeGenerator < Rails::Generators::NamedBase/
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_generator_skeleton_is_created_without_file_name_namespace
|
|
|
|
run_generator ["awesome", "--namespace", "false"]
|
|
|
|
|
|
|
|
%w(
|
|
|
|
lib/generators/
|
|
|
|
lib/generators/USAGE
|
|
|
|
lib/generators/templates
|
|
|
|
).each{ |path| assert_file path }
|
|
|
|
|
|
|
|
assert_file "lib/generators/awesome_generator.rb",
|
|
|
|
/class AwesomeGenerator < Rails::Generators::NamedBase/
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_namespaced_generator_skeleton_without_file_name_namespace
|
|
|
|
run_generator ["rails/awesome", "--namespace", "false"]
|
|
|
|
|
|
|
|
%w(
|
|
|
|
lib/generators/rails
|
|
|
|
lib/generators/rails/USAGE
|
|
|
|
lib/generators/rails/templates
|
|
|
|
).each{ |path| assert_file path }
|
|
|
|
|
|
|
|
assert_file "lib/generators/rails/awesome_generator.rb",
|
|
|
|
/class Rails::AwesomeGenerator < Rails::Generators::NamedBase/
|
|
|
|
end
|
2009-07-13 17:01:12 -04:00
|
|
|
end
|