padrino-gen 0.10.1 → 0.10.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +1 -1
- data/lib/padrino-gen.rb +1 -1
- data/lib/padrino-gen/command.rb +1 -1
- data/lib/padrino-gen/generators/app.rb +1 -1
- data/lib/padrino-gen/generators/app/app.rb.tt +1 -1
- data/lib/padrino-gen/generators/cli.rb +1 -1
- data/lib/padrino-gen/generators/components/actions.rb +1 -1
- data/lib/padrino-gen/generators/components/mocks/mocha.rb +1 -1
- data/lib/padrino-gen/generators/components/mocks/rr.rb +1 -1
- data/lib/padrino-gen/generators/components/orms/sequel.rb +5 -5
- data/lib/padrino-gen/generators/components/renderers/erb.rb +1 -1
- data/lib/padrino-gen/generators/components/renderers/haml.rb +1 -1
- data/lib/padrino-gen/generators/components/renderers/liquid.rb +1 -1
- data/lib/padrino-gen/generators/components/renderers/slim.rb +1 -1
- data/lib/padrino-gen/generators/components/scripts/dojo.rb +1 -1
- data/lib/padrino-gen/generators/components/scripts/extcore.rb +1 -1
- data/lib/padrino-gen/generators/components/scripts/jquery.rb +1 -1
- data/lib/padrino-gen/generators/components/scripts/mootools.rb +1 -1
- data/lib/padrino-gen/generators/components/scripts/prototype.rb +1 -1
- data/lib/padrino-gen/generators/components/scripts/rightjs.rb +1 -1
- data/lib/padrino-gen/generators/components/stylesheets/compass.rb +1 -1
- data/lib/padrino-gen/generators/components/stylesheets/compass/application.scss +1 -1
- data/lib/padrino-gen/generators/components/stylesheets/compass/partials/_base.scss +1 -1
- data/lib/padrino-gen/generators/components/stylesheets/less.rb +1 -1
- data/lib/padrino-gen/generators/components/stylesheets/sass.rb +1 -1
- data/lib/padrino-gen/generators/components/tests/bacon.rb +3 -1
- data/lib/padrino-gen/generators/components/tests/riot.rb +3 -1
- data/lib/padrino-gen/generators/components/tests/shoulda.rb +3 -1
- data/lib/padrino-gen/generators/components/tests/testspec.rb +3 -1
- data/lib/padrino-gen/generators/controller.rb +1 -1
- data/lib/padrino-gen/generators/mailer.rb +1 -1
- data/lib/padrino-gen/generators/migration.rb +1 -1
- data/lib/padrino-gen/generators/plugin.rb +1 -1
- data/lib/padrino-gen/generators/project/config/boot.rb +1 -1
- data/lib/padrino-gen/generators/templates/controller.rb.tt +1 -1
- data/lib/padrino-gen/generators/templates/helper.rb.tt +1 -1
- data/lib/padrino-gen/generators/templates/initializer.rb.tt +1 -1
- data/lib/padrino-gen/generators/templates/mailer.rb.tt +1 -1
- data/lib/padrino-gen/padrino-tasks/seed.rb +1 -1
- data/lib/padrino-gen/padrino-tasks/sequel.rb +1 -1
- data/test/fixtures/admin_template.rb +1 -1
- data/test/fixtures/git_template.rb +1 -1
- data/test/fixtures/plugin_template.rb +1 -1
- data/test/fixtures/rake_template.rb +1 -1
- data/test/helper.rb +2 -2
- data/test/test_cli.rb +1 -1
- data/test/test_controller_generator.rb +4 -0
- data/test/test_generator.rb +1 -1
- data/test/test_mailer_generator.rb +1 -1
- data/test/test_migration_generator.rb +1 -1
- data/test/test_model_generator.rb +54 -0
- metadata +30 -3
data/README.rdoc
CHANGED
data/lib/padrino-gen.rb
CHANGED
@@ -74,4 +74,4 @@ Padrino::Generators.load_paths << Dir[File.dirname(__FILE__) + '/padrino-gen/gen
|
|
74
74
|
##
|
75
75
|
# We add our tasks to padrino-core
|
76
76
|
#
|
77
|
-
Padrino::Tasks.files << Dir[File.dirname(__FILE__) + "/padrino-gen/padrino-tasks/**/*.rb"]
|
77
|
+
Padrino::Tasks.files << Dir[File.dirname(__FILE__) + "/padrino-gen/padrino-tasks/**/*.rb"]
|
data/lib/padrino-gen/command.rb
CHANGED
@@ -13,11 +13,11 @@ def setup_orm
|
|
13
13
|
db = @app_name.underscore
|
14
14
|
require_dependencies 'sequel'
|
15
15
|
require_dependencies case options[:adapter]
|
16
|
-
when 'mysql'
|
17
|
-
sequel.gsub!(/!DB_DEVELOPMENT!/, "\"
|
18
|
-
sequel.gsub!(/!DB_PRODUCTION!/, "\"
|
19
|
-
sequel.gsub!(/!DB_TEST!/,"\"
|
20
|
-
|
16
|
+
when 'mysql', 'mysql2'
|
17
|
+
sequel.gsub!(/!DB_DEVELOPMENT!/, "\"#{options[:adapter]}://localhost/#{db}_development\"")
|
18
|
+
sequel.gsub!(/!DB_PRODUCTION!/, "\"#{options[:adapter]}://localhost/#{db}_production\"")
|
19
|
+
sequel.gsub!(/!DB_TEST!/,"\"#{options[:adapter]}://localhost/#{db}_test\"")
|
20
|
+
options[:adapter]
|
21
21
|
when 'postgres'
|
22
22
|
sequel.gsub!(/!DB_DEVELOPMENT!/, "\"postgres://localhost/#{db}_development\"")
|
23
23
|
sequel.gsub!(/!DB_PRODUCTION!/, "\"postgres://localhost/#{db}_production\"")
|
@@ -7,4 +7,4 @@ $blueprint-grid-margin: 10px;
|
|
7
7
|
|
8
8
|
// Use this to calculate the width based on the total width.
|
9
9
|
// Or you can set !blueprint_grid_width to a fixed value and unset !blueprint_container_size -- it will be calculated for you.
|
10
|
-
$blueprint-grid-width: ($blueprint-container-size + $blueprint-grid-margin) / $blueprint-grid-columns - $blueprint-grid-margin;
|
10
|
+
$blueprint-grid-width: ($blueprint-container-size + $blueprint-grid-margin) / $blueprint-grid-columns - $blueprint-grid-margin;
|
@@ -42,7 +42,7 @@ task 'test' => test_tasks.map { |f| "test:\#{f}" }
|
|
42
42
|
TEST
|
43
43
|
|
44
44
|
BACON_MODEL_TEST = (<<-TEST).gsub(/^ {10}/, '') unless defined?(BACON_MODEL_TEST)
|
45
|
-
require File.expand_path(File.dirname(__FILE__) + '
|
45
|
+
require File.expand_path(File.dirname(__FILE__) + '!PATH!/test_config.rb')
|
46
46
|
|
47
47
|
describe "!NAME! Model" do
|
48
48
|
it 'can be created' do
|
@@ -69,6 +69,8 @@ end
|
|
69
69
|
|
70
70
|
def generate_model_test(name)
|
71
71
|
bacon_contents = BACON_MODEL_TEST.gsub(/!NAME!/, name.to_s.camelize).gsub(/!DNAME!/, name.to_s.underscore)
|
72
|
+
path = options[:app] == '.' ? '/..' : '/../..'
|
73
|
+
bacon_contents.gsub!(/!PATH!/,path)
|
72
74
|
model_test_path = File.join('test',options[:app],'models',"#{name.to_s.underscore}_test.rb")
|
73
75
|
create_file destination_root(model_test_path), bacon_contents, :skip => true
|
74
76
|
end
|
@@ -66,7 +66,7 @@ task 'test' => test_tasks.map { |f| "test:\#{f}" }
|
|
66
66
|
TEST
|
67
67
|
|
68
68
|
RIOT_MODEL_TEST = (<<-TEST).gsub(/^ {10}/, '') unless defined?(RIOT_MODEL_TEST)
|
69
|
-
require File.expand_path(File.dirname(__FILE__) + '
|
69
|
+
require File.expand_path(File.dirname(__FILE__) + '!PATH!/test_config.rb')
|
70
70
|
|
71
71
|
context "!NAME! Model" do
|
72
72
|
context 'can be created' do
|
@@ -95,6 +95,8 @@ end
|
|
95
95
|
|
96
96
|
def generate_model_test(name)
|
97
97
|
riot_contents = RIOT_MODEL_TEST.gsub(/!NAME!/, name.to_s.camelize)
|
98
|
+
path = options[:app] == '.' ? '/..' : '/../..'
|
99
|
+
riot_contents.gsub!(/!PATH!/,path)
|
98
100
|
model_test_path = File.join('test',options[:app],'models',"#{name.to_s.underscore}_test.rb")
|
99
101
|
create_file destination_root(model_test_path), riot_contents, :skip => true
|
100
102
|
end
|
@@ -47,7 +47,7 @@ task 'test' => test_tasks.map { |f| "test:\#{f}" }
|
|
47
47
|
TEST
|
48
48
|
|
49
49
|
SHOULDA_MODEL_TEST = (<<-TEST).gsub(/^ {10}/, '') unless defined?(SHOULDA_MODEL_TEST)
|
50
|
-
require File.expand_path(File.dirname(__FILE__) + '
|
50
|
+
require File.expand_path(File.dirname(__FILE__) + '!PATH!/test_config.rb')
|
51
51
|
|
52
52
|
class !NAME!Test < Test::Unit::TestCase
|
53
53
|
context "!NAME! Model" do
|
@@ -78,6 +78,8 @@ end
|
|
78
78
|
|
79
79
|
def generate_model_test(name)
|
80
80
|
shoulda_contents = SHOULDA_MODEL_TEST.gsub(/!NAME!/, name.to_s.camelize).gsub(/!DNAME!/, name.to_s.underscore)
|
81
|
+
path = options[:app] == '.' ? '/..' : '/../..'
|
82
|
+
shoulda_contents.gsub!(/!PATH!/,path)
|
81
83
|
model_test_path = File.join('test',options[:app],'models',"#{name.to_s.underscore}_test.rb")
|
82
84
|
create_file destination_root(model_test_path), shoulda_contents, :skip => true
|
83
85
|
end
|
@@ -42,7 +42,7 @@ task 'test' => test_tasks.map { |f| "test:\#{f}" }
|
|
42
42
|
TEST
|
43
43
|
|
44
44
|
TESTSPEC_MODEL_TEST = (<<-TEST).gsub(/^ {10}/, '') unless defined?(TESTSPEC_MODEL_TEST)
|
45
|
-
require File.expand_path(File.dirname(__FILE__) + '
|
45
|
+
require File.expand_path(File.dirname(__FILE__) + '!PATH!/test_config.rb')
|
46
46
|
|
47
47
|
context "!NAME! Model" do
|
48
48
|
specify 'can be created' do
|
@@ -68,6 +68,8 @@ end
|
|
68
68
|
|
69
69
|
def generate_model_test(name)
|
70
70
|
tests_contents = TESTSPEC_MODEL_TEST.gsub(/!NAME!/, name.to_s.camelize).gsub(/!DNAME!/, name.to_s.underscore)
|
71
|
+
path = options[:app] == '.' ? '/..' : '/../..'
|
72
|
+
tests_contents.gsub!(/!PATH!/,path)
|
71
73
|
model_test_path = File.join('test',options[:app],'models',"#{name.to_s.underscore}_test.rb")
|
72
74
|
create_file destination_root(model_test_path), tests_contents, :skip => true
|
73
75
|
end
|
@@ -10,4 +10,4 @@ HOPTOAD = <<-HOPTOAD
|
|
10
10
|
HOPTOAD
|
11
11
|
require_dependencies 'rack_hoptoad', :require => 'rack/hoptoad'
|
12
12
|
initializer :hoptoad,HOPTOAD
|
13
|
-
inject_into_file destination_root('/app/app.rb')," enable :raise_errors\n", :after => "configure do\n"
|
13
|
+
inject_into_file destination_root('/app/app.rb')," enable :raise_errors\n", :after => "configure do\n"
|
data/test/helper.rb
CHANGED
data/test/test_cli.rb
CHANGED
@@ -59,6 +59,7 @@ class TestControllerGenerator < Test::Unit::TestCase
|
|
59
59
|
silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '--script=none', '-t=bacon') }
|
60
60
|
silence_logger { generate(:app, 'subby', "-r=#{@apptmp}/sample_project") }
|
61
61
|
silence_logger { generate(:controller, 'DemoItems','-a=/subby', "-r=#{@apptmp}/sample_project") }
|
62
|
+
assert_match_in_file(/(\/\.\.){2}/m, @controller_test_path.gsub('app','subby'))
|
62
63
|
assert_match_in_file(/describe "DemoItemsController" do/m, @controller_test_path.gsub('app','subby'))
|
63
64
|
end
|
64
65
|
|
@@ -66,6 +67,7 @@ class TestControllerGenerator < Test::Unit::TestCase
|
|
66
67
|
silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '--script=none', '-t=riot') }
|
67
68
|
silence_logger { generate(:app, 'subby', "-r=#{@apptmp}/sample_project") }
|
68
69
|
silence_logger { generate(:controller, 'DemoItems','-a=/subby', "-r=#{@apptmp}/sample_project") }
|
70
|
+
assert_match_in_file(/(\/\.\.){2}/m, @controller_test_path.gsub('app','subby'))
|
69
71
|
assert_match_in_file(/context "DemoItemsController" do/m, @controller_test_path.gsub('app','subby'))
|
70
72
|
end
|
71
73
|
|
@@ -73,6 +75,7 @@ class TestControllerGenerator < Test::Unit::TestCase
|
|
73
75
|
silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '--script=none', '-t=testspec') }
|
74
76
|
silence_logger { generate(:app, 'subby', "-r=#{@apptmp}/sample_project") }
|
75
77
|
silence_logger { generate(:controller, 'DemoItems','-a=/subby', "-r=#{@apptmp}/sample_project") }
|
78
|
+
assert_match_in_file(/(\/\.\.){2}/m, @controller_test_path.gsub('app','subby'))
|
76
79
|
assert_match_in_file(/context "DemoItemsController" do/m, @controller_test_path.gsub('app','subby'))
|
77
80
|
end
|
78
81
|
|
@@ -89,6 +92,7 @@ class TestControllerGenerator < Test::Unit::TestCase
|
|
89
92
|
silence_logger { generate(:controller, 'DemoItems','-a=/subby', "-r=#{@apptmp}/sample_project") }
|
90
93
|
expected_pattern = /class DemoItemsControllerTest < Test::Unit::TestCase/m
|
91
94
|
assert_match_in_file(expected_pattern, @controller_test_path.gsub('app','subby'))
|
95
|
+
assert_match_in_file(/(\/\.\.){2}/m, @controller_test_path.gsub('app','subby'))
|
92
96
|
assert_file_exists("#{@apptmp}/sample_project/test/subby/controllers/demo_items_controller_test.rb")
|
93
97
|
end
|
94
98
|
|
data/test/test_generator.rb
CHANGED
@@ -325,26 +325,57 @@ class TestModelGenerator < Test::Unit::TestCase
|
|
325
325
|
context "model generator testing files" do
|
326
326
|
# BACON
|
327
327
|
should "generate test file for bacon" do
|
328
|
+
silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '--script=none', '-t=bacon', '-d=activerecord') }
|
329
|
+
silence_logger { generate(:app, 'subby', "-r=#{@apptmp}/sample_project") }
|
330
|
+
silence_logger { generate(:model, 'SomeUser', "-r=#{@apptmp}/sample_project") }
|
331
|
+
assert_match_in_file(/describe "SomeUser Model"/m, "#{@apptmp}/sample_project/test/models/some_user_test.rb")
|
332
|
+
assert_match_in_file(/@some_user = SomeUser.new/m, "#{@apptmp}/sample_project/test/models/some_user_test.rb")
|
333
|
+
assert_match_in_file(/@some_user\.should\.not\.be\.nil/m, "#{@apptmp}/sample_project/test/models/some_user_test.rb")
|
334
|
+
assert_match_in_file(/'(\/\.\.){1}\/test/m, "#{@apptmp}/sample_project/test/models/some_user_test.rb")
|
335
|
+
end
|
336
|
+
|
337
|
+
should "generate test file for bacon in specified app" do
|
328
338
|
silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '--script=none', '-t=bacon', '-d=activerecord') }
|
329
339
|
silence_logger { generate(:app, 'subby', "-r=#{@apptmp}/sample_project") }
|
330
340
|
silence_logger { generate(:model, 'SomeUser', "-a=/subby", "-r=#{@apptmp}/sample_project") }
|
331
341
|
assert_match_in_file(/describe "SomeUser Model"/m, "#{@apptmp}/sample_project/test/subby/models/some_user_test.rb")
|
332
342
|
assert_match_in_file(/@some_user = SomeUser.new/m, "#{@apptmp}/sample_project/test/subby/models/some_user_test.rb")
|
333
343
|
assert_match_in_file(/@some_user\.should\.not\.be\.nil/m, "#{@apptmp}/sample_project/test/subby/models/some_user_test.rb")
|
344
|
+
assert_match_in_file(/'(\/\.\.){2}\/test/m, "#{@apptmp}/sample_project/test/subby/models/some_user_test.rb")
|
334
345
|
end
|
335
346
|
|
336
347
|
# RIOT
|
337
348
|
should "generate test file for riot" do
|
349
|
+
silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '--script=none', '-t=riot', '-d=activerecord') }
|
350
|
+
silence_logger { generate(:app, 'subby', "-r=#{@apptmp}/sample_project") }
|
351
|
+
silence_logger { generate(:model, 'SomeUser', "-r=#{@apptmp}/sample_project") }
|
352
|
+
assert_match_in_file(/context "SomeUser Model" do/m, "#{@apptmp}/sample_project/test/models/some_user_test.rb")
|
353
|
+
assert_match_in_file(/SomeUser.new/m, "#{@apptmp}/sample_project/test/models/some_user_test.rb")
|
354
|
+
assert_match_in_file(/asserts\("that record is not nil"\) \{ \!topic.nil\? \}/m, "#{@apptmp}/sample_project/test/models/some_user_test.rb")
|
355
|
+
assert_match_in_file(/'(\/\.\.){1}\/test/m, "#{@apptmp}/sample_project/test/models/some_user_test.rb")
|
356
|
+
end
|
357
|
+
|
358
|
+
should "generate test file for riot in specified app" do
|
338
359
|
silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '--script=none', '-t=riot', '-d=activerecord') }
|
339
360
|
silence_logger { generate(:app, 'subby', "-r=#{@apptmp}/sample_project") }
|
340
361
|
silence_logger { generate(:model, 'SomeUser', "-a=/subby", "-r=#{@apptmp}/sample_project") }
|
341
362
|
assert_match_in_file(/context "SomeUser Model" do/m, "#{@apptmp}/sample_project/test/subby/models/some_user_test.rb")
|
342
363
|
assert_match_in_file(/SomeUser.new/m, "#{@apptmp}/sample_project/test/subby/models/some_user_test.rb")
|
343
364
|
assert_match_in_file(/asserts\("that record is not nil"\) \{ \!topic.nil\? \}/m, "#{@apptmp}/sample_project/test/subby/models/some_user_test.rb")
|
365
|
+
assert_match_in_file(/'(\/\.\.){2}\/test/m, "#{@apptmp}/sample_project/test/subby/models/some_user_test.rb")
|
344
366
|
end
|
345
367
|
|
346
368
|
# RSPEC
|
347
369
|
should "generate test file for rspec" do
|
370
|
+
silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '--script=none', '-t=rspec', '-d=activerecord') }
|
371
|
+
silence_logger { generate(:app, 'subby', "-r=#{@apptmp}/sample_project") }
|
372
|
+
silence_logger { generate(:model, 'SomeUser', "-r=#{@apptmp}/sample_project") }
|
373
|
+
assert_match_in_file(/describe "SomeUser Model"/m, "#{@apptmp}/sample_project/spec/models/some_user_spec.rb")
|
374
|
+
assert_match_in_file(/let\(:some_user\) \{ SomeUser.new \}/m, "#{@apptmp}/sample_project/spec/models/some_user_spec.rb")
|
375
|
+
assert_match_in_file(/some_user\.should_not be_nil/m, "#{@apptmp}/sample_project/spec/models/some_user_spec.rb")
|
376
|
+
end
|
377
|
+
|
378
|
+
should "generate test file for rspec in specified app" do
|
348
379
|
silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '--script=none', '-t=rspec', '-d=activerecord') }
|
349
380
|
silence_logger { generate(:app, 'subby', "-r=#{@apptmp}/sample_project") }
|
350
381
|
silence_logger { generate(:model, 'SomeUser', "-a=/subby", "-r=#{@apptmp}/sample_project") }
|
@@ -355,6 +386,17 @@ class TestModelGenerator < Test::Unit::TestCase
|
|
355
386
|
|
356
387
|
# SHOULDA
|
357
388
|
should "generate test file for shoulda" do
|
389
|
+
silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '--script=none', '-t=shoulda', '-d=activerecord') }
|
390
|
+
silence_logger { generate(:app, 'subby', "-r=#{@apptmp}/sample_project") }
|
391
|
+
silence_logger { generate(:model, 'SomePerson', "-r=#{@apptmp}/sample_project") }
|
392
|
+
assert_match_in_file(/class SomePersonTest < Test::Unit::TestCase/m, "#{@apptmp}/sample_project/test/models/some_person_test.rb")
|
393
|
+
assert_match_in_file(/context "SomePerson Model"/m, "#{@apptmp}/sample_project/test/models/some_person_test.rb")
|
394
|
+
assert_match_in_file(/@some_person = SomePerson.new/m, "#{@apptmp}/sample_project/test/models/some_person_test.rb")
|
395
|
+
assert_match_in_file(/assert_not_nil @some_person/m, "#{@apptmp}/sample_project/test/models/some_person_test.rb")
|
396
|
+
assert_match_in_file(/'(\/\.\.){1}\/test/m, "#{@apptmp}/sample_project/test/models/some_person_test.rb")
|
397
|
+
end
|
398
|
+
|
399
|
+
should "generate test file for shoulda in specified app" do
|
358
400
|
silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '--script=none', '-t=shoulda', '-d=activerecord') }
|
359
401
|
silence_logger { generate(:app, 'subby', "-r=#{@apptmp}/sample_project") }
|
360
402
|
silence_logger { generate(:model, 'SomePerson', "-a=/subby", "-r=#{@apptmp}/sample_project") }
|
@@ -362,16 +404,28 @@ class TestModelGenerator < Test::Unit::TestCase
|
|
362
404
|
assert_match_in_file(/context "SomePerson Model"/m, "#{@apptmp}/sample_project/test/subby/models/some_person_test.rb")
|
363
405
|
assert_match_in_file(/@some_person = SomePerson.new/m, "#{@apptmp}/sample_project/test/subby/models/some_person_test.rb")
|
364
406
|
assert_match_in_file(/assert_not_nil @some_person/m, "#{@apptmp}/sample_project/test/subby/models/some_person_test.rb")
|
407
|
+
assert_match_in_file(/'(\/\.\.){2}\/test/m, "#{@apptmp}/sample_project/test/subby/models/some_person_test.rb")
|
365
408
|
end
|
366
409
|
|
367
410
|
# TESTSPEC
|
368
411
|
should "generate test file for testspec" do
|
412
|
+
silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '--script=none', '-t=testspec', '-d=activerecord') }
|
413
|
+
silence_logger { generate(:app, 'subby', "-r=#{@apptmp}/sample_project") }
|
414
|
+
silence_logger { generate(:model, 'SomeUser', "-r=#{@apptmp}/sample_project") }
|
415
|
+
assert_match_in_file(/context "SomeUser Model"/m, "#{@apptmp}/sample_project/test/models/some_user_test.rb")
|
416
|
+
assert_match_in_file(/@some_user = SomeUser.new/m, "#{@apptmp}/sample_project/test/models/some_user_test.rb")
|
417
|
+
assert_match_in_file(/@some_user\.should\.not\.be\.nil/m, "#{@apptmp}/sample_project/test/models/some_user_test.rb")
|
418
|
+
assert_match_in_file(/'(\/\.\.){1}\/test/m, "#{@apptmp}/sample_project/test/models/some_user_test.rb")
|
419
|
+
end
|
420
|
+
|
421
|
+
should "generate test file for testspec in specified app" do
|
369
422
|
silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '--script=none', '-t=testspec', '-d=activerecord') }
|
370
423
|
silence_logger { generate(:app, 'subby', "-r=#{@apptmp}/sample_project") }
|
371
424
|
silence_logger { generate(:model, 'SomeUser', "-a=/subby", "-r=#{@apptmp}/sample_project") }
|
372
425
|
assert_match_in_file(/context "SomeUser Model"/m, "#{@apptmp}/sample_project/test/subby/models/some_user_test.rb")
|
373
426
|
assert_match_in_file(/@some_user = SomeUser.new/m, "#{@apptmp}/sample_project/test/subby/models/some_user_test.rb")
|
374
427
|
assert_match_in_file(/@some_user\.should\.not\.be\.nil/m, "#{@apptmp}/sample_project/test/subby/models/some_user_test.rb")
|
428
|
+
assert_match_in_file(/'(\/\.\.){2}\/test/m, "#{@apptmp}/sample_project/test/subby/models/some_user_test.rb")
|
375
429
|
end
|
376
430
|
end
|
377
431
|
|
metadata
CHANGED
@@ -1,8 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: padrino-gen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 51
|
4
5
|
prerelease:
|
5
|
-
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 10
|
9
|
+
- 2
|
10
|
+
version: 0.10.2
|
6
11
|
platform: ruby
|
7
12
|
authors:
|
8
13
|
- Padrino Team
|
@@ -13,7 +18,7 @@ autorequire:
|
|
13
18
|
bindir: bin
|
14
19
|
cert_chain: []
|
15
20
|
|
16
|
-
date: 2011-08-
|
21
|
+
date: 2011-08-31 00:00:00 -07:00
|
17
22
|
default_executable:
|
18
23
|
dependencies:
|
19
24
|
- !ruby/object:Gem::Dependency
|
@@ -24,7 +29,12 @@ dependencies:
|
|
24
29
|
requirements:
|
25
30
|
- - "="
|
26
31
|
- !ruby/object:Gem::Version
|
27
|
-
|
32
|
+
hash: 51
|
33
|
+
segments:
|
34
|
+
- 0
|
35
|
+
- 10
|
36
|
+
- 2
|
37
|
+
version: 0.10.2
|
28
38
|
type: :runtime
|
29
39
|
version_requirements: *id001
|
30
40
|
- !ruby/object:Gem::Dependency
|
@@ -35,6 +45,10 @@ dependencies:
|
|
35
45
|
requirements:
|
36
46
|
- - ~>
|
37
47
|
- !ruby/object:Gem::Version
|
48
|
+
hash: 15
|
49
|
+
segments:
|
50
|
+
- 1
|
51
|
+
- 0
|
38
52
|
version: "1.0"
|
39
53
|
type: :runtime
|
40
54
|
version_requirements: *id002
|
@@ -46,6 +60,11 @@ dependencies:
|
|
46
60
|
requirements:
|
47
61
|
- - ~>
|
48
62
|
- !ruby/object:Gem::Version
|
63
|
+
hash: 29
|
64
|
+
segments:
|
65
|
+
- 2
|
66
|
+
- 4
|
67
|
+
- 1
|
49
68
|
version: 2.4.1
|
50
69
|
type: :runtime
|
51
70
|
version_requirements: *id003
|
@@ -171,12 +190,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
171
190
|
requirements:
|
172
191
|
- - ">="
|
173
192
|
- !ruby/object:Gem::Version
|
193
|
+
hash: 3
|
194
|
+
segments:
|
195
|
+
- 0
|
174
196
|
version: "0"
|
175
197
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
176
198
|
none: false
|
177
199
|
requirements:
|
178
200
|
- - ">="
|
179
201
|
- !ruby/object:Gem::Version
|
202
|
+
hash: 23
|
203
|
+
segments:
|
204
|
+
- 1
|
205
|
+
- 3
|
206
|
+
- 6
|
180
207
|
version: 1.3.6
|
181
208
|
requirements: []
|
182
209
|
|