Skip to content

Commit

Permalink
Use aruba and clean up test suite
Browse files Browse the repository at this point in the history
  • Loading branch information
Harold Giménez committed Oct 28, 2011
1 parent bcfb05e commit 518f4d8
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 10 deletions.
4 changes: 4 additions & 0 deletions 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"
Expand All @@ -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"
Expand Down
40 changes: 30 additions & 10 deletions 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

0 comments on commit 518f4d8

Please sign in to comment.