Skip to content

Commit

Permalink
Use run_simple vs run to execute commands
Browse files Browse the repository at this point in the history
* run_simple tests that the command was successful
  • Loading branch information
Greg Lazarev committed Jan 2, 2013
1 parent 2bb5d08 commit 72b557a
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions features/step_definitions/suspenders_steps.rb
Expand Up @@ -2,45 +2,38 @@

When 'I run rake' do
in_current_dir do
run 'bundle exec rake'
run_simple 'bundle exec rake'
end
end

When 'I run the rake task "$task_name"' do |task_name|
in_current_dir do
run "bundle exec rake #{task_name}"
assert_exit_status(0)
run_simple "bundle exec rake #{task_name}"
end
end

When 'I generate "$generator_with_args"' do |generator_with_args|
in_current_dir do
run "bundle exec rails generate #{generator_with_args}"
run_simple "bundle exec rails generate #{generator_with_args}"
end
end

Then 'I see a successful response in the shell' do
assert_exit_status(0)
end

When 'I ensure no databases exist for "$project_name"' do |project_name|
run "dropdb #{project_name}_development"
run "dropdb #{project_name}_test"
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)
run_simple "#{suspenders_bin} #{project_name}"
end

When /^I suspend a project called "([^"]*)" with:$/ do |project_name, arguments_table|
suspenders_bin = File.expand_path(File.join('..', '..', 'bin', 'suspenders'), File.dirname(__FILE__))
arguments = arguments_table.hashes.inject([]) do |accum, argument|
accum << "#{argument['argument']}=#{argument['value']}"
end.join
run "#{suspenders_bin} #{project_name} #{arguments}"
assert_exit_status(0)
run_simple "#{suspenders_bin} #{project_name} #{arguments}"
end

When 'I cd to the "$test_project" root' do |dirname|
Expand All @@ -53,7 +46,6 @@
And I run the rake task "db:migrate"
And I run the rake task "db:test:prepare"
And I run rake
Then I see a successful response in the shell
}
end

Expand Down

0 comments on commit 72b557a

Please sign in to comment.