Skip to content

Commit

Permalink
Adding start.feature to house all scenarios related to starting cards…
Browse files Browse the repository at this point in the history
…. Removing bug/chore/feature.feature

[contributes #1]
  • Loading branch information
zdennis committed Mar 31, 2012
1 parent 27694cd commit 41b6349
Show file tree
Hide file tree
Showing 5 changed files with 114 additions and 138 deletions.
42 changes: 0 additions & 42 deletions features/bug.feature

This file was deleted.

44 changes: 0 additions & 44 deletions features/chore.feature

This file was deleted.

52 changes: 0 additions & 52 deletions features/feature.feature

This file was deleted.

99 changes: 99 additions & 0 deletions features/start.feature
@@ -0,0 +1,99 @@
Feature: git start

In order to start the next available card in the project you can issue the following
commands:

git start <options>
git start <card_type> <options>

Supported options:
-k <api_key> - specify the Pivotal API key to use. Overrides configuration.
-p <project_id> - specify the Pivotal project id to use. Overrides configuration.
-D - do not prompt for user input, use recommended values by default.

This will check out a topic branch for the card and place you on it.

Scenario Outline: Executing with no settings
When I run `<command>`
Then the output should contain:
"""
Pivotal Tracker API Token and Project ID are required
"""
And the exit status should be 1

Examples:
| command |
| git-bug |
| git-chore |
| git-feature |

Scenario: Starting the next feature when it is unestimated
Given I have an unestimated Pivotal Tracker feature
And I have configured the Git repos for Pivotal
When I run `git-feature -D`
Then the output should contain:
"""
Stories in the started state must be estimated.
"""
And the exit status should be 1

# Assumption: that chores can be started without being estimated in Pivotal
Scenario: Starting the next chore when it is unestimated
Given I have an unestimated Pivotal Tracker chore
And I have configured the Git repos for Pivotal
When I run `git-chore -D`
Then the output should contain "Switched to a new branch 'CURRENT_CHORE-chore'"
And I should be on the "CURRENT_CHORE-chore" branch
And card CURRENT_CHORE is marked is started in Pivotal Tracker

# Assumption: that estimating bugs in Pivotal is turned off
Scenario: Starting the next bug when it is unestimated
Given I have an unestimated Pivotal Tracker bug
And I have configured the Git repos for Pivotal
When I run `git-bug -D`
Then the output should contain "Switched to a new branch 'CURRENT_CARD-bugfix'"
And I should be on the "CURRENT_CARD-bugfix" branch
And card CURRENT_BUG is marked is started in Pivotal Tracker

Scenario Outline: Starting the next estimated card interactively (without -D option)
Given I have a Pivotal Tracker <card_type>
And I have configured the Git repos for Pivotal
When I run `git-<card_type>` interactively
And I type "a_purple_<card_type>"
Then the output should contain "Switched to a new branch 'CURRENT_CARD-a_purple_<card_type>'"
And I should be on the "CURRENT_CARD-a_purple_<card_type>" branch
And card CURRENT_BUG is marked is started in Pivotal Tracker

Examples:
| card_type |
| bug |
| chore |
| feature |

Scenario Outline: Starting the next estimated card using configured defaults (with -D option)
Given I have a Pivotal Tracker <card_type>
And I have configured the Git repos for Pivotal
When I run `git-<card_type> -D`
Then the output should contain "Switched to a new branch 'CURRENT_CARD-<card_type><branch_suffix>'"
And I should be on the "CURRENT_CARD-<card_type><branch_suffix>" branch
And card CURRENT_CARD is marked is started in Pivotal Tracker

Examples:
| card_type | branch_suffix |
| bug | fix |
| chore | |
| feature | |

Scenario Outline: Supplying Pivotal configuration via command line arguments
Given I have a Pivotal Tracker <card_type>
And I have configured the Git repos for Pivotal with bogus information
When I run `git-<card_type> -k PIVOTAL_API_KEY -p PIVOTAL_TEST_PROJECT -n "PIVOTAL_USER" -D`
Then the output should contain "Switched to a new branch 'CURRENT_CARD-<card_type><branch_suffix>'"
And I should be on the "CURRENT_CARD-<card_type><branch_suffix>" branch
And card CURRENT_CARD is marked is started in Pivotal Tracker

Examples:
| card_type | branch_suffix |
| bug | fix |
| chore | |
| feature | |
15 changes: 15 additions & 0 deletions features/step_definitions/steps.rb
Expand Up @@ -22,12 +22,27 @@
EOT
end

Given /^I have configured the Git repos for Pivotal with bogus information$/ do
step %|a file named ".gitconfig" with:|, <<-EOT.gsub!(/^\s+\S/, '')
|[pivotal]
| api-token = badtoken
| full-name = Bad Joe
| integration-branch = whoknows
| project-id = something
EOT
end

Given /^I have a(?:n)? (#{STORY_STATE})?\s?Pivotal Tracker (#{STORY_TYPE})$/ do |status, type|
options = {}
options[:current_state] = status if status
create_test_story type, options
end

Given /^I have a(?:n)? unestimated \s?Pivotal Tracker (#{STORY_TYPE})$/ do |type|
options = { :estimate => -1 }
create_test_story type, options
end

Given /^I have a(?:n)? (#{STORY_STATE})?\s?Pivotal Tracker (#{STORY_TYPE}) named "([^"]+)" with description "([^"]+)"$/ do |status, type, name, description|
options = { :name => name, :description => description }
options[:current_state] = status if status
Expand Down

0 comments on commit 41b6349

Please sign in to comment.