diff --git a/features/rake_clean.feature b/features/rake_clean.feature index 51d7d0f91..3b3e1efe7 100644 --- a/features/rake_clean.feature +++ b/features/rake_clean.feature @@ -1,6 +1,9 @@ +@disable-bundler Feature: Rake works in the suspended project Scenario: Running rake in the suspended project + When I suspend a project called "test_project" + And I cd to the "test_project" root When I drop and create the required databases And I run the rake task "db:create" And I run the rake task "db:migrate" @@ -10,6 +13,7 @@ Feature: Rake works in the suspended project Scenario: Making a spec then running rake When I drop and create the required databases + And I suspend a project called "test_project" And I generate "model post title:string" And I run the rake task "db:migrate" And I run the rake task "db:test:prepare" diff --git a/features/step_definitions/shell.rb b/features/step_definitions/shell.rb index 1e4befcd6..6a7760971 100644 --- a/features/step_definitions/shell.rb +++ b/features/step_definitions/shell.rb @@ -1,24 +1,44 @@ +require 'aruba/cucumber' + +Before do + @aruba_timeout_seconds = 60 +end + +After do + FileUtils.rm_rf('test_project') +end + When 'I run the rake task "$task_name"' do |task_name| - Dir.chdir('test_project') do - system("rake #{task_name}") + in_current_dir do + run "bundle exec rake #{task_name}" end end When 'I generate "$generator_with_args"' do |generator_with_args| - Dir.chdir('test_project') do - system("rails generate #{generator_with_args}") + in_current_dir do + run "bundle exec rails generate #{generator_with_args}" end end Then 'I see a successful response in the shell' do - $?.to_i.should == 0 + assert_exit_status(0) end When 'I drop and create the required databases' do - Dir.chdir('test_project') do - system("rake db:drop RAILS_ENV=test") - system("rake db:drop") - system("rake db:create RAILS_ENV=test") - system("rake db:create") + in_current_dir do + run 'bundle exec rake db:drop RAILS_ENV=test' + run 'bundle exec rake db:drop' + run 'bundle exec rake db:create RAILS_ENV=test' + run 'bundle exec rake db:create' end end + +When 'I suspend a project called "$project_name"' do |project_name| + suspenders_bin = File.expand_path(File.join('..', '..', 'bin', 'suspenders'), File.dirname(__FILE__)) + run "#{suspenders_bin} #{project_name}" + assert_exit_status(0) +end + +When 'I cd to the "$test_project" root' do |dirname| + cd dirname +end