blob: f4c975fc1832faf9406820a438bd033e98423bf7 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
require 'generators/generators_test_helper'
require 'rails/generators/rails/generator/generator_generator'
class GeneratorGeneratorTest < Rails::Generators::TestCase
include GeneratorsTestHelper
arguments %w(awesome)
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
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
end
|