padrino-gen 0.9.15 → 0.9.16

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,37 +2,42 @@ require File.expand_path(File.dirname(__FILE__) + '/helper')
2
2
 
3
3
  class TestPluginGenerator < Test::Unit::TestCase
4
4
  def setup
5
- %w(sample_project sample_git sample_rake sample_admin).each { |proj| system("rm -rf /tmp/#{proj}") }
5
+ @apptmp = "#{Dir.tmpdir}/padrino-tests/#{UUID.new.generate}"
6
+ `mkdir -p #{@apptmp}`
7
+ end
8
+
9
+ def teardown
10
+ `rm -rf #{@apptmp}`
6
11
  end
7
12
 
8
13
  context "the plugin destroy option" do
9
14
  should "remove the plugin instance" do
10
15
  path = File.expand_path('../fixtures/plugin_template.rb', __FILE__)
11
- silence_logger { generate(:project, 'sample_project', '--root=/tmp') }
12
- silence_logger { generate(:plugin, path, '--root=/tmp/sample_project') }
13
- silence_logger { generate(:plugin, path, '--root=/tmp/sample_project', '-d') }
14
- assert_no_file_exists('/tmp/sample_project/lib/hoptoad_init.rb')
15
- assert_no_match_in_file(/enable \:raise_errors/,'/tmp/sample_project/app/app.rb')
16
- assert_no_match_in_file(/rack\_hoptoad/, '/tmp/sample_project/Gemfile')
16
+ silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}") }
17
+ silence_logger { generate(:plugin, path, "--root=#{@apptmp}/sample_project") }
18
+ silence_logger { generate(:plugin, path, "--root=#{@apptmp}/sample_project", '-d') }
19
+ assert_no_file_exists("#{@apptmp}/sample_project/lib/hoptoad_init.rb")
20
+ assert_no_match_in_file(/enable \:raise_errors/,"#{@apptmp}/sample_project/app/app.rb")
21
+ assert_no_match_in_file(/rack\_hoptoad/, "#{@apptmp}/sample_project/Gemfile")
17
22
  end
18
23
  end
19
24
 
20
25
  context 'the project generator with template' do
21
26
  setup do
22
27
  example_template_path = File.join(File.dirname(__FILE__), 'fixtures', 'example_template.rb')
23
- silence_logger { generate(:project, 'sample_project', "-p=#{example_template_path}", '-r=/tmp', '> /dev/null') }
28
+ silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", "-p=#{example_template_path}", '> /dev/null') }
24
29
  end
25
30
 
26
31
  before_should "invoke Padrino.bin_gen" do
27
- expects_generated_project :test => :shoulda, :orm => :activerecord, :dev => true
28
- expects_generated :model, "post title:string body:text -r=/tmp/sample_project"
29
- expects_generated :controller, "posts get:index get:new post:new -r=/tmp/sample_project"
30
- expects_generated :migration, "AddEmailToUser email:string -r=/tmp/sample_project"
31
- expects_generated :fake, "foo bar -r=/tmp/sample_project"
32
+ expects_generated_project :name => 'sample_project', :test => :shoulda, :orm => :activerecord, :dev => true, :root => @apptmp
33
+ expects_generated :model, "post title:string body:text -r=#{@apptmp}/sample_project"
34
+ expects_generated :controller, "posts get:index get:new post:new -r=#{@apptmp}/sample_project"
35
+ expects_generated :migration, "AddEmailToUser email:string -r=#{@apptmp}/sample_project"
36
+ expects_generated :fake, "foo bar -r=#{@apptmp}/sample_project"
32
37
  expects_dependencies 'nokogiri'
33
- expects_initializer :test, "# Example"
34
- expects_generated :app, "testapp -r=/tmp/sample_project"
35
- expects_generated :controller, "users get:index -r=/tmp/sample_project --app=testapp"
38
+ expects_initializer :test, "# Example", :root => "#{@apptmp}/sample_project"
39
+ expects_generated :app, "testapp -r=#{@apptmp}/sample_project"
40
+ expects_generated :controller, "users get:index -r=#{@apptmp}/sample_project --app=testapp"
36
41
  end
37
42
  end
38
43
 
@@ -40,7 +45,7 @@ class TestPluginGenerator < Test::Unit::TestCase
40
45
 
41
46
  should "resolve generic url properly" do
42
47
  template_file = 'http://www.example.com/test.rb'
43
- project_gen = Padrino::Generators::Project.new(['sample_project'], ["-p=#{template_file}", '-r=/tmp'], {})
48
+ project_gen = Padrino::Generators::Project.new(['sample_project'], ["-p=#{template_file}", "-r=#{@apptmp}"], {})
44
49
  project_gen.expects(:apply).with(template_file).returns(true).once
45
50
  silence_logger { project_gen.invoke_all }
46
51
  end
@@ -49,7 +54,7 @@ class TestPluginGenerator < Test::Unit::TestCase
49
54
  FakeWeb.register_uri(:get, "http://gist.github.com/357045", :body => '<a href="/raw/357045/4356/blog_template.rb">raw</a>')
50
55
  template_file = 'http://gist.github.com/357045'
51
56
  resolved_path = 'http://gist.github.com/raw/357045/4356/blog_template.rb'
52
- project_gen = Padrino::Generators::Project.new(['sample_project'], ["-p=#{template_file}", '-r=/tmp'], {})
57
+ project_gen = Padrino::Generators::Project.new(['sample_project'], ["-p=#{template_file}", "-r=#{@apptmp}"], {})
53
58
  project_gen.expects(:apply).with(resolved_path).returns(true).once
54
59
  silence_logger { project_gen.invoke_all }
55
60
  end
@@ -57,14 +62,14 @@ class TestPluginGenerator < Test::Unit::TestCase
57
62
  should "resolve official template" do
58
63
  template_file = 'sampleblog'
59
64
  resolved_path = "http://github.com/padrino/padrino-recipes/raw/master/templates/sampleblog_template.rb"
60
- project_gen = Padrino::Generators::Project.new(['sample_project'], ["-p=#{template_file}", '-r=/tmp'], {})
65
+ project_gen = Padrino::Generators::Project.new(['sample_project'], ["-p=#{template_file}", "-r=#{@apptmp}"], {})
61
66
  project_gen.expects(:apply).with(resolved_path).returns(true).once
62
67
  silence_logger { project_gen.invoke_all }
63
68
  end
64
69
 
65
70
  should "resolve local file" do
66
71
  template_file = 'path/to/local/file.rb'
67
- project_gen = Padrino::Generators::Project.new(['sample_project'], ["-p=#{template_file}", '-r=/tmp'], {})
72
+ project_gen = Padrino::Generators::Project.new(['sample_project'], ["-p=#{template_file}", "-r=#{@apptmp}"], {})
68
73
  project_gen.expects(:apply).with(File.expand_path(template_file)).returns(true).once
69
74
  silence_logger { project_gen.invoke_all }
70
75
  end
@@ -72,7 +77,7 @@ class TestPluginGenerator < Test::Unit::TestCase
72
77
  should "resolve official plugin" do
73
78
  template_file = 'hoptoad'
74
79
  resolved_path = "http://github.com/padrino/padrino-recipes/raw/master/plugins/hoptoad_plugin.rb"
75
- plugin_gen = Padrino::Generators::Plugin.new([ template_file], ['-r=/tmp/sample_project'],{})
80
+ plugin_gen = Padrino::Generators::Plugin.new([ template_file], ["-r=#{@apptmp}/sample_project"],{})
76
81
  plugin_gen.expects(:in_app_root?).returns(true).once
77
82
  plugin_gen.expects(:apply).with(resolved_path).returns(true).once
78
83
  silence_logger { plugin_gen.invoke_all }
@@ -82,42 +87,42 @@ class TestPluginGenerator < Test::Unit::TestCase
82
87
  context "with git commands" do
83
88
  setup do
84
89
  git_template_path = File.join(File.dirname(__FILE__), 'fixtures', 'git_template.rb')
85
- silence_logger { generate(:project, 'sample_git', "-p=#{git_template_path}", '-r=/tmp', '> /dev/null') }
90
+ silence_logger { generate(:project, 'sample_git', "-p=#{git_template_path}", "-r=#{@apptmp}", '> /dev/null') }
86
91
  end
87
92
 
88
93
  before_should "generate a repository correctly" do
89
- expects_generated_project :test => :rspec, :orm => :activerecord, :name => 'sample_git'
90
- expects_git :init, :root => '/tmp/sample_git'
91
- expects_git :add, :arguments => '.', :root => '/tmp/sample_git'
92
- expects_git :commit, :arguments => 'hello', :root => '/tmp/sample_git'
94
+ expects_generated_project :test => :rspec, :orm => :activerecord, :name => 'sample_git', :root => "#{@apptmp}"
95
+ expects_git :init, :root => "#{@apptmp}/sample_git"
96
+ expects_git :add, :arguments => '.', :root => "#{@apptmp}/sample_git"
97
+ expects_git :commit, :arguments => 'hello', :root => "#{@apptmp}/sample_git"
93
98
  end
94
99
  end
95
100
 
96
101
  context "with rake invocations" do
97
102
  setup do
98
103
  rake_template_path = File.join(File.dirname(__FILE__), 'fixtures', 'rake_template.rb')
99
- silence_logger { generate(:project, 'sample_rake', "-p=#{rake_template_path}", '-r=/tmp', '> /dev/null') }
104
+ silence_logger { generate(:project, 'sample_rake', "-p=#{rake_template_path}", "-r=#{@apptmp}", '> /dev/null') }
100
105
  end
101
106
 
102
107
  before_should "Run rake task and list tasks" do
103
- expects_generated_project :test => :shoulda, :orm => :activerecord, :name => 'sample_rake'
104
- expects_rake "custom", :root => '/tmp/sample_rake'
108
+ expects_generated_project :test => :shoulda, :orm => :activerecord, :name => 'sample_rake', :root => "#{@apptmp}"
109
+ expects_rake "custom", :root => "#{@apptmp}/sample_rake"
105
110
  end
106
111
  end
107
112
 
108
113
  context "with admin commands" do
109
114
  setup do
110
115
  admin_template_path = File.join(File.dirname(__FILE__), 'fixtures', 'admin_template.rb')
111
- silence_logger { generate(:project, 'sample_admin', "-p=#{admin_template_path}", '-r=/tmp', '> /dev/null') }
116
+ silence_logger { generate(:project, 'sample_admin', "-p=#{admin_template_path}", "-r=#{@apptmp}", '> /dev/null') }
112
117
  end
113
118
 
114
119
  before_should "generate correctly an admin" do
115
- expects_generated_project :test => :shoulda, :orm => :activerecord, :name => 'sample_admin'
116
- expects_generated :model, "post title:string body:text -r=/tmp/sample_admin"
117
- expects_rake "ar:create", :root => '/tmp/sample_admin'
118
- expects_generated :admin, "-r=/tmp/sample_admin"
119
- expects_rake "ar:migrate", :root => '/tmp/sample_admin'
120
- expects_generated :admin_page, "post -r=/tmp/sample_admin"
120
+ expects_generated_project :test => :shoulda, :orm => :activerecord, :name => 'sample_admin', :root => "#{@apptmp}"
121
+ expects_generated :model, "post title:string body:text -r=#{@apptmp}/sample_admin"
122
+ expects_rake "ar:create", :root => "#{@apptmp}/sample_admin"
123
+ expects_generated :admin, "-r=#{@apptmp}/sample_admin"
124
+ expects_rake "ar:migrate", :root => "#{@apptmp}/sample_admin"
125
+ expects_generated :admin_page, "post -r=#{@apptmp}/sample_admin"
121
126
  end
122
127
  end
123
- end
128
+ end
@@ -2,69 +2,72 @@ require File.expand_path(File.dirname(__FILE__) + '/helper')
2
2
 
3
3
  class TestProjectGenerator < Test::Unit::TestCase
4
4
  def setup
5
- `rm -rf /tmp/sample_project`
6
- `rm -rf /tmp/project.com`
7
- `rm -rf /tmp/warepedia`
5
+ @apptmp = "#{Dir.tmpdir}/padrino-tests/#{UUID.new.generate}"
6
+ `mkdir -p #{@apptmp}`
7
+ end
8
+
9
+ def teardown
10
+ `rm -rf #{@apptmp}`
8
11
  end
9
12
 
10
13
  context 'the project generator' do
11
14
  should "allow simple generator to run and create base_app with no options" do
12
- assert_nothing_raised { silence_logger { generate(:project, 'sample_project', '--root=/tmp') } }
13
- assert_file_exists('/tmp/sample_project')
14
- assert_match_in_file(/class SampleProject < Padrino::Application/,'/tmp/sample_project/app/app.rb')
15
- assert_match_in_file(/Padrino.mount\("SampleProject"\).to\('\/'\)/,'/tmp/sample_project/config/apps.rb')
16
- assert_file_exists('/tmp/sample_project/config/boot.rb')
17
- assert_file_exists('/tmp/sample_project/public/favicon.ico')
15
+ assert_nothing_raised { silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}") } }
16
+ assert_file_exists("#{@apptmp}/sample_project")
17
+ assert_match_in_file(/class SampleProject < Padrino::Application/,"#{@apptmp}/sample_project/app/app.rb")
18
+ assert_match_in_file(/Padrino.mount\("SampleProject"\).to\('\/'\)/,"#{@apptmp}/sample_project/config/apps.rb")
19
+ assert_file_exists("#{@apptmp}/sample_project/config/boot.rb")
20
+ assert_file_exists("#{@apptmp}/sample_project/public/favicon.ico")
18
21
  end
19
22
 
20
23
  should "generate a valid name" do
21
- silence_logger { generate(:project, 'project.com', '--root=/tmp') }
22
- assert_file_exists('/tmp/project.com')
23
- assert_match_in_file(/class ProjectCom < Padrino::Application/,'/tmp/project.com/app/app.rb')
24
- assert_match_in_file(/Padrino.mount\("ProjectCom"\).to\('\/'\)/,'/tmp/project.com/config/apps.rb')
24
+ silence_logger { generate(:project, 'project.com', "--root=#{@apptmp}") }
25
+ assert_file_exists("#{@apptmp}/project.com")
26
+ assert_match_in_file(/class ProjectCom < Padrino::Application/,"#{@apptmp}/project.com/app/app.rb")
27
+ assert_match_in_file(/Padrino.mount\("ProjectCom"\).to\('\/'\)/,"#{@apptmp}/project.com/config/apps.rb")
25
28
  end
26
29
 
27
30
  should "allow specifying alternate application name" do
28
- assert_nothing_raised { silence_logger { generate(:project, 'sample_project', '--root=/tmp', '--app=base_app') } }
29
- assert_file_exists('/tmp/sample_project')
30
- assert_match_in_file(/class BaseApp < Padrino::Application/,'/tmp/sample_project/app/app.rb')
31
- assert_match_in_file(/Padrino.mount\("BaseApp"\).to\('\/'\)/,'/tmp/sample_project/config/apps.rb')
32
- assert_file_exists('/tmp/sample_project/config/boot.rb')
33
- assert_file_exists('/tmp/sample_project/public/favicon.ico')
31
+ assert_nothing_raised { silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '--app=base_app') } }
32
+ assert_file_exists("#{@apptmp}/sample_project")
33
+ assert_match_in_file(/class BaseApp < Padrino::Application/,"#{@apptmp}/sample_project/app/app.rb")
34
+ assert_match_in_file(/Padrino.mount\("BaseApp"\).to\('\/'\)/,"#{@apptmp}/sample_project/config/apps.rb")
35
+ assert_file_exists("#{@apptmp}/sample_project/config/boot.rb")
36
+ assert_file_exists("#{@apptmp}/sample_project/public/favicon.ico")
34
37
  end
35
38
 
36
39
  should "generate tiny skeleton" do
37
- assert_nothing_raised { silence_logger { generate(:project,'sample_project', '--tiny','--root=/tmp') } }
38
- assert_file_exists('/tmp/sample_project')
39
- assert_file_exists('/tmp/sample_project/app')
40
- assert_file_exists('/tmp/sample_project/app/controllers.rb')
41
- assert_file_exists('/tmp/sample_project/app/helpers.rb')
42
- assert_file_exists('/tmp/sample_project/app/mailers.rb')
43
- assert_dir_exists('/tmp/sample_project/app/views/mailers')
44
- assert_match_in_file(/:notifier/,'/tmp/sample_project/app/mailers.rb')
45
- assert_no_file_exists('/tmp/sample_project/demo/helpers')
46
- assert_no_file_exists('/tmp/sample_project/demo/controllers')
40
+ assert_nothing_raised { silence_logger { generate(:project,'sample_project', '--tiny',"--root=#{@apptmp}") } }
41
+ assert_file_exists("#{@apptmp}/sample_project")
42
+ assert_file_exists("#{@apptmp}/sample_project/app")
43
+ assert_file_exists("#{@apptmp}/sample_project/app/controllers.rb")
44
+ assert_file_exists("#{@apptmp}/sample_project/app/helpers.rb")
45
+ assert_file_exists("#{@apptmp}/sample_project/app/mailers.rb")
46
+ assert_dir_exists("#{@apptmp}/sample_project/app/views/mailers")
47
+ assert_match_in_file(/:notifier/,"#{@apptmp}/sample_project/app/mailers.rb")
48
+ assert_no_file_exists("#{@apptmp}/sample_project/demo/helpers")
49
+ assert_no_file_exists("#{@apptmp}/sample_project/demo/controllers")
47
50
  end
48
51
 
49
52
  should "not create models folder if no orm is chosen" do
50
- silence_logger { generate(:project, 'sample_project', '--root=/tmp', '--script=none', '--orm=none') }
51
- assert_no_dir_exists('/tmp/sample_project/app/models')
53
+ silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '--script=none', '--orm=none') }
54
+ assert_no_dir_exists("#{@apptmp}/sample_project/app/models")
52
55
  end
53
56
 
54
57
  should "not create tests folder if no test framework is chosen" do
55
- silence_logger { generate(:project, 'sample_project', '--root=/tmp', '--script=none', '--test=none') }
56
- assert_no_dir_exists('/tmp/sample_project/test')
58
+ silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '--script=none', '--test=none') }
59
+ assert_no_dir_exists("#{@apptmp}/sample_project/test")
57
60
  end
58
61
 
59
62
  should "place app specific names into correct files" do
60
- silence_logger { generate(:project, 'warepedia', '--root=/tmp', '--script=none') }
61
- assert_match_in_file(/class Warepedia < Padrino::Application/m, '/tmp/warepedia/app/app.rb')
62
- assert_match_in_file(/Padrino.mount\("Warepedia"\).to\('\/'\)/m, '/tmp/warepedia/config/apps.rb')
63
+ silence_logger { generate(:project, 'warepedia', "--root=#{@apptmp}", '--script=none') }
64
+ assert_match_in_file(/class Warepedia < Padrino::Application/m, "#{@apptmp}/warepedia/app/app.rb")
65
+ assert_match_in_file(/Padrino.mount\("Warepedia"\).to\('\/'\)/m, "#{@apptmp}/warepedia/config/apps.rb")
63
66
  end
64
67
 
65
68
  should "create components file containing options chosen with defaults" do
66
- silence_logger { generate(:project, 'sample_project', '--root=/tmp') }
67
- components_chosen = YAML.load_file('/tmp/sample_project/.components')
69
+ silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}") }
70
+ components_chosen = YAML.load_file("#{@apptmp}/sample_project/.components")
68
71
  assert_equal 'none', components_chosen[:orm]
69
72
  assert_equal 'none', components_chosen[:test]
70
73
  assert_equal 'none', components_chosen[:mock]
@@ -74,8 +77,8 @@ class TestProjectGenerator < Test::Unit::TestCase
74
77
 
75
78
  should "create components file containing options chosen" do
76
79
  component_options = ['--orm=datamapper', '--test=riot', '--mock=mocha', '--script=prototype', '--renderer=erb', '--stylesheet=less']
77
- silence_logger { generate(:project, 'sample_project', '--root=/tmp', *component_options) }
78
- components_chosen = YAML.load_file('/tmp/sample_project/.components')
80
+ silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", *component_options) }
81
+ components_chosen = YAML.load_file("#{@apptmp}/sample_project/.components")
79
82
  assert_equal 'datamapper', components_chosen[:orm]
80
83
  assert_equal 'riot', components_chosen[:test]
81
84
  assert_equal 'mocha', components_chosen[:mock]
@@ -86,7 +89,7 @@ class TestProjectGenerator < Test::Unit::TestCase
86
89
 
87
90
  should "output to log components being applied" do
88
91
  component_options = ['--orm=datamapper', '--test=riot', '--mock=mocha', '--script=prototype', '--renderer=erb','--stylesheet=less']
89
- buffer = silence_logger { generate(:project, 'sample_project', '--root=/tmp', *component_options) }
92
+ buffer = silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", *component_options) }
90
93
  assert_match(/Applying.*?datamapper.*?orm/, buffer)
91
94
  assert_match(/Applying.*?riot.*?test/, buffer)
92
95
  assert_match(/Applying.*?mocha.*?mock/, buffer)
@@ -96,40 +99,40 @@ class TestProjectGenerator < Test::Unit::TestCase
96
99
  end
97
100
 
98
101
  should "output gem files for base app" do
99
- silence_logger { generate(:project, 'sample_project', '--root=/tmp', '--script=none') }
100
- assert_match_in_file(/gem 'padrino'/, '/tmp/sample_project/Gemfile')
101
- assert_match_in_file(/gem 'rack-flash'/, '/tmp/sample_project/Gemfile')
102
- assert_match_in_file(/gem 'thin'/, '/tmp/sample_project/Gemfile')
102
+ silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '--script=none') }
103
+ assert_match_in_file(/gem 'padrino'/, "#{@apptmp}/sample_project/Gemfile")
104
+ assert_match_in_file(/gem 'rack-flash'/, "#{@apptmp}/sample_project/Gemfile")
105
+ assert_match_in_file(/gem 'thin'/, "#{@apptmp}/sample_project/Gemfile")
103
106
  end
104
107
  end
105
108
 
106
109
  context "a generator for mock component" do
107
110
  should "properly generate for rr and riot" do
108
- buffer = silence_logger { generate(:project, 'sample_project', '--root=/tmp', '--mock=rr', '--test=riot', '--script=none') }
111
+ buffer = silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '--mock=rr', '--test=riot', '--script=none') }
109
112
  assert_match(/Applying.*?rr.*?mock/, buffer)
110
- assert_match_in_file(/gem 'rr'/, '/tmp/sample_project/Gemfile')
111
- assert_match_in_file(/require 'riot\/rr'/, '/tmp/sample_project/test/test_config.rb')
113
+ assert_match_in_file(/gem 'rr'/, "#{@apptmp}/sample_project/Gemfile")
114
+ assert_match_in_file(/require 'riot\/rr'/, "#{@apptmp}/sample_project/test/test_config.rb")
112
115
  end
113
116
 
114
117
  should "properly generater for rr and bacon" do
115
- buffer = silence_logger { generate(:project, 'sample_project', '--root=/tmp', '--mock=rr', '--test=bacon', '--script=none') }
118
+ buffer = silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '--mock=rr', '--test=bacon', '--script=none') }
116
119
  assert_match(/Applying.*?rr.*?mock/, buffer)
117
- assert_match_in_file(/gem 'rr'/, '/tmp/sample_project/Gemfile')
118
- assert_match_in_file(/RR::Adapters::RRMethods/m, '/tmp/sample_project/test/test_config.rb')
120
+ assert_match_in_file(/gem 'rr'/, "#{@apptmp}/sample_project/Gemfile")
121
+ assert_match_in_file(/RR::Adapters::RRMethods/m, "#{@apptmp}/sample_project/test/test_config.rb")
119
122
  end
120
123
 
121
124
  should "properly generate for mocha and rspec" do
122
- buffer = silence_logger { generate(:project, 'sample_project', '--root=/tmp','--test=rspec', '--mock=mocha', '--script=none') }
125
+ buffer = silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}",'--test=rspec', '--mock=mocha', '--script=none') }
123
126
  assert_match(/Applying.*?mocha.*?mock/, buffer)
124
- assert_match_in_file(/gem 'mocha'/, '/tmp/sample_project/Gemfile')
125
- assert_match_in_file(/conf.mock_with :mocha/m, '/tmp/sample_project/spec/spec_helper.rb')
127
+ assert_match_in_file(/gem 'mocha'/, "#{@apptmp}/sample_project/Gemfile")
128
+ assert_match_in_file(/conf.mock_with :mocha/m, "#{@apptmp}/sample_project/spec/spec_helper.rb")
126
129
  end
127
130
 
128
131
  should "properly generate for rr and rspec" do
129
- buffer = silence_logger { generate(:project, 'sample_project', '--root=/tmp', '--test=rspec', '--mock=rr', '--script=none') }
132
+ buffer = silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '--test=rspec', '--mock=rr', '--script=none') }
130
133
  assert_match(/Applying.*?rr.*?mock/, buffer)
131
- assert_match_in_file(/gem 'rr'/, '/tmp/sample_project/Gemfile')
132
- assert_match_in_file(/conf.mock_with :rr/m, '/tmp/sample_project/spec/spec_helper.rb')
134
+ assert_match_in_file(/gem 'rr'/, "#{@apptmp}/sample_project/Gemfile")
135
+ assert_match_in_file(/conf.mock_with :rr/m, "#{@apptmp}/sample_project/spec/spec_helper.rb")
133
136
  end
134
137
 
135
138
  end
@@ -139,346 +142,353 @@ class TestProjectGenerator < Test::Unit::TestCase
139
142
  context "for sequel" do
140
143
  should "properly generate default" do
141
144
  @app.instance_eval("undef setup_orm if respond_to?('setup_orm')")
142
- buffer = silence_logger { generate(:project, 'project.com', '--root=/tmp', '--orm=sequel', '--script=none') }
145
+ buffer = silence_logger { generate(:project, 'project.com', "--root=#{@apptmp}", '--orm=sequel', '--script=none') }
143
146
  assert_match(/Applying.*?sequel.*?orm/, buffer)
144
- assert_match_in_file(/gem 'sequel'/, '/tmp/project.com/Gemfile')
145
- assert_match_in_file(/gem 'sqlite3-ruby'/, '/tmp/project.com/Gemfile')
146
- assert_match_in_file(/Sequel.connect/, '/tmp/project.com/config/database.rb')
147
- assert_match_in_file(%r{sqlite://}, '/tmp/project.com/config/database.rb')
148
- assert_match_in_file(%r{project_com}, '/tmp/project.com/config/database.rb')
149
- assert_dir_exists('/tmp/project.com/app/models')
147
+ assert_match_in_file(/gem 'sequel'/, "#{@apptmp}/project.com/Gemfile")
148
+ assert_match_in_file(/gem 'sqlite3-ruby'/, "#{@apptmp}/project.com/Gemfile")
149
+ assert_match_in_file(/Sequel.connect/, "#{@apptmp}/project.com/config/database.rb")
150
+ assert_match_in_file(%r{sqlite://}, "#{@apptmp}/project.com/config/database.rb")
151
+ assert_match_in_file(%r{project_com}, "#{@apptmp}/project.com/config/database.rb")
152
+ assert_dir_exists("#{@apptmp}/project.com/app/models")
150
153
  end
151
154
 
152
155
  should "properly generate mysql" do
153
- buffer = silence_logger { generate(:project, 'sample_project', '--root=/tmp', '--orm=sequel', '--adapter=mysql') }
154
- assert_match_in_file(/gem 'mysql'/, '/tmp/sample_project/Gemfile')
155
- assert_match_in_file(%r{"mysql://}, '/tmp/sample_project/config/database.rb')
156
- assert_match_in_file(/sample_project_development/, '/tmp/sample_project/config/database.rb')
156
+ buffer = silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '--orm=sequel', '--adapter=mysql') }
157
+ assert_match_in_file(/gem 'mysql'/, "#{@apptmp}/sample_project/Gemfile")
158
+ assert_match_in_file(%r{"mysql://}, "#{@apptmp}/sample_project/config/database.rb")
159
+ assert_match_in_file(/sample_project_development/, "#{@apptmp}/sample_project/config/database.rb")
157
160
  end
158
161
 
159
162
  should "properly generate sqlite3" do
160
- buffer = silence_logger { generate(:project, 'sample_project', '--root=/tmp', '--orm=sequel', '--adapter=sqlite') }
161
- assert_match_in_file(/gem 'sqlite3-ruby'/, '/tmp/sample_project/Gemfile')
162
- assert_match_in_file(%r{sqlite://}, '/tmp/sample_project/config/database.rb')
163
- assert_match_in_file(/sample_project_development/, '/tmp/sample_project/config/database.rb')
163
+ buffer = silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '--orm=sequel', '--adapter=sqlite') }
164
+ assert_match_in_file(/gem 'sqlite3-ruby'/, "#{@apptmp}/sample_project/Gemfile")
165
+ assert_match_in_file(%r{sqlite://}, "#{@apptmp}/sample_project/config/database.rb")
166
+ assert_match_in_file(/sample_project_development/, "#{@apptmp}/sample_project/config/database.rb")
164
167
  end
165
168
 
166
169
  should "properly generate postgres" do
167
- buffer = silence_logger { generate(:project, 'sample_project', '--root=/tmp', '--orm=sequel', '--adapter=postgres') }
168
- assert_match_in_file(/gem 'pg'/, '/tmp/sample_project/Gemfile')
169
- assert_match_in_file(%r{"postgres://}, '/tmp/sample_project/config/database.rb')
170
- assert_match_in_file(/sample_project_development/, '/tmp/sample_project/config/database.rb')
170
+ buffer = silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '--orm=sequel', '--adapter=postgres') }
171
+ assert_match_in_file(/gem 'pg'/, "#{@apptmp}/sample_project/Gemfile")
172
+ assert_match_in_file(%r{"postgres://}, "#{@apptmp}/sample_project/config/database.rb")
173
+ assert_match_in_file(/sample_project_development/, "#{@apptmp}/sample_project/config/database.rb")
171
174
  end
172
175
  end
173
176
 
174
177
  context "for activerecord" do
175
178
  should "properly generate default" do
176
- buffer = silence_logger { generate(:project, 'project.com', '--root=/tmp', '--orm=activerecord', '--script=none') }
179
+ buffer = silence_logger { generate(:project, 'project.com', "--root=#{@apptmp}", '--orm=activerecord', '--script=none') }
177
180
  assert_match(/Applying.*?activerecord.*?orm/, buffer)
178
- assert_match_in_file(/gem 'activerecord', :require => "active_record"/, '/tmp/project.com/Gemfile')
179
- assert_match_in_file(/gem 'sqlite3-ruby', :require => "sqlite3"/, '/tmp/project.com/Gemfile')
180
- assert_match_in_file(/ActiveRecord::Base.establish_connection/, '/tmp/project.com/config/database.rb')
181
- assert_match_in_file(/project_com/, '/tmp/project.com/config/database.rb')
182
- assert_dir_exists('/tmp/project.com/app/models')
181
+ assert_match_in_file(/gem 'activerecord', :require => "active_record"/, "#{@apptmp}/project.com/Gemfile")
182
+ assert_match_in_file(/gem 'sqlite3-ruby', :require => "sqlite3"/, "#{@apptmp}/project.com/Gemfile")
183
+ assert_match_in_file(/ActiveRecord::Base.establish_connection/, "#{@apptmp}/project.com/config/database.rb")
184
+ assert_match_in_file(/project_com/, "#{@apptmp}/project.com/config/database.rb")
185
+ assert_dir_exists("#{@apptmp}/project.com/app/models")
183
186
  end
184
187
 
185
188
  should "properly generate mysql" do
186
- buffer = silence_logger { generate(:project, 'sample_project', '--root=/tmp', '--orm=activerecord','--adapter=mysql') }
187
- assert_match_in_file(/gem 'mysql'/, '/tmp/sample_project/Gemfile')
188
- assert_match_in_file(/sample_project_development/, '/tmp/sample_project/config/database.rb')
189
- assert_match_in_file(%r{:adapter => 'mysql'}, '/tmp/sample_project/config/database.rb')
189
+ buffer = silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '--orm=activerecord','--adapter=mysql') }
190
+ assert_match_in_file(/gem 'mysql'/, "#{@apptmp}/sample_project/Gemfile")
191
+ assert_match_in_file(/sample_project_development/, "#{@apptmp}/sample_project/config/database.rb")
192
+ assert_match_in_file(%r{:adapter => 'mysql'}, "#{@apptmp}/sample_project/config/database.rb")
193
+ end
194
+
195
+ should "properly generate mysql2" do
196
+ buffer = silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '--orm=activerecord','--adapter=mysql2') }
197
+ assert_match_in_file(/gem 'mysql2'/, "#{@apptmp}/sample_project/Gemfile")
198
+ assert_match_in_file(/sample_project_development/, "#{@apptmp}/sample_project/config/database.rb")
199
+ assert_match_in_file(%r{:adapter => 'mysql2'}, "#{@apptmp}/sample_project/config/database.rb")
190
200
  end
191
201
 
192
202
  should "properly generate sqlite3" do
193
- buffer = silence_logger { generate(:project, 'sample_project', '--root=/tmp', '--orm=activerecord', '--adapter=sqlite3') }
194
- assert_match_in_file(/gem 'sqlite3-ruby', :require => "sqlite3"/, '/tmp/sample_project/Gemfile')
195
- assert_match_in_file(/sample_project_development.db/, '/tmp/sample_project/config/database.rb')
196
- assert_match_in_file(%r{:adapter => 'sqlite3'}, '/tmp/sample_project/config/database.rb')
203
+ buffer = silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '--orm=activerecord', '--adapter=sqlite3') }
204
+ assert_match_in_file(/gem 'sqlite3-ruby', :require => "sqlite3"/, "#{@apptmp}/sample_project/Gemfile")
205
+ assert_match_in_file(/sample_project_development.db/, "#{@apptmp}/sample_project/config/database.rb")
206
+ assert_match_in_file(%r{:adapter => 'sqlite3'}, "#{@apptmp}/sample_project/config/database.rb")
197
207
  end
198
208
 
199
209
  should "properly generate postgres" do
200
- buffer = silence_logger { generate(:project, 'sample_project', '--root=/tmp', '--orm=activerecord', '--adapter=postgres') }
201
- assert_match_in_file(/gem 'pg', :require => "postgres"/, '/tmp/sample_project/Gemfile')
202
- assert_match_in_file(/sample_project_development/, '/tmp/sample_project/config/database.rb')
203
- assert_match_in_file(%r{:adapter => 'postgresql'}, '/tmp/sample_project/config/database.rb')
210
+ buffer = silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '--orm=activerecord', '--adapter=postgres') }
211
+ assert_match_in_file(/gem 'pg', :require => "postgres"/, "#{@apptmp}/sample_project/Gemfile")
212
+ assert_match_in_file(/sample_project_development/, "#{@apptmp}/sample_project/config/database.rb")
213
+ assert_match_in_file(%r{:adapter => 'postgresql'}, "#{@apptmp}/sample_project/config/database.rb")
204
214
  end
205
215
  end
206
216
 
207
217
  context "for datamapper" do
208
218
  should "properly generate default" do
209
- buffer = silence_logger { generate(:project, 'project.com', '--root=/tmp', '--orm=datamapper', '--script=none') }
219
+ buffer = silence_logger { generate(:project, 'project.com', "--root=#{@apptmp}", '--orm=datamapper', '--script=none') }
210
220
  assert_match(/Applying.*?datamapper.*?orm/, buffer)
211
- assert_match_in_file(/gem 'data_mapper'/, '/tmp/project.com/Gemfile')
212
- assert_match_in_file(/gem 'dm-sqlite-adapter'/, '/tmp/project.com/Gemfile')
213
- assert_match_in_file(/DataMapper.setup/, '/tmp/project.com/config/database.rb')
214
- assert_match_in_file(/project_com/, '/tmp/project.com/config/database.rb')
215
- assert_dir_exists('/tmp/project.com/app/models')
221
+ assert_match_in_file(/gem 'data_mapper'/, "#{@apptmp}/project.com/Gemfile")
222
+ assert_match_in_file(/gem 'dm-sqlite-adapter'/, "#{@apptmp}/project.com/Gemfile")
223
+ assert_match_in_file(/DataMapper.setup/, "#{@apptmp}/project.com/config/database.rb")
224
+ assert_match_in_file(/project_com/, "#{@apptmp}/project.com/config/database.rb")
225
+ assert_dir_exists("#{@apptmp}/project.com/app/models")
216
226
  end
217
227
 
218
228
  should "properly generate for mysql" do
219
- buffer = silence_logger { generate(:project, 'sample_project', '--root=/tmp', '--orm=datamapper', '--adapter=mysql') }
220
- assert_match_in_file(/gem 'dm-mysql-adapter'/, '/tmp/sample_project/Gemfile')
221
- assert_match_in_file(%r{"mysql://}, '/tmp/sample_project/config/database.rb')
222
- assert_match_in_file(/sample_project_development/, '/tmp/sample_project/config/database.rb')
229
+ buffer = silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '--orm=datamapper', '--adapter=mysql') }
230
+ assert_match_in_file(/gem 'dm-mysql-adapter'/, "#{@apptmp}/sample_project/Gemfile")
231
+ assert_match_in_file(%r{"mysql://}, "#{@apptmp}/sample_project/config/database.rb")
232
+ assert_match_in_file(/sample_project_development/, "#{@apptmp}/sample_project/config/database.rb")
223
233
  end
224
234
 
225
235
  should "properly generate for sqlite" do
226
- buffer = silence_logger { generate(:project, 'sample_project', '--root=/tmp', '--orm=datamapper', '--adapter=sqlite') }
227
- assert_match_in_file(/gem 'dm-sqlite-adapter'/, '/tmp/sample_project/Gemfile')
228
- assert_match_in_file(/sample_project_development/, '/tmp/sample_project/config/database.rb')
236
+ buffer = silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '--orm=datamapper', '--adapter=sqlite') }
237
+ assert_match_in_file(/gem 'dm-sqlite-adapter'/, "#{@apptmp}/sample_project/Gemfile")
238
+ assert_match_in_file(/sample_project_development/, "#{@apptmp}/sample_project/config/database.rb")
229
239
  end
230
240
 
231
241
  should "properly generate for postgres" do
232
- buffer = silence_logger { generate(:project, 'sample_project', '--root=/tmp', '--orm=datamapper', '--adapter=postgres') }
233
- assert_match_in_file(/gem 'dm-postgres-adapter'/, '/tmp/sample_project/Gemfile')
234
- assert_match_in_file(%r{"postgres://}, '/tmp/sample_project/config/database.rb')
235
- assert_match_in_file(/sample_project_development/, '/tmp/sample_project/config/database.rb')
242
+ buffer = silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '--orm=datamapper', '--adapter=postgres') }
243
+ assert_match_in_file(/gem 'dm-postgres-adapter'/, "#{@apptmp}/sample_project/Gemfile")
244
+ assert_match_in_file(%r{"postgres://}, "#{@apptmp}/sample_project/config/database.rb")
245
+ assert_match_in_file(/sample_project_development/, "#{@apptmp}/sample_project/config/database.rb")
236
246
  end
237
247
  end
238
248
 
239
249
  should "properly generate for mongomapper" do
240
- buffer = silence_logger { generate(:project, 'project.com', '--root=/tmp', '--orm=mongomapper', '--script=none') }
250
+ buffer = silence_logger { generate(:project, 'project.com', "--root=#{@apptmp}", '--orm=mongomapper', '--script=none') }
241
251
  assert_match(/Applying.*?mongomapper.*?orm/, buffer)
242
- assert_match_in_file(/gem 'mongo_mapper'/, '/tmp/project.com/Gemfile')
243
- assert_match_in_file(/gem 'bson_ext'/, '/tmp/project.com/Gemfile')
244
- assert_match_in_file(/MongoMapper.database/, '/tmp/project.com/config/database.rb')
245
- assert_match_in_file(/project_com/, '/tmp/project.com/config/database.rb')
246
- assert_dir_exists('/tmp/project.com/app/models')
252
+ assert_match_in_file(/gem 'mongo_mapper'/, "#{@apptmp}/project.com/Gemfile")
253
+ assert_match_in_file(/gem 'bson_ext'/, "#{@apptmp}/project.com/Gemfile")
254
+ assert_match_in_file(/MongoMapper.database/, "#{@apptmp}/project.com/config/database.rb")
255
+ assert_match_in_file(/project_com/, "#{@apptmp}/project.com/config/database.rb")
256
+ assert_dir_exists("#{@apptmp}/project.com/app/models")
247
257
  end
248
258
 
249
259
  should "properly generate for mongoid" do
250
- buffer = silence_logger { generate(:project, 'project.com', '--root=/tmp', '--orm=mongoid', '--script=none') }
260
+ buffer = silence_logger { generate(:project, 'project.com', "--root=#{@apptmp}", '--orm=mongoid', '--script=none') }
251
261
  assert_match(/Applying.*?mongoid.*?orm/, buffer)
252
- assert_match_in_file(/gem 'mongoid'/, '/tmp/project.com/Gemfile')
253
- assert_match_in_file(/gem 'bson_ext'/, '/tmp/project.com/Gemfile')
254
- assert_match_in_file(/Mongoid.database/, '/tmp/project.com/config/database.rb')
255
- assert_match_in_file(/project_com/, '/tmp/project.com/config/database.rb')
256
- assert_dir_exists('/tmp/project.com/app/models')
262
+ assert_match_in_file(/gem 'mongoid'/, "#{@apptmp}/project.com/Gemfile")
263
+ assert_match_in_file(/gem 'bson_ext'/, "#{@apptmp}/project.com/Gemfile")
264
+ assert_match_in_file(/Mongoid.database/, "#{@apptmp}/project.com/config/database.rb")
265
+ assert_match_in_file(/project_com/, "#{@apptmp}/project.com/config/database.rb")
266
+ assert_dir_exists("#{@apptmp}/project.com/app/models")
257
267
  end
258
268
 
259
269
 
260
270
  should "properly generate for couchrest" do
261
- buffer = silence_logger { generate(:project, 'project.com', '--root=/tmp', '--orm=couchrest', '--script=none') }
271
+ buffer = silence_logger { generate(:project, 'project.com', "--root=#{@apptmp}", '--orm=couchrest', '--script=none') }
262
272
  assert_match(/Applying.*?couchrest.*?orm/, buffer)
263
- assert_match_in_file(/gem 'couchrest'/, '/tmp/project.com/Gemfile')
264
- assert_match_in_file(/CouchRest.database!/, '/tmp/project.com/config/database.rb')
265
- assert_match_in_file(/project_com/, '/tmp/project.com/config/database.rb')
266
- assert_dir_exists('/tmp/project.com/app/models')
273
+ assert_match_in_file(/gem 'couchrest'/, "#{@apptmp}/project.com/Gemfile")
274
+ assert_match_in_file(/CouchRest.database!/, "#{@apptmp}/project.com/config/database.rb")
275
+ assert_match_in_file(/project_com/, "#{@apptmp}/project.com/config/database.rb")
276
+ assert_dir_exists("#{@apptmp}/project.com/app/models")
267
277
  end
268
278
 
269
279
  should "properly generate for ohm" do
270
- buffer = silence_logger { generate(:project, 'sample_project', '--root=/tmp', '--orm=ohm', '--script=none') }
280
+ buffer = silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '--orm=ohm', '--script=none') }
271
281
  assert_match /Applying.*?ohm.*?orm/, buffer
272
- assert_match_in_file(/gem 'json'/, '/tmp/sample_project/Gemfile')
273
- assert_match_in_file(/gem 'ohm'/, '/tmp/sample_project/Gemfile')
274
- assert_match_in_file(/gem 'ohm-contrib', :require => "ohm\/contrib"/, '/tmp/sample_project/Gemfile')
275
- assert_match_in_file(/Ohm.connect/, '/tmp/sample_project/config/database.rb')
276
- assert_dir_exists('/tmp/sample_project/app/models')
282
+ assert_match_in_file(/gem 'json'/, "#{@apptmp}/sample_project/Gemfile")
283
+ assert_match_in_file(/gem 'ohm'/, "#{@apptmp}/sample_project/Gemfile")
284
+ assert_match_in_file(/gem 'ohm-contrib', :require => "ohm\/contrib"/, "#{@apptmp}/sample_project/Gemfile")
285
+ assert_match_in_file(/Ohm.connect/, "#{@apptmp}/sample_project/config/database.rb")
286
+ assert_dir_exists("#{@apptmp}/sample_project/app/models")
277
287
  end
278
288
 
279
289
  should "properly generate for mongomatic" do
280
- buffer = silence_logger { generate(:project, 'sample_project', '--root=/tmp', '--orm=mongomatic', '--script=none') }
290
+ buffer = silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '--orm=mongomatic', '--script=none') }
281
291
  assert_match /Applying.*?mongomatic.*?orm/, buffer
282
- assert_match_in_file(/gem 'bson_ext'/, '/tmp/sample_project/Gemfile')
283
- assert_match_in_file(/gem 'mongomatic'/, '/tmp/sample_project/Gemfile')
284
- assert_match_in_file(/Mongomatic.db = Mongo::Connection.new.db/, '/tmp/sample_project/config/database.rb')
285
- assert_dir_exists('/tmp/sample_project/app/models')
292
+ assert_match_in_file(/gem 'bson_ext'/, "#{@apptmp}/sample_project/Gemfile")
293
+ assert_match_in_file(/gem 'mongomatic'/, "#{@apptmp}/sample_project/Gemfile")
294
+ assert_match_in_file(/Mongomatic.db = Mongo::Connection.new.db/, "#{@apptmp}/sample_project/config/database.rb")
295
+ assert_dir_exists("#{@apptmp}/sample_project/app/models")
286
296
  end
287
297
  end
288
298
 
289
299
 
290
300
  context "the generator for renderer component" do
291
301
  should "properly generate for erb" do
292
- buffer = silence_logger { generate(:project, 'sample_project', '--root=/tmp', '--renderer=erb', '--script=none') }
302
+ buffer = silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '--renderer=erb', '--script=none') }
293
303
  assert_match(/Applying.*?erb.*?renderer/, buffer)
294
304
  end
295
305
 
296
306
  should "properly generate for haml" do
297
- buffer = silence_logger { generate(:project, 'sample_project', '--root=/tmp', '--renderer=haml','--script=none') }
307
+ buffer = silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '--renderer=haml','--script=none') }
298
308
  assert_match(/Applying.*?haml.*?renderer/, buffer)
299
- assert_match_in_file(/gem 'haml'/, '/tmp/sample_project/Gemfile')
309
+ assert_match_in_file(/gem 'haml'/, "#{@apptmp}/sample_project/Gemfile")
300
310
  end
301
311
 
302
312
  should "properly generate for erubis" do
303
- buffer = silence_logger { generate(:project, 'sample_project', '--root=/tmp', '--renderer=erubis','--script=none') }
313
+ buffer = silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '--renderer=erubis','--script=none') }
304
314
  assert_match(/Applying.*?erubis.*?renderer/,buffer)
305
- assert_match_in_file(/gem 'erubis'/, '/tmp/sample_project/Gemfile')
315
+ assert_match_in_file(/gem 'erubis'/, "#{@apptmp}/sample_project/Gemfile")
306
316
  end
307
317
 
308
318
  should "properly generate for liquid" do
309
- buffer = silence_logger { generate(:project, 'sample_project', '--root=/tmp', '--renderer=liquid','--script=none') }
319
+ buffer = silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '--renderer=liquid','--script=none') }
310
320
  assert_match(/Applying.*?liquid.*?renderer/,buffer)
311
- assert_match_in_file(/gem 'liquid'/, '/tmp/sample_project/Gemfile')
321
+ assert_match_in_file(/gem 'liquid'/, "#{@apptmp}/sample_project/Gemfile")
312
322
  end
313
323
 
314
324
  end
315
325
 
316
326
  context "the generator for script component" do
317
327
  should "properly generate for jquery" do
318
- buffer = silence_logger { generate(:project, 'sample_project', '--root=/tmp', '--script=jquery') }
328
+ buffer = silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '--script=jquery') }
319
329
  assert_match(/Applying.*?jquery.*?script/, buffer)
320
- assert_file_exists('/tmp/sample_project/public/javascripts/jquery.js')
321
- assert_file_exists('/tmp/sample_project/public/javascripts/application.js')
330
+ assert_file_exists("#{@apptmp}/sample_project/public/javascripts/jquery.js")
331
+ assert_file_exists("#{@apptmp}/sample_project/public/javascripts/application.js")
322
332
  end
323
333
 
324
334
  should "properly generate for mootools" do
325
- buffer = silence_logger { generate(:project, 'sample_project', '--root=/tmp', '--script=mootools') }
335
+ buffer = silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '--script=mootools') }
326
336
  assert_match(/Applying.*?mootools.*?script/, buffer)
327
- assert_file_exists('/tmp/sample_project/public/javascripts/mootools-core.js')
328
- assert_file_exists('/tmp/sample_project/public/javascripts/application.js')
337
+ assert_file_exists("#{@apptmp}/sample_project/public/javascripts/mootools-core.js")
338
+ assert_file_exists("#{@apptmp}/sample_project/public/javascripts/application.js")
329
339
  end
330
340
 
331
341
  should "properly generate for prototype" do
332
- buffer = silence_logger { generate(:project, 'sample_project', '--root=/tmp', '--script=prototype') }
342
+ buffer = silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '--script=prototype') }
333
343
  assert_match(/Applying.*?prototype.*?script/, buffer)
334
- assert_file_exists('/tmp/sample_project/public/javascripts/protopak.js')
335
- assert_file_exists('/tmp/sample_project/public/javascripts/lowpro.js')
336
- assert_file_exists('/tmp/sample_project/public/javascripts/application.js')
344
+ assert_file_exists("#{@apptmp}/sample_project/public/javascripts/protopak.js")
345
+ assert_file_exists("#{@apptmp}/sample_project/public/javascripts/lowpro.js")
346
+ assert_file_exists("#{@apptmp}/sample_project/public/javascripts/application.js")
337
347
  end
338
348
 
339
349
  should "properly generate for rightjs" do
340
- buffer = silence_logger { generate(:project, 'sample_project', '--root=/tmp', '--script=rightjs') }
350
+ buffer = silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '--script=rightjs') }
341
351
  assert_match(/Applying.*?rightjs.*?script/, buffer)
342
- assert_file_exists('/tmp/sample_project/public/javascripts/right.js')
343
- assert_file_exists('/tmp/sample_project/public/javascripts/application.js')
352
+ assert_file_exists("#{@apptmp}/sample_project/public/javascripts/right.js")
353
+ assert_file_exists("#{@apptmp}/sample_project/public/javascripts/application.js")
344
354
  end
345
355
 
346
356
  should "properly generate for ext-core" do
347
- buffer = silence_logger { generate(:project, 'sample_project', '--root=/tmp', '--script=extcore') }
357
+ buffer = silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '--script=extcore') }
348
358
  assert_match(/Applying.*?extcore.*?script/, buffer)
349
- assert_file_exists('/tmp/sample_project/public/javascripts/ext-core.js')
350
- assert_file_exists('/tmp/sample_project/public/javascripts/application.js')
359
+ assert_file_exists("#{@apptmp}/sample_project/public/javascripts/ext-core.js")
360
+ assert_file_exists("#{@apptmp}/sample_project/public/javascripts/application.js")
351
361
  end
352
362
 
353
363
  should "properly generate for dojo" do
354
- buffer = silence_logger { generate(:project, 'sample_project', '--root=/tmp', '--script=dojo') }
364
+ buffer = silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '--script=dojo') }
355
365
  assert_match(/Applying.*?dojo.*?script/, buffer)
356
- assert_file_exists('/tmp/sample_project/public/javascripts/dojo.js')
357
- assert_file_exists('/tmp/sample_project/public/javascripts/application.js')
366
+ assert_file_exists("#{@apptmp}/sample_project/public/javascripts/dojo.js")
367
+ assert_file_exists("#{@apptmp}/sample_project/public/javascripts/application.js")
358
368
  end
359
369
  end
360
370
 
361
371
  context "the generator for test component" do
362
372
  should "properly generate for bacon" do
363
- buffer = silence_logger { generate(:project, 'sample_project', '--root=/tmp', '--test=bacon', '--script=none') }
373
+ buffer = silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '--test=bacon', '--script=none') }
364
374
  assert_match(/Applying.*?bacon.*?test/, buffer)
365
- assert_match_in_file(/gem 'rack-test'/, '/tmp/sample_project/Gemfile')
366
- assert_match_in_file(/:require => "rack\/test"/, '/tmp/sample_project/Gemfile')
367
- assert_match_in_file(/:group => "test"/, '/tmp/sample_project/Gemfile')
368
- assert_match_in_file(/gem 'bacon'/, '/tmp/sample_project/Gemfile')
369
- assert_match_in_file(/PADRINO_ENV = 'test' unless defined\?\(PADRINO_ENV\)/, '/tmp/sample_project/test/test_config.rb')
370
- assert_match_in_file(/Bacon::Context/, '/tmp/sample_project/test/test_config.rb')
371
- assert_file_exists('/tmp/sample_project/test/test.rake')
375
+ assert_match_in_file(/gem 'rack-test'/, "#{@apptmp}/sample_project/Gemfile")
376
+ assert_match_in_file(/:require => "rack\/test"/, "#{@apptmp}/sample_project/Gemfile")
377
+ assert_match_in_file(/:group => "test"/, "#{@apptmp}/sample_project/Gemfile")
378
+ assert_match_in_file(/gem 'bacon'/, "#{@apptmp}/sample_project/Gemfile")
379
+ assert_match_in_file(/PADRINO_ENV = 'test' unless defined\?\(PADRINO_ENV\)/, "#{@apptmp}/sample_project/test/test_config.rb")
380
+ assert_match_in_file(/Bacon::Context/, "#{@apptmp}/sample_project/test/test_config.rb")
381
+ assert_file_exists("#{@apptmp}/sample_project/test/test.rake")
372
382
  end
373
383
 
374
384
  should "properly generate for riot" do
375
- buffer = silence_logger { generate(:project, 'sample_project', '--root=/tmp', '--test=riot', '--script=none') }
385
+ buffer = silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '--test=riot', '--script=none') }
376
386
  assert_match(/Applying.*?riot.*?test/, buffer)
377
- assert_match_in_file(/gem 'rack-test'/, '/tmp/sample_project/Gemfile')
378
- assert_match_in_file(/:require => "rack\/test"/, '/tmp/sample_project/Gemfile')
379
- assert_match_in_file(/:group => "test"/, '/tmp/sample_project/Gemfile')
380
- assert_match_in_file(/gem 'riot'/, '/tmp/sample_project/Gemfile')
381
- assert_match_in_file(/include Rack::Test::Methods/, '/tmp/sample_project/test/test_config.rb')
382
- assert_match_in_file(/PADRINO_ENV = 'test' unless defined\?\(PADRINO_ENV\)/, '/tmp/sample_project/test/test_config.rb')
383
- assert_match_in_file(/Riot::Situation/, '/tmp/sample_project/test/test_config.rb')
384
- assert_match_in_file(/Riot::Context/, '/tmp/sample_project/test/test_config.rb')
385
- assert_match_in_file(/SampleProject\.tap/, '/tmp/sample_project/test/test_config.rb')
386
- assert_file_exists('/tmp/sample_project/test/test.rake')
387
+ assert_match_in_file(/gem 'rack-test'/, "#{@apptmp}/sample_project/Gemfile")
388
+ assert_match_in_file(/:require => "rack\/test"/, "#{@apptmp}/sample_project/Gemfile")
389
+ assert_match_in_file(/:group => "test"/, "#{@apptmp}/sample_project/Gemfile")
390
+ assert_match_in_file(/gem 'riot'/, "#{@apptmp}/sample_project/Gemfile")
391
+ assert_match_in_file(/include Rack::Test::Methods/, "#{@apptmp}/sample_project/test/test_config.rb")
392
+ assert_match_in_file(/PADRINO_ENV = 'test' unless defined\?\(PADRINO_ENV\)/, "#{@apptmp}/sample_project/test/test_config.rb")
393
+ assert_match_in_file(/Riot::Situation/, "#{@apptmp}/sample_project/test/test_config.rb")
394
+ assert_match_in_file(/Riot::Context/, "#{@apptmp}/sample_project/test/test_config.rb")
395
+ assert_match_in_file(/SampleProject\.tap/, "#{@apptmp}/sample_project/test/test_config.rb")
396
+ assert_file_exists("#{@apptmp}/sample_project/test/test.rake")
387
397
  end
388
398
 
389
399
  should "properly generate for rspec" do
390
- buffer = silence_logger { generate(:project, 'sample_project', '--root=/tmp', '--test=rspec', '--script=none') }
400
+ buffer = silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '--test=rspec', '--script=none') }
391
401
  assert_match(/Applying.*?rspec.*?test/, buffer)
392
- assert_match_in_file(/gem 'rack-test'/, '/tmp/sample_project/Gemfile')
393
- assert_match_in_file(/:require => "rack\/test"/, '/tmp/sample_project/Gemfile')
394
- assert_match_in_file(/:group => "test"/, '/tmp/sample_project/Gemfile')
395
- assert_match_in_file(/gem 'rspec'.*?:require => "spec"/, '/tmp/sample_project/Gemfile')
396
- assert_match_in_file(/PADRINO_ENV = 'test' unless defined\?\(PADRINO_ENV\)/, '/tmp/sample_project/spec/spec_helper.rb')
397
- assert_match_in_file(/Spec::Runner/, '/tmp/sample_project/spec/spec_helper.rb')
398
- assert_file_exists('/tmp/sample_project/spec/spec.rake')
402
+ assert_match_in_file(/gem 'rack-test'/, "#{@apptmp}/sample_project/Gemfile")
403
+ assert_match_in_file(/:require => "rack\/test"/, "#{@apptmp}/sample_project/Gemfile")
404
+ assert_match_in_file(/:group => "test"/, "#{@apptmp}/sample_project/Gemfile")
405
+ assert_match_in_file(/gem 'rspec'.*?:require => "spec"/, "#{@apptmp}/sample_project/Gemfile")
406
+ assert_match_in_file(/PADRINO_ENV = 'test' unless defined\?\(PADRINO_ENV\)/, "#{@apptmp}/sample_project/spec/spec_helper.rb")
407
+ assert_match_in_file(/Spec::Runner/, "#{@apptmp}/sample_project/spec/spec_helper.rb")
408
+ assert_file_exists("#{@apptmp}/sample_project/spec/spec.rake")
399
409
  end
400
410
 
401
411
  should "properly generate for shoulda" do
402
- buffer = silence_logger { generate(:project, 'sample_project', '--root=/tmp', '--test=shoulda', '--script=none') }
412
+ buffer = silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '--test=shoulda', '--script=none') }
403
413
  assert_match(/Applying.*?shoulda.*?test/, buffer)
404
- assert_match_in_file(/gem 'rack-test'/, '/tmp/sample_project/Gemfile')
405
- assert_match_in_file(/:require => "rack\/test"/, '/tmp/sample_project/Gemfile')
406
- assert_match_in_file(/:group => "test"/, '/tmp/sample_project/Gemfile')
407
- assert_match_in_file(/gem 'shoulda'/, '/tmp/sample_project/Gemfile')
408
- assert_match_in_file(/PADRINO_ENV = 'test' unless defined\?\(PADRINO_ENV\)/, '/tmp/sample_project/test/test_config.rb')
409
- assert_match_in_file(/Test::Unit::TestCase/, '/tmp/sample_project/test/test_config.rb')
410
- assert_file_exists('/tmp/sample_project/test/test.rake')
414
+ assert_match_in_file(/gem 'rack-test'/, "#{@apptmp}/sample_project/Gemfile")
415
+ assert_match_in_file(/:require => "rack\/test"/, "#{@apptmp}/sample_project/Gemfile")
416
+ assert_match_in_file(/:group => "test"/, "#{@apptmp}/sample_project/Gemfile")
417
+ assert_match_in_file(/gem 'shoulda'/, "#{@apptmp}/sample_project/Gemfile")
418
+ assert_match_in_file(/PADRINO_ENV = 'test' unless defined\?\(PADRINO_ENV\)/, "#{@apptmp}/sample_project/test/test_config.rb")
419
+ assert_match_in_file(/Test::Unit::TestCase/, "#{@apptmp}/sample_project/test/test_config.rb")
420
+ assert_file_exists("#{@apptmp}/sample_project/test/test.rake")
411
421
  end
412
422
 
413
423
  should "properly generate for testspec" do
414
- buffer = silence_logger { generate(:project, 'sample_project', '--root=/tmp', '--test=testspec', '--script=none') }
424
+ buffer = silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '--test=testspec', '--script=none') }
415
425
  assert_match(/Applying.*?testspec.*?test/, buffer)
416
- assert_match_in_file(/gem 'rack-test'/, '/tmp/sample_project/Gemfile')
417
- assert_match_in_file(/:require => "rack\/test"/, '/tmp/sample_project/Gemfile')
418
- assert_match_in_file(/:group => "test"/, '/tmp/sample_project/Gemfile')
419
- assert_match_in_file(/gem 'test-spec'.*?:require => "test\/spec"/, '/tmp/sample_project/Gemfile')
420
- assert_match_in_file(/PADRINO_ENV = 'test' unless defined\?\(PADRINO_ENV\)/, '/tmp/sample_project/test/test_config.rb')
421
- assert_match_in_file(/Test::Unit::TestCase/, '/tmp/sample_project/test/test_config.rb')
422
- assert_file_exists('/tmp/sample_project/test/test.rake')
426
+ assert_match_in_file(/gem 'rack-test'/, "#{@apptmp}/sample_project/Gemfile")
427
+ assert_match_in_file(/:require => "rack\/test"/, "#{@apptmp}/sample_project/Gemfile")
428
+ assert_match_in_file(/:group => "test"/, "#{@apptmp}/sample_project/Gemfile")
429
+ assert_match_in_file(/gem 'test-spec'.*?:require => "test\/spec"/, "#{@apptmp}/sample_project/Gemfile")
430
+ assert_match_in_file(/PADRINO_ENV = 'test' unless defined\?\(PADRINO_ENV\)/, "#{@apptmp}/sample_project/test/test_config.rb")
431
+ assert_match_in_file(/Test::Unit::TestCase/, "#{@apptmp}/sample_project/test/test_config.rb")
432
+ assert_file_exists("#{@apptmp}/sample_project/test/test.rake")
423
433
  end
424
434
 
425
435
  should "properly generate for cucumber" do
426
- buffer = silence_logger { generate(:project, 'sample_project', '--root=/tmp', '--test=cucumber', '--script=none') }
436
+ buffer = silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '--test=cucumber', '--script=none') }
427
437
  assert_match(/Applying.*?cucumber.*?test/, buffer)
428
- assert_match_in_file(/gem 'rack-test'/, '/tmp/sample_project/Gemfile')
429
- assert_match_in_file(/:require => "rack\/test"/, '/tmp/sample_project/Gemfile')
430
- assert_match_in_file(/:group => "test"/, '/tmp/sample_project/Gemfile')
431
- assert_match_in_file(/gem 'rspec'.*?:require => "spec"/, '/tmp/sample_project/Gemfile')
432
- assert_match_in_file(/gem 'cucumber'/, '/tmp/sample_project/Gemfile')
433
- assert_match_in_file(/gem 'capybara'/, '/tmp/sample_project/Gemfile')
434
- assert_match_in_file(/PADRINO_ENV = 'test' unless defined\?\(PADRINO_ENV\)/, '/tmp/sample_project/spec/spec_helper.rb')
435
- assert_match_in_file(/PADRINO_ENV = 'test' unless defined\?\(PADRINO_ENV\)/, '/tmp/sample_project/features/support/env.rb')
436
- assert_match_in_file(/Spec::Runner/, '/tmp/sample_project/spec/spec_helper.rb')
437
- assert_match_in_file(/Capybara.app = /, '/tmp/sample_project/features/support/env.rb')
438
- assert_match_in_file(/World\(Cucumber::Web::URLs\)/, '/tmp/sample_project/features/support/url.rb')
439
- assert_file_exists('/tmp/sample_project/spec/spec.rake')
440
- assert_file_exists('/tmp/sample_project/features/support/env.rb')
441
- assert_file_exists('/tmp/sample_project/features/add.feature')
442
- assert_file_exists('/tmp/sample_project/features/step_definitions/add_steps.rb')
438
+ assert_match_in_file(/gem 'rack-test'/, "#{@apptmp}/sample_project/Gemfile")
439
+ assert_match_in_file(/:require => "rack\/test"/, "#{@apptmp}/sample_project/Gemfile")
440
+ assert_match_in_file(/:group => "test"/, "#{@apptmp}/sample_project/Gemfile")
441
+ assert_match_in_file(/gem 'rspec'.*?:require => "spec"/, "#{@apptmp}/sample_project/Gemfile")
442
+ assert_match_in_file(/gem 'cucumber'/, "#{@apptmp}/sample_project/Gemfile")
443
+ assert_match_in_file(/gem 'capybara'/, "#{@apptmp}/sample_project/Gemfile")
444
+ assert_match_in_file(/PADRINO_ENV = 'test' unless defined\?\(PADRINO_ENV\)/, "#{@apptmp}/sample_project/spec/spec_helper.rb")
445
+ assert_match_in_file(/PADRINO_ENV = 'test' unless defined\?\(PADRINO_ENV\)/, "#{@apptmp}/sample_project/features/support/env.rb")
446
+ assert_match_in_file(/Spec::Runner/, "#{@apptmp}/sample_project/spec/spec_helper.rb")
447
+ assert_match_in_file(/Capybara.app = /, "#{@apptmp}/sample_project/features/support/env.rb")
448
+ assert_match_in_file(/World\(Cucumber::Web::URLs\)/, "#{@apptmp}/sample_project/features/support/url.rb")
449
+ assert_file_exists("#{@apptmp}/sample_project/spec/spec.rake")
450
+ assert_file_exists("#{@apptmp}/sample_project/features/support/env.rb")
451
+ assert_file_exists("#{@apptmp}/sample_project/features/add.feature")
452
+ assert_file_exists("#{@apptmp}/sample_project/features/step_definitions/add_steps.rb")
443
453
  end
444
454
  end
445
455
 
446
456
  context "the generator for stylesheet component" do
447
457
  should "properly generate for sass" do
448
- buffer = silence_logger { generate(:project, 'sample_project', '--root=/tmp', '--renderer=haml','--script=none','--stylesheet=sass') }
449
- assert_match_in_file(/gem 'haml'/, '/tmp/sample_project/Gemfile')
450
- assert_match_in_file(/module SassInitializer.*Sass::Plugin::Rack/m, '/tmp/sample_project/lib/sass_init.rb')
451
- assert_match_in_file(/register SassInitializer/m, '/tmp/sample_project/app/app.rb')
452
- assert_dir_exists('/tmp/sample_project/app/stylesheets')
458
+ buffer = silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '--renderer=haml','--script=none','--stylesheet=sass') }
459
+ assert_match_in_file(/gem 'haml'/, "#{@apptmp}/sample_project/Gemfile")
460
+ assert_match_in_file(/module SassInitializer.*Sass::Plugin::Rack/m, "#{@apptmp}/sample_project/lib/sass_init.rb")
461
+ assert_match_in_file(/register SassInitializer/m, "#{@apptmp}/sample_project/app/app.rb")
462
+ assert_dir_exists("#{@apptmp}/sample_project/app/stylesheets")
453
463
  end
454
464
 
455
465
  should "properly generate for less" do
456
- buffer = silence_logger { generate(:project, 'sample_project', '--root=/tmp', '--renderer=haml','--script=none','--stylesheet=less') }
457
- assert_match_in_file(/gem 'less'/, '/tmp/sample_project/Gemfile')
458
- assert_match_in_file(/gem 'rack-less'/, '/tmp/sample_project/Gemfile')
459
- assert_match_in_file(/module LessInitializer.*Rack::Less/m, '/tmp/sample_project/lib/less_init.rb')
460
- assert_match_in_file(/register LessInitializer/m, '/tmp/sample_project/app/app.rb')
461
- assert_dir_exists('/tmp/sample_project/app/stylesheets')
466
+ buffer = silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '--renderer=haml','--script=none','--stylesheet=less') }
467
+ assert_match_in_file(/gem 'less'/, "#{@apptmp}/sample_project/Gemfile")
468
+ assert_match_in_file(/gem 'rack-less'/, "#{@apptmp}/sample_project/Gemfile")
469
+ assert_match_in_file(/module LessInitializer.*Rack::Less/m, "#{@apptmp}/sample_project/lib/less_init.rb")
470
+ assert_match_in_file(/register LessInitializer/m, "#{@apptmp}/sample_project/app/app.rb")
471
+ assert_dir_exists("#{@apptmp}/sample_project/app/stylesheets")
462
472
  end
463
473
 
464
474
  should "properly generate for compass" do
465
- buffer = silence_logger { generate(:project, 'sample_project', '--root=/tmp', '--renderer=haml','--script=none','--stylesheet=compass') }
466
- assert_match_in_file(/gem 'compass'/, '/tmp/sample_project/Gemfile')
467
- assert_match_in_file(/Compass.configure_sass_plugin\!/, '/tmp/sample_project/lib/compass_plugin.rb')
468
- assert_match_in_file(/module CompassInitializer.*Sass::Plugin::Rack/m, '/tmp/sample_project/lib/compass_plugin.rb')
469
- assert_match_in_file(/register CompassInitializer/m, '/tmp/sample_project/app/app.rb')
475
+ buffer = silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '--renderer=haml','--script=none','--stylesheet=compass') }
476
+ assert_match_in_file(/gem 'compass'/, "#{@apptmp}/sample_project/Gemfile")
477
+ assert_match_in_file(/Compass.configure_sass_plugin\!/, "#{@apptmp}/sample_project/lib/compass_plugin.rb")
478
+ assert_match_in_file(/module CompassInitializer.*Sass::Plugin::Rack/m, "#{@apptmp}/sample_project/lib/compass_plugin.rb")
479
+ assert_match_in_file(/register CompassInitializer/m, "#{@apptmp}/sample_project/app/app.rb")
470
480
 
471
- assert_file_exists('/tmp/sample_project/app/stylesheets/application.scss')
472
- assert_file_exists('/tmp/sample_project/app/stylesheets/partials/_base.scss')
481
+ assert_file_exists("#{@apptmp}/sample_project/app/stylesheets/application.scss")
482
+ assert_file_exists("#{@apptmp}/sample_project/app/stylesheets/partials/_base.scss")
473
483
  end
474
484
 
475
485
  should "properly generate for scss" do
476
- buffer = silence_logger { generate(:project, 'sample_project', '--root=/tmp', '--renderer=haml','--script=none','--stylesheet=scss') }
477
- assert_match_in_file(/gem 'haml'/, '/tmp/sample_project/Gemfile')
478
- assert_match_in_file(/module ScssInitializer.*Sass::Plugin::Rack/m, '/tmp/sample_project/lib/scss_init.rb')
479
- assert_match_in_file(/Sass::Plugin.options\[:syntax\] = :scss/m, '/tmp/sample_project/lib/scss_init.rb')
480
- assert_match_in_file(/register ScssInitializer/m, '/tmp/sample_project/app/app.rb')
481
- assert_dir_exists('/tmp/sample_project/app/stylesheets')
486
+ buffer = silence_logger { generate(:project, 'sample_project', "--root=#{@apptmp}", '--renderer=haml','--script=none','--stylesheet=scss') }
487
+ assert_match_in_file(/gem 'haml'/, "#{@apptmp}/sample_project/Gemfile")
488
+ assert_match_in_file(/module ScssInitializer.*Sass::Plugin::Rack/m, "#{@apptmp}/sample_project/lib/scss_init.rb")
489
+ assert_match_in_file(/Sass::Plugin.options\[:syntax\] = :scss/m, "#{@apptmp}/sample_project/lib/scss_init.rb")
490
+ assert_match_in_file(/register ScssInitializer/m, "#{@apptmp}/sample_project/app/app.rb")
491
+ assert_dir_exists("#{@apptmp}/sample_project/app/stylesheets")
482
492
  end
483
493
 
484
494
  end