padrino-gen 0.12.0 → 0.12.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.rdoc +1 -1
- data/lib/padrino-gen.rb +0 -1
- data/lib/padrino-gen/generators/app.rb +22 -14
- data/lib/padrino-gen/generators/app/app.rb.tt +0 -1
- data/lib/padrino-gen/generators/cli.rb +1 -2
- data/lib/padrino-gen/generators/components/actions.rb +1 -1
- data/lib/padrino-gen/generators/components/mocks/rr.rb +2 -2
- data/lib/padrino-gen/generators/components/orms/activerecord.rb +3 -0
- data/lib/padrino-gen/generators/components/orms/datamapper.rb +21 -0
- data/lib/padrino-gen/generators/components/orms/dynamoid.rb +67 -0
- data/lib/padrino-gen/generators/components/orms/minirecord.rb +3 -0
- data/lib/padrino-gen/generators/components/tests/cucumber.rb +1 -1
- data/lib/padrino-gen/generators/components/tests/minitest.rb +1 -1
- data/lib/padrino-gen/generators/components/tests/rspec.rb +4 -4
- data/lib/padrino-gen/generators/model.rb +73 -29
- data/lib/padrino-gen/generators/project.rb +7 -3
- data/lib/padrino-gen/generators/project/config/apps.rb.tt +0 -1
- data/lib/padrino-gen/generators/templates/Gemfile.tt +1 -1
- data/lib/padrino-gen/padrino-tasks/activerecord.rb +43 -39
- data/lib/padrino-gen/padrino-tasks/database.rb +2 -1
- data/lib/padrino-gen/padrino-tasks/sql-helpers.rb +24 -16
- data/test/helper.rb +4 -3
- data/test/test_app_generator.rb +13 -13
- data/test/test_cli.rb +4 -4
- data/test/test_component_generator.rb +18 -18
- data/test/test_controller_generator.rb +26 -26
- data/test/test_generator.rb +2 -3
- data/test/test_mailer_generator.rb +10 -10
- data/test/test_migration_generator.rb +42 -27
- data/test/test_model_generator.rb +95 -74
- data/test/test_plugin_generator.rb +23 -23
- data/test/test_project_generator.rb +100 -83
- data/test/test_task_generator.rb +7 -7
- metadata +9 -8
@@ -2,7 +2,7 @@ require File.expand_path(File.dirname(__FILE__) + '/helper')
|
|
2
2
|
|
3
3
|
describe "PluginGenerator" do
|
4
4
|
def setup
|
5
|
-
@apptmp = "#{Dir.tmpdir}/padrino-tests/#{
|
5
|
+
@apptmp = "#{Dir.tmpdir}/padrino-tests/#{SecureRandom.hex}"
|
6
6
|
`mkdir -p #{@apptmp}`
|
7
7
|
end
|
8
8
|
|
@@ -10,8 +10,8 @@ describe "PluginGenerator" do
|
|
10
10
|
`rm -rf #{@apptmp}`
|
11
11
|
end
|
12
12
|
|
13
|
-
|
14
|
-
should
|
13
|
+
describe "the plugin generator" do
|
14
|
+
it 'should respect --root option' do
|
15
15
|
path = File.expand_path('../fixtures/plugin_template.rb', __FILE__)
|
16
16
|
capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}") }
|
17
17
|
out, err = capture_io { generate(:plugin, path, "--root=#{@apptmp}/sample_project") }
|
@@ -19,8 +19,8 @@ describe "PluginGenerator" do
|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
-
|
23
|
-
should
|
22
|
+
describe "the plugin destroy option" do
|
23
|
+
it 'should remove the plugin instance' do
|
24
24
|
path = File.expand_path('../fixtures/plugin_template.rb', __FILE__)
|
25
25
|
capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}") }
|
26
26
|
capture_io { generate(:plugin, path, "--root=#{@apptmp}/sample_project") }
|
@@ -31,8 +31,8 @@ describe "PluginGenerator" do
|
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
|
-
|
35
|
-
should
|
34
|
+
describe 'the project generator with template' do
|
35
|
+
it 'should invoke Padrino.bin_gen' do
|
36
36
|
expects_generated_project :name => 'sample_project', :test => :shoulda, :orm => :activerecord, :dev => true, :template => 'mongochist', :root => @apptmp
|
37
37
|
expects_generated :model, "post title:string body:text -r=#{@apptmp}/sample_project"
|
38
38
|
expects_generated :controller, "posts get:index get:new post:new -r=#{@apptmp}/sample_project"
|
@@ -48,16 +48,16 @@ describe "PluginGenerator" do
|
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
51
|
-
|
51
|
+
describe "with resolving urls" do
|
52
52
|
|
53
|
-
should
|
53
|
+
it 'should resolve generic url properly' do
|
54
54
|
template_file = 'http://www.example.com/test.rb'
|
55
55
|
project_gen = Padrino::Generators::Project.new(['sample_project'], ["-p=#{template_file}", "-r=#{@apptmp}"], {})
|
56
56
|
project_gen.expects(:apply).with(template_file).returns(true).once
|
57
57
|
capture_io { project_gen.invoke_all }
|
58
58
|
end
|
59
59
|
|
60
|
-
should
|
60
|
+
it 'should resolve gist url properly' do
|
61
61
|
FakeWeb.register_uri(:get, "https://gist.github.com/357045", :body => '<a href="/raw/357045/4356/blog_template.rb">raw</a>')
|
62
62
|
template_file = 'https://gist.github.com/357045'
|
63
63
|
resolved_path = 'https://gist.github.com/raw/357045/4356/blog_template.rb'
|
@@ -66,7 +66,7 @@ describe "PluginGenerator" do
|
|
66
66
|
capture_io { project_gen.invoke_all }
|
67
67
|
end
|
68
68
|
|
69
|
-
should
|
69
|
+
it 'should resolve official template' do
|
70
70
|
template_file = 'sampleblog'
|
71
71
|
resolved_path = "https://raw.github.com/padrino/padrino-recipes/master/templates/sampleblog_template.rb"
|
72
72
|
project_gen = Padrino::Generators::Project.new(['sample_project'], ["-p=#{template_file}", "-r=#{@apptmp}"], {})
|
@@ -74,14 +74,14 @@ describe "PluginGenerator" do
|
|
74
74
|
capture_io { project_gen.invoke_all }
|
75
75
|
end
|
76
76
|
|
77
|
-
should
|
77
|
+
it 'should resolve local file' do
|
78
78
|
template_file = 'path/to/local/file.rb'
|
79
79
|
project_gen = Padrino::Generators::Project.new(['sample_project'], ["-p=#{template_file}", "-r=#{@apptmp}"], {})
|
80
80
|
project_gen.expects(:apply).with(File.expand_path(template_file)).returns(true).once
|
81
81
|
capture_io { project_gen.invoke_all }
|
82
82
|
end
|
83
83
|
|
84
|
-
should
|
84
|
+
it 'should resolve official plugin' do
|
85
85
|
template_file = 'hoptoad'
|
86
86
|
resolved_path = "https://raw.github.com/padrino/padrino-recipes/master/plugins/hoptoad_plugin.rb"
|
87
87
|
plugin_gen = Padrino::Generators::Plugin.new([ template_file], ["-r=#{@apptmp}/sample_project"],{})
|
@@ -90,7 +90,7 @@ describe "PluginGenerator" do
|
|
90
90
|
capture_io { plugin_gen.invoke_all }
|
91
91
|
end
|
92
92
|
|
93
|
-
should
|
93
|
+
it 'should print a warning if template cannot be found' do
|
94
94
|
template_file = 'hwat'
|
95
95
|
resolved_path = "https://raw.github.com/padrino/padrino-recipes/master/plugins/hwat_plugin.rb"
|
96
96
|
plugin_gen = Padrino::Generators::Plugin.new([ template_file], ["-r=#{@apptmp}/sample_project"],{})
|
@@ -100,22 +100,22 @@ describe "PluginGenerator" do
|
|
100
100
|
end
|
101
101
|
end
|
102
102
|
|
103
|
-
|
104
|
-
should
|
103
|
+
describe "with list option" do
|
104
|
+
it 'should return a list of available plugins with no parameter' do
|
105
105
|
plugin_gen = Padrino::Generators::Plugin.new([], [],{})
|
106
106
|
plugin_gen.expects(:list_plugins).returns(true).once
|
107
107
|
capture_io { plugin_gen.invoke_all }
|
108
108
|
end
|
109
109
|
|
110
|
-
should
|
110
|
+
it 'should return a list of available plugins with list option' do
|
111
111
|
plugin_gen = Padrino::Generators::Plugin.new(['some_plugin'], ["-l", "-r=#{@apptmp}/sample_project"],{})
|
112
112
|
plugin_gen.expects(:list_plugins).returns(true).once
|
113
113
|
capture_io { plugin_gen.invoke_all }
|
114
114
|
end
|
115
115
|
end
|
116
116
|
|
117
|
-
|
118
|
-
should
|
117
|
+
describe "with git commands" do
|
118
|
+
it 'should generate a repository correctly' do
|
119
119
|
skip 'Change stubs here'
|
120
120
|
expects_generated_project :test => :rspec, :orm => :activerecord, :name => 'sample_git', :root => "#{@apptmp}"
|
121
121
|
expects_git :init, :root => "#{@apptmp}/sample_git"
|
@@ -126,8 +126,8 @@ describe "PluginGenerator" do
|
|
126
126
|
end
|
127
127
|
end
|
128
128
|
|
129
|
-
|
130
|
-
should
|
129
|
+
describe "with rake invocations" do
|
130
|
+
it 'should Run rake task and list tasks' do
|
131
131
|
expects_generated_project :test => :shoulda, :orm => :activerecord, :name => 'sample_rake', :root => "#{@apptmp}"
|
132
132
|
expects_rake "custom", :root => "#{@apptmp}/sample_rake"
|
133
133
|
rake_template_path = File.join(File.dirname(__FILE__), 'fixtures', 'rake_template.rb')
|
@@ -135,8 +135,8 @@ describe "PluginGenerator" do
|
|
135
135
|
end
|
136
136
|
end
|
137
137
|
|
138
|
-
|
139
|
-
should
|
138
|
+
describe "with admin commands" do
|
139
|
+
it 'should generate correctly an admin' do
|
140
140
|
expects_generated_project :test => :shoulda, :orm => :activerecord, :name => 'sample_admin', :root => "#{@apptmp}"
|
141
141
|
expects_generated :model, "post title:string body:text -r=#{@apptmp}/sample_admin"
|
142
142
|
expects_rake "ar:create", :root => "#{@apptmp}/sample_admin"
|
@@ -2,7 +2,7 @@ require File.expand_path(File.dirname(__FILE__) + '/helper')
|
|
2
2
|
|
3
3
|
describe "ProjectGenerator" do
|
4
4
|
def setup
|
5
|
-
@apptmp = "#{Dir.tmpdir}/padrino-tests/#{
|
5
|
+
@apptmp = "#{Dir.tmpdir}/padrino-tests/#{SecureRandom.hex}"
|
6
6
|
`mkdir -p #{@apptmp}`
|
7
7
|
end
|
8
8
|
|
@@ -11,8 +11,8 @@ describe "ProjectGenerator" do
|
|
11
11
|
`rm -rf /tmp/project`
|
12
12
|
end
|
13
13
|
|
14
|
-
|
15
|
-
should
|
14
|
+
describe 'the project generator' do
|
15
|
+
it 'should allow simple generator to run and create base_app with no options' do
|
16
16
|
capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}") }
|
17
17
|
assert_file_exists("#{@apptmp}/sample_project")
|
18
18
|
assert_match_in_file(/module SampleProject/,"#{@apptmp}/sample_project/app/app.rb")
|
@@ -28,7 +28,7 @@ describe "ProjectGenerator" do
|
|
28
28
|
assert_dir_exists("#{@apptmp}/sample_project/app/views/layouts")
|
29
29
|
end
|
30
30
|
|
31
|
-
should
|
31
|
+
it 'should generate a valid name' do
|
32
32
|
capture_io { generate(:project, 'project.com', "--root=#{@apptmp}") }
|
33
33
|
assert_file_exists("#{@apptmp}/project.com")
|
34
34
|
assert_match_in_file(/module ProjectCom/, "#{@apptmp}/project.com/app/app.rb")
|
@@ -41,7 +41,7 @@ describe "ProjectGenerator" do
|
|
41
41
|
assert_match_in_file("Padrino.mount('ProjectCom::WsDci2011', :app_file => Padrino.root('ws_dci_2011/app.rb')).to('/ws_dci_2011')", "#{@apptmp}/project.com/config/apps.rb")
|
42
42
|
end
|
43
43
|
|
44
|
-
should
|
44
|
+
it 'should generate nested path with dashes in name' do
|
45
45
|
capture_io { generate(:project, 'sample-project', "--root=#{@apptmp}") }
|
46
46
|
assert_file_exists("#{@apptmp}/sample-project")
|
47
47
|
assert_match_in_file(/module SampleProject/, "#{@apptmp}/sample-project/app/app.rb")
|
@@ -54,18 +54,18 @@ describe "ProjectGenerator" do
|
|
54
54
|
assert_match_in_file("Padrino.mount('SampleProject::WsDci2011', :app_file => Padrino.root('ws_dci_2011/app.rb')).to('/ws_dci_2011')", "#{@apptmp}/sample-project/config/apps.rb")
|
55
55
|
end
|
56
56
|
|
57
|
-
should
|
57
|
+
it 'should raise an Error when given invalid constant names' do
|
58
58
|
assert_raises(::NameError) { capture_io { generate(:project, "123asdf", "--root=#{@apptmp}") } }
|
59
59
|
assert_raises(::NameError) { capture_io { generate(:project, "./sample_project", "--root=#{@apptmp}") } }
|
60
60
|
end
|
61
61
|
|
62
|
-
should
|
62
|
+
it 'should display the right path' do
|
63
63
|
out, err = capture_io { generate(:project, 'project', "--root=/tmp") }
|
64
64
|
assert_file_exists("/tmp/project")
|
65
65
|
assert_match(/cd \/tmp\/project/, out)
|
66
66
|
end
|
67
67
|
|
68
|
-
should
|
68
|
+
it 'should allow specifying alternate application name' do
|
69
69
|
capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--app=base_app') }
|
70
70
|
assert_file_exists("#{@apptmp}/sample_project")
|
71
71
|
assert_match_in_file(/module SampleProject/,"#{@apptmp}/sample_project/app/app.rb")
|
@@ -75,18 +75,26 @@ describe "ProjectGenerator" do
|
|
75
75
|
assert_file_exists("#{@apptmp}/sample_project/public/favicon.ico")
|
76
76
|
end
|
77
77
|
|
78
|
-
should
|
78
|
+
it 'should add database tasks to Rakefile if an ORM is defined' do
|
79
79
|
capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--app=base_app', '--orm=activerecord') }
|
80
80
|
assert_match_in_file('PadrinoTasks.use(:database)',"#{@apptmp}/sample_project/Rakefile")
|
81
81
|
end
|
82
82
|
|
83
|
-
should
|
83
|
+
it 'should avoid add database tasks on Rakefile if no ORM is specified' do
|
84
84
|
capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--app=base_app') }
|
85
85
|
assert_no_match_in_file('PadrinoTasks.use(:database)',"#{@apptmp}/sample_project/Rakefile")
|
86
86
|
end
|
87
87
|
|
88
|
-
should
|
89
|
-
capture_io { generate(:project,'sample_project', '--
|
88
|
+
it 'should generate lean project' do
|
89
|
+
capture_io { generate(:project,'sample_project', '--lean', "--root=#{@apptmp}") }
|
90
|
+
assert_file_exists("#{@apptmp}/sample_project/public/favicon.ico")
|
91
|
+
assert_file_exists("#{@apptmp}/sample_project/config/boot.rb")
|
92
|
+
assert_no_file_exists("#{@apptmp}/sample_project/app/app.rb")
|
93
|
+
assert_no_match_in_file(/Padrino.mount\('SampleProject::App'/, "#{@apptmp}/sample_project/config/apps.rb")
|
94
|
+
end
|
95
|
+
|
96
|
+
it 'should generate tiny skeleton' do
|
97
|
+
capture_io { generate(:project,'sample_project', '--tiny', "--root=#{@apptmp}") }
|
90
98
|
assert_file_exists("#{@apptmp}/sample_project")
|
91
99
|
assert_file_exists("#{@apptmp}/sample_project/app")
|
92
100
|
assert_file_exists("#{@apptmp}/sample_project/app/controllers.rb")
|
@@ -100,7 +108,7 @@ describe "ProjectGenerator" do
|
|
100
108
|
assert_no_file_exists("#{@apptmp}/sample_project/demo/controllers")
|
101
109
|
end
|
102
110
|
|
103
|
-
should
|
111
|
+
it 'should generate gemspec and special files if gem is expected' do
|
104
112
|
capture_io { generate(:project,'sample_gem', '--gem', "--root=#{@apptmp}") }
|
105
113
|
assert_file_exists("#{@apptmp}/sample_gem/sample_gem.gemspec")
|
106
114
|
assert_match_in_file(/^gemspec/,"#{@apptmp}/sample_gem/Gemfile")
|
@@ -109,7 +117,7 @@ describe "ProjectGenerator" do
|
|
109
117
|
assert_file_exists("#{@apptmp}/sample_gem/README.md")
|
110
118
|
end
|
111
119
|
|
112
|
-
should
|
120
|
+
it 'should generate gemspec and special files with dashes in name' do
|
113
121
|
capture_io { generate(:project,'sample-gem', '--gem', "--root=#{@apptmp}") }
|
114
122
|
assert_file_exists("#{@apptmp}/sample-gem/sample-gem.gemspec")
|
115
123
|
assert_file_exists("#{@apptmp}/sample-gem/README.md")
|
@@ -125,29 +133,29 @@ describe "ProjectGenerator" do
|
|
125
133
|
assert_match_in_file(/class App/,"#{@apptmp}/sample-gem/app/app.rb")
|
126
134
|
end
|
127
135
|
|
128
|
-
should
|
136
|
+
it 'should not create models folder if no orm is chosen' do
|
129
137
|
capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--script=none', '--orm=none') }
|
130
138
|
assert_no_dir_exists("#{@apptmp}/sample_project/models")
|
131
139
|
end
|
132
140
|
|
133
|
-
should
|
141
|
+
it 'should not create tests folder if no test framework is chosen' do
|
134
142
|
capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--script=none', '--test=none') }
|
135
143
|
assert_no_dir_exists("#{@apptmp}/sample_project/test")
|
136
144
|
end
|
137
145
|
|
138
|
-
should
|
146
|
+
it 'should place app specific names into correct files' do
|
139
147
|
capture_io { generate(:project, 'warepedia', "--root=#{@apptmp}", '--script=none') }
|
140
148
|
assert_match_in_file(/module Warepedia/m, "#{@apptmp}/warepedia/app/app.rb")
|
141
149
|
assert_match_in_file(/class App < Padrino::Application/m, "#{@apptmp}/warepedia/app/app.rb")
|
142
150
|
assert_match_in_file("Padrino.mount('Warepedia::App', :app_file => Padrino.root('app/app.rb')).to('/')", "#{@apptmp}/warepedia/config/apps.rb")
|
143
151
|
end
|
144
152
|
|
145
|
-
should
|
153
|
+
it 'should store and apply session_secret' do
|
146
154
|
capture_io { generate(:project,'sample_project', '--tiny',"--root=#{@apptmp}") }
|
147
155
|
assert_match_in_file(/set :session_secret, '[0-9A-z]*'/, "#{@apptmp}/sample_project/config/apps.rb")
|
148
156
|
end
|
149
157
|
|
150
|
-
should
|
158
|
+
it 'should create components file containing options chosen with defaults' do
|
151
159
|
capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}") }
|
152
160
|
components_chosen = YAML.load_file("#{@apptmp}/sample_project/.components")
|
153
161
|
assert_equal 'none', components_chosen[:orm]
|
@@ -157,7 +165,7 @@ describe "ProjectGenerator" do
|
|
157
165
|
assert_equal 'slim', components_chosen[:renderer]
|
158
166
|
end
|
159
167
|
|
160
|
-
should
|
168
|
+
it 'should create components file containing options chosen' do
|
161
169
|
component_options = ['--orm=datamapper', '--test=riot', '--mock=mocha', '--script=prototype', '--renderer=erb', '--stylesheet=less']
|
162
170
|
capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", *component_options) }
|
163
171
|
components_chosen = YAML.load_file("#{@apptmp}/sample_project/.components")
|
@@ -169,7 +177,7 @@ describe "ProjectGenerator" do
|
|
169
177
|
assert_equal 'less', components_chosen[:stylesheet]
|
170
178
|
end
|
171
179
|
|
172
|
-
should
|
180
|
+
it 'should output to log components being applied' do
|
173
181
|
component_options = ['--orm=datamapper', '--test=riot', '--mock=mocha', '--script=prototype', '--renderer=erb','--stylesheet=less']
|
174
182
|
out, err = capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", *component_options) }
|
175
183
|
assert_match(/applying.*?datamapper.*?orm/, out)
|
@@ -180,49 +188,49 @@ describe "ProjectGenerator" do
|
|
180
188
|
assert_match(/applying.*?less.*?stylesheet/, out)
|
181
189
|
end
|
182
190
|
|
183
|
-
should
|
191
|
+
it 'should output gem files for base app' do
|
184
192
|
capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--script=none') }
|
185
193
|
assert_match_in_file(/gem 'padrino'/, "#{@apptmp}/sample_project/Gemfile")
|
186
194
|
end
|
187
195
|
end
|
188
196
|
|
189
|
-
|
190
|
-
should
|
197
|
+
describe "a generator for mock component" do
|
198
|
+
it 'should properly generate for rr and riot' do
|
191
199
|
out, err = capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--mock=rr', '--test=riot', '--script=none') }
|
192
200
|
assert_match(/applying.*?rr.*?mock/, out)
|
193
201
|
assert_match_in_file(/gem 'rr'/, "#{@apptmp}/sample_project/Gemfile")
|
194
202
|
assert_match_in_file(/require 'riot\/rr'/, "#{@apptmp}/sample_project/test/test_config.rb")
|
195
203
|
end
|
196
204
|
|
197
|
-
should
|
205
|
+
it 'should properly generate for rr and minitest' do
|
198
206
|
out, err = capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--mock=rr', '--test=minitest', '--script=none') }
|
199
207
|
assert_match(/applying.*?rr.*?mock/, out)
|
200
208
|
assert_match_in_file(/gem 'rr'/, "#{@apptmp}/sample_project/Gemfile")
|
201
209
|
assert_match_in_file(/include RR::Adapters::MiniTest/, "#{@apptmp}/sample_project/test/test_config.rb")
|
202
210
|
end
|
203
211
|
|
204
|
-
should
|
212
|
+
it 'should properly generater for rr and bacon' do
|
205
213
|
out, err = capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--mock=rr', '--test=bacon', '--script=none') }
|
206
214
|
assert_match(/applying.*?rr.*?mock/, out)
|
207
215
|
assert_match_in_file(/gem 'rr'/, "#{@apptmp}/sample_project/Gemfile")
|
208
216
|
assert_match_in_file(/include RR::Adapters::TestUnit/m, "#{@apptmp}/sample_project/test/test_config.rb")
|
209
217
|
end
|
210
218
|
|
211
|
-
should
|
219
|
+
it 'should properly generate for rr and rspec' do
|
212
220
|
out, err = capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--test=rspec', '--mock=rr', '--script=none') }
|
213
221
|
assert_match(/applying.*?rr.*?mock/, out)
|
214
|
-
assert_match_in_file(/gem 'rr'/, "#{@apptmp}/sample_project/Gemfile")
|
215
|
-
assert_match_in_file(/
|
222
|
+
assert_match_in_file(/gem 'rr', :require => false/, "#{@apptmp}/sample_project/Gemfile")
|
223
|
+
assert_match_in_file(/require 'rr'/m, "#{@apptmp}/sample_project/spec/spec_helper.rb")
|
216
224
|
end
|
217
225
|
|
218
|
-
should
|
226
|
+
it 'should properly generate for mocha and rspec' do
|
219
227
|
out, err = capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}",'--test=rspec', '--mock=mocha', '--script=none') }
|
220
228
|
assert_match(/applying.*?mocha.*?mock/, out)
|
221
229
|
assert_match_in_file(/gem 'mocha'/, "#{@apptmp}/sample_project/Gemfile")
|
222
230
|
assert_match_in_file(/conf.mock_with :mocha/m, "#{@apptmp}/sample_project/spec/spec_helper.rb")
|
223
231
|
end
|
224
232
|
|
225
|
-
should
|
233
|
+
it 'should properly generate for mocha and riot' do
|
226
234
|
out, err = capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--test=riot', '--mock=mocha', '--script=none') }
|
227
235
|
assert_match(/applying.*?mocha.*?mock/, out)
|
228
236
|
assert_match_in_file(/gem 'mocha'.*require => false/, "#{@apptmp}/sample_project/Gemfile")
|
@@ -230,10 +238,10 @@ describe "ProjectGenerator" do
|
|
230
238
|
end
|
231
239
|
end
|
232
240
|
|
233
|
-
|
241
|
+
describe "the generator for orm components" do
|
234
242
|
|
235
|
-
|
236
|
-
should
|
243
|
+
describe "for sequel" do
|
244
|
+
it 'should properly generate default' do
|
237
245
|
@app.instance_eval("undef setup_orm if respond_to?('setup_orm')")
|
238
246
|
out, err = capture_io { generate(:project, 'project.com', "--root=#{@apptmp}", '--orm=sequel', '--script=none') }
|
239
247
|
assert_match(/applying.*?sequel.*?orm/, out)
|
@@ -244,35 +252,35 @@ describe "ProjectGenerator" do
|
|
244
252
|
assert_match_in_file(%r{project_com}, "#{@apptmp}/project.com/config/database.rb")
|
245
253
|
end
|
246
254
|
|
247
|
-
should
|
255
|
+
it 'should properly generate mysql (default to mysql2)' do
|
248
256
|
out, err = capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--orm=sequel', '--adapter=mysql') }
|
249
257
|
assert_match_in_file(/gem 'mysql2'/, "#{@apptmp}/sample_project/Gemfile")
|
250
258
|
assert_match_in_file(%r{"mysql2://}, "#{@apptmp}/sample_project/config/database.rb")
|
251
259
|
assert_match_in_file(/sample_project_development/, "#{@apptmp}/sample_project/config/database.rb")
|
252
260
|
end
|
253
261
|
|
254
|
-
should
|
262
|
+
it 'should properly generate mysql2' do
|
255
263
|
out, err = capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--orm=sequel', '--adapter=mysql2') }
|
256
264
|
assert_match_in_file(/gem 'mysql2'/, "#{@apptmp}/sample_project/Gemfile")
|
257
265
|
assert_match_in_file(%r{"mysql2://}, "#{@apptmp}/sample_project/config/database.rb")
|
258
266
|
assert_match_in_file(/sample_project_development/, "#{@apptmp}/sample_project/config/database.rb")
|
259
267
|
end
|
260
268
|
|
261
|
-
should
|
269
|
+
it 'should properly generate mysql-gem' do
|
262
270
|
out, err = capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--orm=sequel', '--adapter=mysql-gem') }
|
263
271
|
assert_match_in_file(/gem 'mysql'/, "#{@apptmp}/sample_project/Gemfile")
|
264
272
|
assert_match_in_file(%r{"mysql://}, "#{@apptmp}/sample_project/config/database.rb")
|
265
273
|
assert_match_in_file(/sample_project_development/, "#{@apptmp}/sample_project/config/database.rb")
|
266
274
|
end
|
267
275
|
|
268
|
-
should
|
276
|
+
it 'should properly generate sqlite3' do
|
269
277
|
out, err = capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--orm=sequel', '--adapter=sqlite') }
|
270
278
|
assert_match_in_file(/gem 'sqlite3'/, "#{@apptmp}/sample_project/Gemfile")
|
271
279
|
assert_match_in_file(%r{sqlite://}, "#{@apptmp}/sample_project/config/database.rb")
|
272
280
|
assert_match_in_file(/sample_project_development/, "#{@apptmp}/sample_project/config/database.rb")
|
273
281
|
end
|
274
282
|
|
275
|
-
should
|
283
|
+
it 'should properly generate postgres' do
|
276
284
|
out, err = capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--orm=sequel', '--adapter=postgres') }
|
277
285
|
assert_match_in_file(/gem 'pg'/, "#{@apptmp}/sample_project/Gemfile")
|
278
286
|
assert_match_in_file(%r{"postgres://}, "#{@apptmp}/sample_project/config/database.rb")
|
@@ -280,8 +288,8 @@ describe "ProjectGenerator" do
|
|
280
288
|
end
|
281
289
|
end
|
282
290
|
|
283
|
-
|
284
|
-
should
|
291
|
+
describe "for activerecord" do
|
292
|
+
it 'should properly generate default' do
|
285
293
|
out, err = capture_io { generate(:project, 'project.com', "--root=#{@apptmp}", '--orm=activerecord', '--script=none') }
|
286
294
|
assert_match(/applying.*?activerecord.*?orm/, out)
|
287
295
|
assert_match_in_file(/gem 'activerecord', '>= 3.1', :require => 'active_record'/, "#{@apptmp}/project.com/Gemfile")
|
@@ -290,35 +298,35 @@ describe "ProjectGenerator" do
|
|
290
298
|
assert_match_in_file(/project_com/, "#{@apptmp}/project.com/config/database.rb")
|
291
299
|
end
|
292
300
|
|
293
|
-
should
|
301
|
+
it 'should properly generate mysql (default to mysql2)' do
|
294
302
|
out, err = capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--orm=activerecord','--adapter=mysql') }
|
295
303
|
assert_match_in_file(/gem 'mysql2'/, "#{@apptmp}/sample_project/Gemfile")
|
296
304
|
assert_match_in_file(/sample_project_development/, "#{@apptmp}/sample_project/config/database.rb")
|
297
305
|
assert_match_in_file(%r{:adapter => 'mysql2'}, "#{@apptmp}/sample_project/config/database.rb")
|
298
306
|
end
|
299
307
|
|
300
|
-
should
|
308
|
+
it 'should properly generate mysql2' do
|
301
309
|
out, err = capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--orm=activerecord','--adapter=mysql2') }
|
302
310
|
assert_match_in_file(/gem 'mysql2'/, "#{@apptmp}/sample_project/Gemfile")
|
303
311
|
assert_match_in_file(/sample_project_development/, "#{@apptmp}/sample_project/config/database.rb")
|
304
312
|
assert_match_in_file(%r{:adapter => 'mysql2'}, "#{@apptmp}/sample_project/config/database.rb")
|
305
313
|
end
|
306
314
|
|
307
|
-
should
|
315
|
+
it 'should properly generate mysql-gem' do
|
308
316
|
out, err = capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--orm=activerecord','--adapter=mysql-gem') }
|
309
317
|
assert_match_in_file(/gem 'mysql', '~> 2.8.1'/, "#{@apptmp}/sample_project/Gemfile")
|
310
318
|
assert_match_in_file(/sample_project_development/, "#{@apptmp}/sample_project/config/database.rb")
|
311
319
|
assert_match_in_file(%r{:adapter => 'mysql'}, "#{@apptmp}/sample_project/config/database.rb")
|
312
320
|
end
|
313
321
|
|
314
|
-
should
|
322
|
+
it 'should properly generate sqlite3' do
|
315
323
|
out, err = capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--orm=activerecord', '--adapter=sqlite3') }
|
316
324
|
assert_match_in_file(/gem 'sqlite3'/, "#{@apptmp}/sample_project/Gemfile")
|
317
325
|
assert_match_in_file(/sample_project_development.db/, "#{@apptmp}/sample_project/config/database.rb")
|
318
326
|
assert_match_in_file(%r{:adapter => 'sqlite3'}, "#{@apptmp}/sample_project/config/database.rb")
|
319
327
|
end
|
320
328
|
|
321
|
-
should
|
329
|
+
it 'should properly generate postgres' do
|
322
330
|
out, err = capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--orm=activerecord', '--adapter=postgres') }
|
323
331
|
assert_match_in_file(/gem 'pg'$/, "#{@apptmp}/sample_project/Gemfile")
|
324
332
|
assert_match_in_file(/sample_project_development/, "#{@apptmp}/sample_project/config/database.rb")
|
@@ -326,8 +334,8 @@ describe "ProjectGenerator" do
|
|
326
334
|
end
|
327
335
|
end
|
328
336
|
|
329
|
-
|
330
|
-
should
|
337
|
+
describe "for datamapper" do
|
338
|
+
it 'should properly generate default' do
|
331
339
|
out, err = capture_io { generate(:project, 'project.com', "--root=#{@apptmp}", '--orm=datamapper', '--script=none') }
|
332
340
|
assert_match(/applying.*?datamapper.*?orm/, out)
|
333
341
|
assert_match_in_file(/gem 'dm-core'/, "#{@apptmp}/project.com/Gemfile")
|
@@ -336,7 +344,7 @@ describe "ProjectGenerator" do
|
|
336
344
|
assert_match_in_file(/project_com/, "#{@apptmp}/project.com/config/database.rb")
|
337
345
|
end
|
338
346
|
|
339
|
-
should
|
347
|
+
it 'should properly generate for mysql' do
|
340
348
|
out, err = capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--orm=datamapper', '--adapter=mysql') }
|
341
349
|
assert_match_in_file(/gem 'dm-mysql-adapter'/, "#{@apptmp}/sample_project/Gemfile")
|
342
350
|
assert_match_in_file(%r{"mysql://}, "#{@apptmp}/sample_project/config/database.rb")
|
@@ -344,20 +352,20 @@ describe "ProjectGenerator" do
|
|
344
352
|
end
|
345
353
|
|
346
354
|
# DataMapper has do_mysql that is the version of MySQL driver.
|
347
|
-
should
|
355
|
+
it 'should properly generate for mysql2' do
|
348
356
|
out, err = capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--orm=datamapper', '--adapter=mysql2') }
|
349
357
|
assert_match_in_file(/gem 'dm-mysql-adapter'/, "#{@apptmp}/sample_project/Gemfile")
|
350
358
|
assert_match_in_file(%r{"mysql://}, "#{@apptmp}/sample_project/config/database.rb")
|
351
359
|
assert_match_in_file(/sample_project_development/, "#{@apptmp}/sample_project/config/database.rb")
|
352
360
|
end
|
353
361
|
|
354
|
-
should
|
362
|
+
it 'should properly generate for sqlite' do
|
355
363
|
out, err = capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--orm=datamapper', '--adapter=sqlite') }
|
356
364
|
assert_match_in_file(/gem 'dm-sqlite-adapter'/, "#{@apptmp}/sample_project/Gemfile")
|
357
365
|
assert_match_in_file(/sample_project_development/, "#{@apptmp}/sample_project/config/database.rb")
|
358
366
|
end
|
359
367
|
|
360
|
-
should
|
368
|
+
it 'should properly generate for postgres' do
|
361
369
|
out, err = capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--orm=datamapper', '--adapter=postgres') }
|
362
370
|
assert_match_in_file(/gem 'dm-postgres-adapter'/, "#{@apptmp}/sample_project/Gemfile")
|
363
371
|
assert_match_in_file(%r{"postgres://}, "#{@apptmp}/sample_project/config/database.rb")
|
@@ -365,7 +373,7 @@ describe "ProjectGenerator" do
|
|
365
373
|
end
|
366
374
|
end
|
367
375
|
|
368
|
-
should
|
376
|
+
it 'should properly generate for mongomapper' do
|
369
377
|
out, err = capture_io { generate(:project, 'project.com', "--root=#{@apptmp}", '--orm=mongomapper', '--script=none') }
|
370
378
|
assert_match(/applying.*?mongomapper.*?orm/, out)
|
371
379
|
assert_match_in_file(/gem 'mongo_mapper'/, "#{@apptmp}/project.com/Gemfile")
|
@@ -374,7 +382,7 @@ describe "ProjectGenerator" do
|
|
374
382
|
assert_match_in_file(/project_com/, "#{@apptmp}/project.com/config/database.rb")
|
375
383
|
end
|
376
384
|
|
377
|
-
should
|
385
|
+
it 'should properly generate for mongoid' do
|
378
386
|
out, err = capture_io { generate(:project, 'project.com', "--root=#{@apptmp}", '--orm=mongoid', '--script=none') }
|
379
387
|
assert_match(/applying.*?mongoid.*?orm/, out)
|
380
388
|
assert_match_in_file(/gem 'mongoid', '~>3.0.0'/, "#{@apptmp}/project.com/Gemfile")
|
@@ -382,7 +390,7 @@ describe "ProjectGenerator" do
|
|
382
390
|
end
|
383
391
|
|
384
392
|
|
385
|
-
should
|
393
|
+
it 'should properly generate for couchrest' do
|
386
394
|
out, err = capture_io { generate(:project, 'project.com', "--root=#{@apptmp}", '--orm=couchrest', '--script=none') }
|
387
395
|
assert_match(/applying.*?couchrest.*?orm/, out)
|
388
396
|
assert_match_in_file(/gem 'couchrest_model'/, "#{@apptmp}/project.com/Gemfile")
|
@@ -390,14 +398,14 @@ describe "ProjectGenerator" do
|
|
390
398
|
assert_match_in_file(/project_com/, "#{@apptmp}/project.com/config/database.rb")
|
391
399
|
end
|
392
400
|
|
393
|
-
should
|
401
|
+
it 'should properly generate for ohm' do
|
394
402
|
out, err = capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--orm=ohm', '--script=none') }
|
395
403
|
assert_match(/applying.*?ohm.*?orm/, out)
|
396
404
|
assert_match_in_file(/gem 'ohm'/, "#{@apptmp}/sample_project/Gemfile")
|
397
405
|
assert_match_in_file(/Ohm.connect/, "#{@apptmp}/sample_project/config/database.rb")
|
398
406
|
end
|
399
407
|
|
400
|
-
should
|
408
|
+
it 'should properly generate for mongomatic' do
|
401
409
|
out, err = capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--orm=mongomatic', '--script=none') }
|
402
410
|
assert_match(/applying.*?mongomatic.*?orm/, out)
|
403
411
|
assert_match_in_file(/gem 'bson_ext'/, "#{@apptmp}/sample_project/Gemfile")
|
@@ -405,44 +413,53 @@ describe "ProjectGenerator" do
|
|
405
413
|
assert_match_in_file(/Mongomatic.db = Mongo::Connection.new.db/, "#{@apptmp}/sample_project/config/database.rb")
|
406
414
|
end
|
407
415
|
|
408
|
-
should
|
416
|
+
it 'should properly generate for ripple' do
|
409
417
|
out, err = capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--orm=ripple', '--script=none') }
|
410
418
|
assert_match(/applying.*?ripple.*?orm/, out)
|
411
419
|
assert_match_in_file(/gem 'ripple'/, "#{@apptmp}/sample_project/Gemfile")
|
412
420
|
assert_match_in_file(/Ripple.load_configuration/, "#{@apptmp}/sample_project/config/database.rb")
|
413
421
|
assert_match_in_file(/http_port: 8098/, "#{@apptmp}/sample_project/config/riak.yml")
|
414
422
|
end
|
423
|
+
|
424
|
+
it 'should properly generate for dynamoid' do
|
425
|
+
out, err = capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--orm=dynamoid', '--script=none') }
|
426
|
+
assert_match(/applying.*?dynamoid.*?orm/, out)
|
427
|
+
assert_match_in_file(/gem 'aws-sdk'/, "#{@apptmp}/sample_project/Gemfile")
|
428
|
+
assert_match_in_file(/gem 'dynamoid', '~>0.7.1'/, "#{@apptmp}/sample_project/Gemfile")
|
429
|
+
assert_match_in_file(/AWS.config/, "#{@apptmp}/sample_project/config/database.rb")
|
430
|
+
assert_match_in_file(/Dynamoid.configure/, "#{@apptmp}/sample_project/config/database.rb")
|
431
|
+
end
|
415
432
|
end
|
416
433
|
|
417
434
|
|
418
|
-
|
419
|
-
should
|
435
|
+
describe "the generator for renderer component" do
|
436
|
+
it 'should properly generate for erb' do
|
420
437
|
out, err = capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--renderer=erb', '--script=none') }
|
421
438
|
assert_match(/applying.*?erb.*?renderer/, out)
|
422
439
|
assert_match_in_file(/gem 'erubis'/, "#{@apptmp}/sample_project/Gemfile")
|
423
440
|
end
|
424
441
|
|
425
|
-
should
|
442
|
+
it 'should properly generate for haml' do
|
426
443
|
out, err = capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--renderer=haml','--script=none') }
|
427
444
|
assert_match(/applying.*?haml.*?renderer/, out)
|
428
445
|
assert_match_in_file(/gem 'haml'/, "#{@apptmp}/sample_project/Gemfile")
|
429
446
|
end
|
430
447
|
|
431
|
-
should
|
448
|
+
it 'should properly generate for liquid' do
|
432
449
|
out, err = capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--renderer=liquid','--script=none') }
|
433
450
|
assert_match(/applying.*?liquid.*?renderer/, out)
|
434
451
|
assert_match_in_file(/gem 'liquid'/, "#{@apptmp}/sample_project/Gemfile")
|
435
452
|
end
|
436
453
|
|
437
|
-
should
|
454
|
+
it 'should properly generate for slim' do
|
438
455
|
out, err = capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--renderer=slim','--script=none') }
|
439
456
|
assert_match(/applying.*?slim.*?renderer/, out)
|
440
457
|
assert_match_in_file(/gem 'slim'/, "#{@apptmp}/sample_project/Gemfile")
|
441
458
|
end
|
442
459
|
end
|
443
460
|
|
444
|
-
|
445
|
-
should
|
461
|
+
describe "the generator for script component" do
|
462
|
+
it 'should properly generate for jquery' do
|
446
463
|
out, err = capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--script=jquery') }
|
447
464
|
assert_match(/applying.*?jquery.*?script/, out)
|
448
465
|
assert_file_exists("#{@apptmp}/sample_project/public/javascripts/jquery.js")
|
@@ -450,7 +467,7 @@ describe "ProjectGenerator" do
|
|
450
467
|
assert_file_exists("#{@apptmp}/sample_project/public/javascripts/application.js")
|
451
468
|
end
|
452
469
|
|
453
|
-
should
|
470
|
+
it 'should properly generate for mootools' do
|
454
471
|
out, err = capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--script=mootools') }
|
455
472
|
assert_match(/applying.*?mootools.*?script/, out)
|
456
473
|
assert_file_exists("#{@apptmp}/sample_project/public/javascripts/mootools.js")
|
@@ -458,7 +475,7 @@ describe "ProjectGenerator" do
|
|
458
475
|
assert_file_exists("#{@apptmp}/sample_project/public/javascripts/application.js")
|
459
476
|
end
|
460
477
|
|
461
|
-
should
|
478
|
+
it 'should properly generate for prototype' do
|
462
479
|
out, err = capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--script=prototype') }
|
463
480
|
assert_match(/applying.*?prototype.*?script/, out)
|
464
481
|
assert_file_exists("#{@apptmp}/sample_project/public/javascripts/protopak.js")
|
@@ -467,7 +484,7 @@ describe "ProjectGenerator" do
|
|
467
484
|
assert_file_exists("#{@apptmp}/sample_project/public/javascripts/application.js")
|
468
485
|
end
|
469
486
|
|
470
|
-
should
|
487
|
+
it 'should properly generate for rightjs' do
|
471
488
|
out, err = capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--script=rightjs') }
|
472
489
|
assert_match(/applying.*?rightjs.*?script/, out)
|
473
490
|
assert_file_exists("#{@apptmp}/sample_project/public/javascripts/right.js")
|
@@ -475,7 +492,7 @@ describe "ProjectGenerator" do
|
|
475
492
|
assert_file_exists("#{@apptmp}/sample_project/public/javascripts/application.js")
|
476
493
|
end
|
477
494
|
|
478
|
-
should
|
495
|
+
it 'should properly generate for ext-core' do
|
479
496
|
out, err = capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--script=extcore') }
|
480
497
|
assert_match(/applying.*?extcore.*?script/, out)
|
481
498
|
assert_file_exists("#{@apptmp}/sample_project/public/javascripts/ext.js")
|
@@ -483,7 +500,7 @@ describe "ProjectGenerator" do
|
|
483
500
|
assert_file_exists("#{@apptmp}/sample_project/public/javascripts/application.js")
|
484
501
|
end
|
485
502
|
|
486
|
-
should
|
503
|
+
it 'should properly generate for dojo' do
|
487
504
|
out, err = capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--script=dojo') }
|
488
505
|
assert_match(/applying.*?dojo.*?script/, out)
|
489
506
|
assert_file_exists("#{@apptmp}/sample_project/public/javascripts/dojo.js")
|
@@ -492,8 +509,8 @@ describe "ProjectGenerator" do
|
|
492
509
|
end
|
493
510
|
end
|
494
511
|
|
495
|
-
|
496
|
-
should
|
512
|
+
describe "the generator for test component" do
|
513
|
+
it 'should properly generate for bacon' do
|
497
514
|
out, err = capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--test=bacon', '--script=none') }
|
498
515
|
assert_match(/applying.*?bacon.*?test/, out)
|
499
516
|
assert_match_in_file(/gem 'rack-test'/, "#{@apptmp}/sample_project/Gemfile")
|
@@ -507,7 +524,7 @@ describe "ProjectGenerator" do
|
|
507
524
|
assert_match_in_file(/task 'test' => test_tasks/,"#{@apptmp}/sample_project/test/test.rake")
|
508
525
|
end
|
509
526
|
|
510
|
-
should
|
527
|
+
it 'should properly generate for riot' do
|
511
528
|
out, err = capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--test=riot', '--script=none') }
|
512
529
|
assert_match(/applying.*?riot.*?test/, out)
|
513
530
|
assert_match_in_file(/gem 'rack-test'/, "#{@apptmp}/sample_project/Gemfile")
|
@@ -524,7 +541,7 @@ describe "ProjectGenerator" do
|
|
524
541
|
assert_match_in_file(/task 'test' => test_tasks/,"#{@apptmp}/sample_project/test/test.rake")
|
525
542
|
end
|
526
543
|
|
527
|
-
should
|
544
|
+
it 'should properly generate for rspec' do
|
528
545
|
out, err = capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--test=rspec', '--script=none') }
|
529
546
|
assert_match(/applying.*?rspec.*?test/, out)
|
530
547
|
assert_match_in_file(/gem 'rack-test'/, "#{@apptmp}/sample_project/Gemfile")
|
@@ -538,7 +555,7 @@ describe "ProjectGenerator" do
|
|
538
555
|
assert_match_in_file(/task 'spec' => spec_tasks/,"#{@apptmp}/sample_project/spec/spec.rake")
|
539
556
|
end
|
540
557
|
|
541
|
-
should
|
558
|
+
it 'should properly generate for shoulda' do
|
542
559
|
out, err = capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--test=shoulda', '--script=none') }
|
543
560
|
assert_match(/applying.*?shoulda.*?test/, out)
|
544
561
|
assert_match_in_file(/gem 'rack-test'/, "#{@apptmp}/sample_project/Gemfile")
|
@@ -552,7 +569,7 @@ describe "ProjectGenerator" do
|
|
552
569
|
assert_match_in_file(/task 'test' => test_tasks/,"#{@apptmp}/sample_project/test/test.rake")
|
553
570
|
end
|
554
571
|
|
555
|
-
should
|
572
|
+
it 'should properly generate for steak' do
|
556
573
|
out, err = capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--test=steak', '--script=none') }
|
557
574
|
assert_match(/applying.*?steak.*?test/, out)
|
558
575
|
assert_match_in_file(/gem 'rack-test'/, "#{@apptmp}/sample_project/Gemfile")
|
@@ -566,7 +583,7 @@ describe "ProjectGenerator" do
|
|
566
583
|
assert_match_in_file(/task 'spec' => spec_tasks/,"#{@apptmp}/sample_project/spec/spec.rake")
|
567
584
|
end
|
568
585
|
|
569
|
-
should
|
586
|
+
it 'should properly generate for minitest' do
|
570
587
|
out, err = capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--test=minitest', '--script=none') }
|
571
588
|
assert_match(/applying.*?minitest.*?test/, out)
|
572
589
|
assert_match_in_file(/gem 'rack-test'/, "#{@apptmp}/sample_project/Gemfile")
|
@@ -582,7 +599,7 @@ describe "ProjectGenerator" do
|
|
582
599
|
assert_match_in_file(/task 'test' => test_tasks/,"#{@apptmp}/sample_project/test/test.rake")
|
583
600
|
end # minitest
|
584
601
|
|
585
|
-
should
|
602
|
+
it 'should properly generate for cucumber' do
|
586
603
|
out, err = capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--test=cucumber', '--script=none') }
|
587
604
|
assert_match(/applying.*?cucumber.*?test/, out)
|
588
605
|
assert_match_in_file(/gem 'rack-test'/, "#{@apptmp}/sample_project/Gemfile")
|
@@ -605,8 +622,8 @@ describe "ProjectGenerator" do
|
|
605
622
|
end
|
606
623
|
end
|
607
624
|
|
608
|
-
|
609
|
-
should
|
625
|
+
describe "the generator for stylesheet component" do
|
626
|
+
it 'should properly generate for sass' do
|
610
627
|
capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--renderer=haml','--script=none','--stylesheet=sass') }
|
611
628
|
assert_match_in_file(/gem 'sass'/, "#{@apptmp}/sample_project/Gemfile")
|
612
629
|
assert_match_in_file(/module SassInitializer.*Sass::Plugin::Rack/m, "#{@apptmp}/sample_project/lib/sass_initializer.rb")
|
@@ -614,7 +631,7 @@ describe "ProjectGenerator" do
|
|
614
631
|
assert_dir_exists("#{@apptmp}/sample_project/app/stylesheets")
|
615
632
|
end
|
616
633
|
|
617
|
-
should
|
634
|
+
it 'should properly generate for less' do
|
618
635
|
capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--renderer=haml','--script=none','--stylesheet=less') }
|
619
636
|
assert_match_in_file(/gem 'rack-less'/, "#{@apptmp}/sample_project/Gemfile")
|
620
637
|
assert_match_in_file(/module LessInitializer.*Rack::Less/m, "#{@apptmp}/sample_project/lib/less_initializer.rb")
|
@@ -622,7 +639,7 @@ describe "ProjectGenerator" do
|
|
622
639
|
assert_dir_exists("#{@apptmp}/sample_project/app/stylesheets")
|
623
640
|
end
|
624
641
|
|
625
|
-
should
|
642
|
+
it 'should properly generate for compass' do
|
626
643
|
capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--renderer=haml','--script=none','--stylesheet=compass') }
|
627
644
|
assert_match_in_file(/gem 'compass'/, "#{@apptmp}/sample_project/Gemfile")
|
628
645
|
assert_match_in_file(/Compass.configure_sass_plugin\!/, "#{@apptmp}/sample_project/lib/compass_plugin.rb")
|
@@ -633,7 +650,7 @@ describe "ProjectGenerator" do
|
|
633
650
|
assert_file_exists("#{@apptmp}/sample_project/app/stylesheets/partials/_base.scss")
|
634
651
|
end
|
635
652
|
|
636
|
-
should
|
653
|
+
it 'should properly generate for scss' do
|
637
654
|
capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '--renderer=haml','--script=none','--stylesheet=scss') }
|
638
655
|
assert_match_in_file(/gem 'haml'/, "#{@apptmp}/sample_project/Gemfile")
|
639
656
|
assert_match_in_file(/module ScssInitializer.*Sass::Plugin::Rack/m, "#{@apptmp}/sample_project/lib/scss_initializer.rb")
|