Permalink
Browse files

Move pre-compilation task into its own feature.

This also removes a lot of nested Cucumber steps.
  • Loading branch information...
1 parent 7ca5108 commit caeb62ad0a8ceb6631642f56631a67472693a55d @gabebw gabebw committed Oct 22, 2011
@@ -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!"
@@ -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!"
@@ -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
@@ -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.