Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Git#push when remote does not exist returns silently #75

Closed
wants to merge 19 commits into from

3 participants

@bryan-ash

Allows kumade to work without an 'origin' remote.

Closes #65

This branch is newly created from todays HEAD. This was trivial to do after you cleaned up the specs and scenarios ... thank you!

@gabebw
Owner

Thanks for the compliment :)

I'll take a look at this tomorrow, probably. Right now I'm deep in Cucumber, cleaning up the specs even more.

@mike-burns
Owner

@bryan-ash this diff is now hard to read. Can you rebase and maybe submit a new pull request (if needed).

Thanks,
-Mike

@bryan-ash

I totally agree, my Git-fu is weak.

Can you recommend a workflow that would help me contribute more cleanly in the future?

@mike-burns
Owner
git fetch
git rebase origin/master
git push -f

To streamline your workflow you may want to use some of these aliases: http://robots.thoughtbot.com/post/4747482956/streamline-your-git-workflow-with-aliases

@bryan-ash

Closing this pull request in favor of the new and improved one just opened

@bryan-ash bryan-ash closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 22, 2011
  1. @gabebw
  2. @gabebw

    Move git into its own feature.

    gabebw authored
  3. @gabebw
  4. @bryan-ash
  5. @gabebw

    Move pre-compilation task into its own feature.

    gabebw authored
    This also removes a lot of nested Cucumber steps.
  6. @gabebw
  7. @gabebw

    Clean up main feature.

    gabebw authored
  8. @gabebw

    Add feature for NoopPackager

    gabebw authored
  9. @gabebw

    Rails is a dependency.

    gabebw authored
  10. @gabebw

    Remove unused Cucumber steps.

    gabebw authored
  11. @gabebw

    Package untracked asset files.

    gabebw authored
  12. @gabebw

    Test Jammit packager against a real Rails app.

    gabebw authored
    It now detects untracked asset files and commits them.
  13. @gabebw
  14. @gabebw

    Ignore ctags file.

    gabebw authored
  15. @gabebw
  16. @gabebw

    Always disable bundler.

    gabebw authored
Commits on Oct 28, 2011
  1. @gabebw
  2. @gabebw

    NoopPackager should never run.

    gabebw authored
Commits on Nov 3, 2011
  1. @bryan-ash
This page is out of date. Refresh to see the latest.
Showing with 317 additions and 161 deletions.
  1. +1 −0  .gitignore
  2. +23 −0 features/git.feature
  3. +20 −0 features/jammit.feature
  4. +8 −59 features/kumade_executable.feature
  5. +3 −33 features/kumade_without_jammit.feature
  6. +18 −0 features/no_op_packager.feature
  7. +1 −1  features/railtie.feature
  8. +28 −0 features/rake_task_before_asset_compilation.feature
  9. +3 −25 features/step_definitions/bundler_steps.rb
  10. +0 −3  features/step_definitions/dependency_steps.rb
  11. +20 −8 features/step_definitions/git_steps.rb
  12. +3 −0  features/step_definitions/jammit_steps.rb
  13. +11 −5 features/step_definitions/kumade_steps.rb
  14. +10 −3 features/step_definitions/rails_steps.rb
  15. +12 −0 features/step_definitions/rake_steps.rb
  16. +10 −1 features/support/bundler.rb
  17. +3 −0  features/support/disable_bundler.rb
  18. +21 −0 features/support/git.rb
  19. +15 −0 features/support/git_remotes.rb
  20. +14 −0 features/support/jammit.rb
  21. +18 −0 features/support/rails.rb
  22. +1 −2  kumade.gemspec
  23. +7 −0 lib/kumade/git.rb
  24. +5 −3 lib/kumade/packager.rb
  25. +55 −16 spec/kumade/git_spec.rb
  26. +2 −2 spec/kumade/packager_spec.rb
  27. +5 −0 spec/support/git.rb
View
1  .gitignore
@@ -7,3 +7,4 @@ tmp/
*.sw[op]
.rvmrc
coverage/
+tags
View
23 features/git.feature
@@ -0,0 +1,23 @@
+Feature: Git cleanliness
+ As a user
+ I want Kumade to check if git is clean before deploying
+ So that I don't accidentally leave leave local changes behind
+
+ Background:
+ Given a directory set up for kumade
+ When I create a Heroku remote named "pretend-staging"
+
+ Scenario: Git is clean if there are untracked files
+ When I create an untracked file
+ And I run kumade with "pretend-staging"
+ Then the output should not contain "==> ! Cannot deploy: repo is not clean"
+
+ Scenario: Git is not clean if a tracked file is modified
+ When I modify a tracked file
+ And I run kumade with "pretend-staging"
+ Then the output should contain "==> ! Cannot deploy: repo is not clean"
+
+ Scenario: Git repo is always clean when pretending
+ Given a dirty repo
+ When I run kumade with "pretend-staging -p"
+ Then the output should contain "==> Git repo is clean"
View
20 features/jammit.feature
@@ -0,0 +1,20 @@
+@slow
+Feature: Jammit
+ As a user
+ I want Kumade to auto-package with Jammit
+ So that I don't have to remember to package assets
+
+ Background:
+ Given a new Rails application with Kumade and Jammit
+ When I configure my Rails app for Jammit
+ And I create a Heroku remote named "staging"
+
+ Scenario: Jammit packager runs if Jammit is installed
+ When I run kumade
+ Then the output should contain "==> Packaged with Kumade::JammitPackager"
+
+ Scenario: Run custom task before jammit
+ When I add a pre-compilation rake task that prints "Hi!"
+ And I run kumade
+ Then the output should contain "kumade:before_asset_compilation"
+ And the output should contain "Hi!"
View
67 features/kumade_executable.feature
@@ -1,17 +1,12 @@
-@slow @creates-remote @disable-bundler
+@slow
Feature: Kumade executable
As a user
I want to be able to use the kumade executable
So I can have a better experience than Rake provides
Background:
- Given a directory named "executable"
- And I cd to "executable"
- And I set up the Gemfile with kumade
- And I add "jammit" to the Gemfile
- And I bundle
- When I set up a git repo
- And I create a Heroku remote named "pretend-staging"
+ Given a new Rails application with Kumade and Jammit
+ When I create a Heroku remote named "pretend-staging"
And I create a Heroku remote named "staging"
And I create a non-Heroku remote named "bad-remote"
@@ -36,7 +31,7 @@ Feature: Kumade executable
When I run kumade with "-p"
Then the output should contain "==> Deployed to: staging"
- Scenario: Can deploy to arbitrary environment
+ Scenario: Deploying to an arbitrary environment fails
When I run kumade with "bamboo"
Then the output should contain "==> Deploying to: bamboo"
And the output should match /Cannot deploy: /
@@ -45,54 +40,8 @@ Feature: Kumade executable
When I run kumade with "bad-remote"
Then the output should match /==> ! Cannot deploy: "bad-remote" remote does not point to Heroku/
- Scenario: Deploy from another branch
- When I run `git checkout -b new_branch`
+ Scenario: Deploy from a branch that isn't "master"
+ When I switch to the "new_branch" branch
And I run kumade with "pretend-staging -p"
- Then the output should contain:
- """
- ==> Git repo is clean
- ==> Packaged with Kumade::JammitPackager
- git push origin new_branch
- ==> Pushed new_branch -> origin
- git branch deploy >/dev/null
- git push -f pretend-staging deploy:master
- ==> Pushed deploy:master -> pretend-staging
- ==> Migrated pretend-staging
- ==> Restarted pretend-staging
- ==> Deployed to: pretend-staging
- """
-
- Scenario: Git is clean if there are untracked files
- Given I write to "new-file" with:
- """
- clean
- """
- When I run kumade with "pretend-staging"
- Then the output from "bundle exec kumade pretend-staging" should not contain "==> ! Cannot deploy: repo is not clean"
-
- Scenario: Git is not clean if a tracked file is modified
- Given I write to "new-file" with:
- """
- clean
- """
- And I commit everything in the current repo
- When I append to "new-file" with "dirty it up"
- And I run kumade with "pretend-staging"
- Then the output from "bundle exec kumade pretend-staging" should contain "==> ! Cannot deploy: repo is not clean"
-
- Scenario: Jammit packager runs if Jammit is installed
- When I run kumade with "pretend-staging"
- Then the output from "bundle exec kumade pretend-staging" should contain "==> ! Error: Jammit::MissingConfiguration"
-
- Scenario: Run custom task before jammit
- 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 "kumade:before_asset_compilation"
- And the output should contain "==> Packaged with Kumade::JammitPackager"
+ Then the output should contain "==> Pushed new_branch -> origin"
+ And the output should contain "==> Deployed to: pretend-staging"
View
36 features/kumade_without_jammit.feature
@@ -1,40 +1,10 @@
-@slow @creates-remote @disable-bundler
+@slow
Feature: Kumade without jammit
Background:
- Given a directory named "executable"
- And I cd to "executable"
- And I set up the Gemfile with kumade
- And I bundle
- When I set up a git repo
- And I create a Heroku remote named "pretend-staging"
+ Given a directory set up for kumade
+ When I create a Heroku remote named "pretend-staging"
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!"
View
18 features/no_op_packager.feature
@@ -0,0 +1,18 @@
+@slow
+Feature: No-op packager
+ As a user
+ I want Kumade to gracefully handle occasions when I have no assets to package
+ So that I am not forced to package my assets
+
+ Background:
+ Given a new Rails application with Kumade
+ When I create a Heroku remote named "staging"
+
+ Scenario: No-op packager does not run in pretend mode if Jammit is not installed
+ When I run kumade with "staging -p"
+ Then the output should not contain "==> Packaged with Kumade::NoopPackager"
+
+ Scenario: No-op packager does not run in normal mode if Jammit is not installed
+ When I add the origin remote
+ And I run kumade
+ Then the output should not contain "==> Packaged with Kumade::NoopPackager"
View
2  features/railtie.feature
@@ -3,7 +3,7 @@ Feature: Railtie
I want Kumade to autoload Rake tasks for my Rails application
So that I can integrate Kumade with other Rake tasks
- @creates-remote @disable-bundler @slow
+ @slow
Scenario: Rake tasks are loaded
Given a new Rails application with Kumade
When I create a Heroku remote named "staging"
View
28 features/rake_task_before_asset_compilation.feature
@@ -0,0 +1,28 @@
+@slow
+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 does not run 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 not contain "kumade:before_asset_compilation"
+
+ 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!"
View
28 features/step_definitions/bundler_steps.rb
@@ -2,32 +2,10 @@
run_bundler
end
-When /^I rebundle$/ do
- steps %{
- When I bundle
- And I commit everything in the current repo
- }
-end
-
-Given /^an empty Gemfile$/ do
- When %{I write to "Gemfile" with:}, ""
-end
-
When /^I set up the Gemfile with kumade$/ do
- steps %{
- When I write to "Gemfile" with:
- """
- gem 'kumade', :path => '../../..'
- """
- }
+ add_kumade_to_gemfile
end
-When /^I add "([^"]+)" to the Gemfile$/ do |gem|
- steps %{
- When I append to "Gemfile" with:
- """
-
- gem '#{gem}'
- """
- }
+When /^I add "jammit" to the Gemfile$/ do
+ add_jammit_to_gemfile
end
View
3  features/step_definitions/dependency_steps.rb
@@ -1,3 +0,0 @@
-When /^I add "([^"]*)" from this project as a dependency$/ do |gem_name|
- append_to_file('Gemfile', %{\ngem "#{gem_name}", :path => "#{PROJECT_ROOT}"})
-end
View
28 features/step_definitions/git_steps.rb
@@ -7,17 +7,29 @@
end
When /^I set up a git repo$/ do
- ["git init", "touch .gitkeep", "git add .", "git commit -am First"].each do |git_command|
- run_simple(git_command)
- end
+ set_up_git_repo
end
When /^I commit everything in the current repo$/ do
- ['git add .', 'git commit -am MY_MESSAGE'].each do |git_command|
- run_simple(git_command)
- end
+ commit_everything_in_repo
end
-After("@creates-remote") do
- remove_all_created_remotes
+When /^I create an untracked file$/ do
+ write_file("untracked-file", "anything")
+end
+
+Given /^a dirty repo$/ do
+ modify_tracked_file
+end
+
+When /^I modify a tracked file$/ do
+ modify_tracked_file
+end
+
+When /^I add the origin remote$/ do
+ add_origin_remote
+end
+
+When /^I switch to the "([^"]+)" branch$/ do |branch_name|
+ run_simple("git checkout -b #{branch_name}")
end
View
3  features/step_definitions/jammit_steps.rb
@@ -0,0 +1,3 @@
+When /^I set up Jammit$/ do
+ set_up_jammit
+end
View
16 features/step_definitions/kumade_steps.rb
@@ -1,9 +1,15 @@
+When /^I run kumade$/ do
+ run_simple("bundle exec kumade", must_be_successful = false)
+end
+
When /^I run kumade with "([^"]+)"$/ do |args|
- When %{I run `bundle exec kumade #{args}`}
+ run_simple("bundle exec kumade #{args}", must_be_successful = false)
end
-Given /^I have loaded "([^"]+)"$/ do |file|
- in_current_dir do
- load(file)
- end
+Given /^a directory set up for kumade$/ do
+ create_dir('the-kumade-directory')
+ cd('the-kumade-directory')
+ add_kumade_to_gemfile
+ run_bundler
+ set_up_git_repo
end
View
13 features/step_definitions/rails_steps.rb
@@ -1,6 +1,13 @@
Given /^a new Rails application with Kumade$/ do
- run_simple("rails new rake-tasks")
- cd('rake-tasks')
- append_to_file('Gemfile', "gem 'kumade', :path => '#{PROJECT_PATH}'")
+ create_rails_app_with_kumade
+end
+
+Given /^a new Rails application with Kumade and Jammit$/ do
+ create_rails_app_with_kumade_and_jammit
+end
+
+When /^I configure my Rails app for Jammit$/ do
run_bundler
+ set_up_jammit
+ add_origin_remote
end
View
12 features/step_definitions/rake_steps.rb
@@ -24,3 +24,15 @@
Then the output from "bundle exec rake -T" should not contain "#{task_name}"
}
end
+
+When /^I add a pre-compilation rake task that prints "Hi!"$/ do
+ append_to_file("Rakefile", <<-CUSTOM_TASK)
+ namespace :kumade do
+ task :before_asset_compilation do
+ puts 'Hi!'
+ end
+ end
+ CUSTOM_TASK
+
+ commit_everything_in_repo
+end
View
11 features/support/bundler.rb
@@ -1,6 +1,15 @@
module BundlerHelpers
def run_bundler
- run_simple('bundle --gemfile=./Gemfile --local || bundle --gemfile=./Gemfile')
+ bundle = 'bundle install'
+ run_simple("#{bundle} --local || #{bundle}")
+ end
+
+ def add_jammit_to_gemfile
+ append_to_file('Gemfile', "\ngem 'jammit'")
+ end
+
+ def add_kumade_to_gemfile
+ append_to_file('Gemfile', "\ngem 'kumade', :path => '../../..'")
end
end
View
3  features/support/disable_bundler.rb
@@ -0,0 +1,3 @@
+Before do
+ unset_bundler_env_vars
+end
View
21 features/support/git.rb
@@ -0,0 +1,21 @@
+module GitHelpers
+ def set_up_git_repo
+ ["git init", "touch .gitkeep", "git add .", "git commit -am First"].each do |git_command|
+ run_simple(git_command)
+ end
+ end
+
+ def commit_everything_in_repo(message = "MY_MESSAGE")
+ ['git add .', "git commit -am '#{message}'"].each do |git_command|
+ run_simple(git_command)
+ end
+ end
+
+ def modify_tracked_file
+ write_file('tracked-file', 'clean')
+ commit_everything_in_repo('modify tracked file')
+ append_to_file('tracked-file', 'dirty it up')
+ end
+end
+
+World(GitHelpers)
View
15 features/support/git_remotes.rb
@@ -20,6 +20,21 @@ def add_non_heroku_remote_named(remote_name)
run_simple("git remote add #{remote_name} git@github.com:gabebw/kumade.git")
@@created_remotes << remote_name
end
+
+ def add_origin_remote
+ original_dir = current_dir
+ create_dir("../origin")
+ cd("../origin")
+ run_simple("git init --bare")
+
+ cd("../#{File.basename(original_dir)}")
+ run_simple("git remote add origin ../origin")
+ @@created_remotes << 'origin'
+ end
end
World(GitRemoteHelpers)
+
+After do
+ remove_all_created_remotes
+end
View
14 features/support/jammit.rb
@@ -0,0 +1,14 @@
+module JammitHelpers
+ def set_up_jammit
+ assets_yaml = <<-YAML.strip
+ javascripts:
+ default:
+ - public/javascripts/application.js
+ YAML
+ write_file('public/javascripts/application.js', 'var foo = 3;')
+ write_file('config/assets.yml', assets_yaml)
+ commit_everything_in_repo('add Jammit files')
+ end
+end
+
+World(JammitHelpers)
View
18 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)
View
3  kumade.gemspec
@@ -19,13 +19,12 @@ Gem::Specification.new do |s|
s.add_dependency('heroku', '~> 2.0')
s.add_dependency('rake', '>= 0.8.7')
s.add_dependency('cocaine', '>= 0.2.0')
+ s.add_dependency('rails', '>= 2')
- s.add_development_dependency('rake', '>= 0.8.7')
s.add_development_dependency('rspec', '~> 2.6.0')
s.add_development_dependency('cucumber', '~> 1.0.2')
s.add_development_dependency('aruba', '~> 0.4.3')
s.add_development_dependency('jammit', '~> 0.6.3')
- s.add_development_dependency('less', '~> 2.0')
s.add_development_dependency('bourne')
if RUBY_VERSION >= '1.9.0'
s.add_development_dependency('simplecov')
View
7 lib/kumade/git.rb
@@ -11,6 +11,7 @@ def self.environments
end
def push(branch, remote = 'origin', force = false)
+ return unless remote_exists?(remote)
command = ["git push"]
command << "-f" if force
command << remote
@@ -68,6 +69,12 @@ def ensure_clean_git
end
end
+ def has_untracked_files_in?(directory)
+ relative_dir = directory.sub(Dir.pwd + '/', '')
+ untracked_output = CommandLine.new("git status --porcelain --untracked-files").run
+ untracked_output.split("\n").grep(/^\?{2} #{relative_dir}/).size > 0
+ end
+
private
def has_branch?(branch)
View
8 lib/kumade/packager.rb
@@ -6,8 +6,10 @@ def initialize(git, packager = Packager.available_packager)
end
def run
- precompile_assets
- package
+ if @packager.installed?
+ precompile_assets
+ package
+ end
end
def self.available_packager
@@ -25,7 +27,7 @@ def package
begin
@packager.package
- if @git.dirty?
+ if @git.dirty? || @git.has_untracked_files_in?(@packager.assets_path)
@git.add_and_commit_all_assets_in(@packager.assets_path)
Kumade.configuration.outputter.success(success_message)
end
View
71 spec/kumade/git_spec.rb
@@ -43,27 +43,42 @@
describe Kumade::Git, "#push", :with_mock_outputter do
let(:branch) { 'branch' }
let(:remote) { 'my-remote' }
- let(:command_line) { stub("Kumade::CommandLine instance", :run_or_error => true) }
- before do
- Kumade::CommandLine.stubs(:new => command_line)
- end
+ context "when the remote exists" do
+ let(:command_line) { stub("Kumade::CommandLine instance", :run_or_error => true) }
- it "pushes to the correct remote" do
- subject.push(branch, remote)
- Kumade::CommandLine.should have_received(:new).with("git push #{remote} #{branch}")
- command_line.should have_received(:run_or_error).once
- end
+ before do
+ Kumade::CommandLine.stubs(:new => command_line)
+ subject.stubs(:remote_exists? => true)
+ end
+
+ it "pushes to the correct remote" do
+ subject.push(branch, remote)
+ Kumade::CommandLine.should have_received(:new).with("git push #{remote} #{branch}")
+ command_line.should have_received(:run_or_error).once
+ end
+
+ it "can force push" do
+ subject.push(branch, remote, true)
+ Kumade::CommandLine.should have_received(:new).with("git push -f #{remote} #{branch}")
+ command_line.should have_received(:run_or_error).once
+ end
- it "can force push" do
- subject.push(branch, remote, true)
- Kumade::CommandLine.should have_received(:new).with("git push -f #{remote} #{branch}")
- command_line.should have_received(:run_or_error).once
+ it "prints a success message" do
+ subject.push(branch, remote)
+ Kumade.configuration.outputter.should have_received(:success).with("Pushed #{branch} -> #{remote}")
+ end
end
- it "prints a success message" do
- subject.push(branch, remote)
- Kumade.configuration.outputter.should have_received(:success).with("Pushed #{branch} -> #{remote}")
+ context "when the remote does not exist" do
+ before do
+ subject.stubs(:remote_exists? => false)
+ end
+
+ it "returns silently" do
+ subject.push(branch)
+ Kumade::CommandLine.should have_received(:new).never
+ end
end
end
@@ -227,3 +242,27 @@
end
end
end
+
+describe Kumade::Git, "#has_untracked_files_in?", :with_mock_outputter do
+ let(:untracked_dir) { 'untracked' }
+
+ context "in normal mode" do
+ before do
+ Kumade.configuration.pretending = false
+ create_untracked_file_in(untracked_dir)
+ end
+
+ it "detects untracked files" do
+ subject.should have_untracked_files_in(untracked_dir)
+ end
+
+ it "detects untracked files when given an absolute path" do
+ subject.should have_untracked_files_in(File.expand_path("./" + untracked_dir))
+ end
+
+ it "does not get confused by tracked files" do
+ `git add . && git commit -am Message`
+ subject.should_not have_untracked_files_in(untracked_dir)
+ end
+ end
+end
View
4 spec/kumade/packager_spec.rb
@@ -9,7 +9,7 @@
Kumade::Packager.available_packager.should == packager_1
end
- it "returns nil if no packagers are availabke" do
+ it "returns nil if no packagers are available" do
Kumade::PackagerList.stubs(:new => [])
Kumade::Packager.available_packager.should be_nil
end
@@ -17,7 +17,7 @@
describe Kumade::Packager, "#run", :with_mock_outputter do
let(:git) { stub("git", :dirty? => true, :add_and_commit_all_assets_in => true) }
- let(:packager) { stub("packager", :name => "MyPackager", :package => true, :assets_path => 'fake_assets_path') }
+ let(:packager) { stub("packager", :name => "MyPackager", :package => true, :assets_path => 'fake_assets_path', :installed? => true) }
let(:rake_task_runner) { stub("RakeTaskRunner", :invoke => true) }
before do
View
5 spec/support/git.rb
@@ -2,4 +2,9 @@ module GitHelpers
def dirty_the_repo
`echo dirty_it_up > .gitkeep`
end
+
+ def create_untracked_file_in(directory)
+ FileUtils.mkdir_p(directory)
+ FileUtils.touch(File.join(directory, 'i-am-untracked'))
+ end
end
Something went wrong with that request. Please try again.