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

Commit

Permalink
Move git into its own feature.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabe Berke-Williams committed Oct 22, 2011
1 parent cf370c1 commit 13469e2
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 20 deletions.
19 changes: 19 additions & 0 deletions features/git.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
@creates-remote @disable-bundler
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"
18 changes: 0 additions & 18 deletions features/kumade_executable.feature
Original file line number Diff line number Diff line change
Expand Up @@ -61,21 +61,3 @@ Feature: Kumade executable
==> 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"
19 changes: 17 additions & 2 deletions features/step_definitions/git_steps.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
After("@creates-remote") do
remove_all_created_remotes
end

When /^I create a Heroku remote named "([^"]*)"$/ do |remote_name|
add_heroku_remote_named(remote_name)
end
Expand All @@ -18,6 +22,17 @@
end
end

After("@creates-remote") do
remove_all_created_remotes
When /^I create an untracked file$/ do
write_file("untracked-file", "anything")
end

When /^I modify a tracked file$/ do
steps %{
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"
}
end
10 changes: 10 additions & 0 deletions features/step_definitions/kumade_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,13 @@
load(file)
end
end

Given /^a directory set up for kumade$/ do
steps %{
Given a directory named "the-kumade-directory"
When I cd to "the-kumade-directory"
And I set up the Gemfile with kumade
And I bundle
And I set up a git repo
}
end

0 comments on commit 13469e2

Please sign in to comment.