Skip to content
This repository has been archived by the owner on Jun 8, 2019. It is now read-only.

Commit

Permalink
Move pre-compilation task into its own feature.
Browse files Browse the repository at this point in the history
This also removes a lot of nested Cucumber steps.
  • Loading branch information
Gabe Berke-Williams committed Oct 22, 2011
1 parent 7ca5108 commit caeb62a
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 35 deletions.
26 changes: 0 additions & 26 deletions features/kumade_without_jammit.feature
Expand Up @@ -12,29 +12,3 @@ Feature: Kumade without jammit
Scenario: Jammit packager does not run if Jammit is not installed
When I run kumade with "pretend-staging"
Then the output should not contain "==> ! Error: Jammit::MissingConfiguration"

Scenario: Run custom task if it exists
Given I write to "Rakefile" with:
"""
namespace :kumade do
task :before_asset_compilation do
puts 'Hi!'
end
end
"""
When I run kumade with "pretend-staging"
Then the output should contain "Running rake task: kumade:before_asset_compilation"
And the output should contain "Hi!"

Scenario: Don't run rake task in pretend mode
Given I write to "Rakefile" with:
"""
namespace :kumade do
task :before_asset_compilation do
puts 'Hi!'
end
end
"""
When I run kumade with "pretend-staging -p"
Then the output should contain "Running rake task: kumade:before_asset_compilation"
And the output should not contain "Hi!"
29 changes: 29 additions & 0 deletions features/rake_task_before_asset_compilation.feature
@@ -0,0 +1,29 @@
@slow @creates-remote @disable-bundler
Feature: Rake task that runs before asset compilation
As a user
I want a Rake task that runs before packaging
So that I can hook into the packaging process

Scenario: Custom task runs if Jammit is installed
Given a new Rails application with Kumade and Jammit
When I create a Heroku remote named "pretend-staging"
And I add a pre-compilation rake task that prints "Hi!"
And I run kumade with "pretend-staging"
Then the output should contain "kumade:before_asset_compilation"
And the output should contain "Hi!"

Scenario: Custom task runs if Jammit is not installed
Given a new Rails application with Kumade
When I create a Heroku remote named "pretend-staging"
And I add a pre-compilation rake task that prints "Hi!"
And I run kumade with "pretend-staging"
Then the output should contain "kumade:before_asset_compilation"
And the output should contain "Hi!"

Scenario: Pre-asset compilation task does not run when pretending
Given a new Rails application with Kumade and Jammit
When I create a Heroku remote named "pretend-staging"
And I add a pre-compilation rake task that prints "Hi!"
And I run kumade with "pretend-staging -p"
Then the output should contain "kumade:before_asset_compilation"
But the output should not contain "Hi!"
11 changes: 2 additions & 9 deletions features/step_definitions/rails_steps.rb
@@ -1,14 +1,7 @@
Given /^a new Rails application with Kumade$/ do
run_simple("rails new rake-tasks -T")
cd('rake-tasks')
append_to_file('Gemfile', "gem 'kumade', :path => '#{PROJECT_PATH}'")
run_bundler
set_up_git_repo
create_rails_app_with_kumade
end

Given /^a new Rails application with Kumade and Jammit$/ do
Given "a new Rails application with Kumade"
add_jammit_to_gemfile
run_bundler
set_up_git_repo
create_rails_app_with_kumade_and_jammit
end
18 changes: 18 additions & 0 deletions features/support/rails.rb
@@ -0,0 +1,18 @@
module RailsAppHelpers
def create_rails_app_with_kumade
run_simple("rails new rake-tasks -T")
cd('rake-tasks')
append_to_file('Gemfile', "gem 'kumade', :path => '#{PROJECT_PATH}'")
run_bundler
set_up_git_repo
end

def create_rails_app_with_kumade_and_jammit
create_rails_app_with_kumade
add_jammit_to_gemfile
run_bundler
commit_everything_in_repo
end
end

World(RailsAppHelpers)

0 comments on commit caeb62a

Please sign in to comment.