git-pivotal-tracker-centro 1.0.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. data/.gitignore +6 -0
  2. data/.rspec +2 -0
  3. data/.rvmrc +1 -0
  4. data/.travis.yml +3 -0
  5. data/CHANGELOG +54 -0
  6. data/Gemfile +3 -0
  7. data/Gemfile.lock +82 -0
  8. data/LICENSE +21 -0
  9. data/Rakefile +49 -0
  10. data/VERSION +1 -0
  11. data/bin/git-finish +7 -0
  12. data/bin/git-info +7 -0
  13. data/bin/git-start +8 -0
  14. data/features/finish.feature +88 -0
  15. data/features/info.feature +99 -0
  16. data/features/start.feature +113 -0
  17. data/features/step_definitions/steps.rb +119 -0
  18. data/features/support/dsl/assertions.rb +11 -0
  19. data/features/support/dsl/data.rb +11 -0
  20. data/features/support/dsl/pivotal.rb +77 -0
  21. data/features/support/env.rb +6 -0
  22. data/features/support/git-pivotal.rb +68 -0
  23. data/features/test_repo/origin.git/COMMIT_EDITMSG +1 -0
  24. data/features/test_repo/origin.git/HEAD +1 -0
  25. data/features/test_repo/origin.git/config +8 -0
  26. data/features/test_repo/origin.git/description +1 -0
  27. data/features/test_repo/origin.git/hooks/applypatch-msg.sample +15 -0
  28. data/features/test_repo/origin.git/hooks/commit-msg.sample +24 -0
  29. data/features/test_repo/origin.git/hooks/post-commit.sample +8 -0
  30. data/features/test_repo/origin.git/hooks/post-receive.sample +15 -0
  31. data/features/test_repo/origin.git/hooks/post-update.sample +8 -0
  32. data/features/test_repo/origin.git/hooks/pre-applypatch.sample +14 -0
  33. data/features/test_repo/origin.git/hooks/pre-commit.sample +46 -0
  34. data/features/test_repo/origin.git/hooks/pre-rebase.sample +169 -0
  35. data/features/test_repo/origin.git/hooks/prepare-commit-msg.sample +36 -0
  36. data/features/test_repo/origin.git/hooks/update.sample +128 -0
  37. data/features/test_repo/origin.git/index +0 -0
  38. data/features/test_repo/origin.git/info/exclude +6 -0
  39. data/features/test_repo/origin.git/logs/HEAD +1 -0
  40. data/features/test_repo/origin.git/logs/refs/heads/master +1 -0
  41. data/features/test_repo/origin.git/objects/0c/6f7b1384910d1a2f137590095f008a06c7e00c +0 -0
  42. data/features/test_repo/origin.git/objects/10/ecf2b7ce989f01f3f7266e712b48d9275f2635 +0 -0
  43. data/features/test_repo/origin.git/objects/a5/71d56305df09fb060f6ccb730b46080d305beb +0 -0
  44. data/features/test_repo/origin.git/refs/heads/master +1 -0
  45. data/features/test_repo/readme +1 -0
  46. data/git-pivotal-tracker-centro.gemspec +29 -0
  47. data/lib/commands/base.rb +120 -0
  48. data/lib/commands/bug.rb +19 -0
  49. data/lib/commands/card.rb +32 -0
  50. data/lib/commands/chore.rb +19 -0
  51. data/lib/commands/feature.rb +19 -0
  52. data/lib/commands/finish.rb +67 -0
  53. data/lib/commands/info.rb +58 -0
  54. data/lib/commands/map.rb +10 -0
  55. data/lib/commands/pick.rb +94 -0
  56. data/lib/commands/start.rb +39 -0
  57. data/lib/git-pivotal-tracker.rb +11 -0
  58. data/readme.markdown +106 -0
  59. data/spec/commands/base_spec.rb +137 -0
  60. data/spec/commands/bug_spec.rb +24 -0
  61. data/spec/commands/chore_spec.rb +24 -0
  62. data/spec/commands/feature_spec.rb +24 -0
  63. data/spec/commands/finish_spec.rb +134 -0
  64. data/spec/commands/map_spec.rb +14 -0
  65. data/spec/commands/start_spec.rb +28 -0
  66. data/spec/factories.rb +13 -0
  67. data/spec/factory.rb +26 -0
  68. data/spec/spec_helper.rb +24 -0
  69. metadata +291 -0
data/.gitignore ADDED
@@ -0,0 +1,6 @@
1
+ pkg
2
+ coverage
3
+ *.gem
4
+ *.swp
5
+ tmp
6
+ .rbenv-version
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format progress
data/.rvmrc ADDED
@@ -0,0 +1 @@
1
+ rvm use 1.9.3
data/.travis.yml ADDED
@@ -0,0 +1,3 @@
1
+ rvm:
2
+ - 1.9.2
3
+ - 1.9.3
data/CHANGELOG ADDED
@@ -0,0 +1,54 @@
1
+ v 0.9.2
2
+ - verbose is now the default, you can turn it off in your git configuration (pivotal.verbose) or via the --no-verbose command line option
3
+
4
+ v 0.9.1
5
+ - updating git-accept to work with cards that already accepted in Pivotal
6
+
7
+ v 0.9.0
8
+ - first release of new command set: accept, block, finish, info, start, unblock
9
+
10
+ v 0.8.1
11
+ - Improve error reporting when interacting with PivotalTracker
12
+ - Add SSL project support [bunnymatic (Mr Rogers)]
13
+ - Improve method of collecting story ID from branch name
14
+
15
+ v 0.8.0
16
+ - Drop home-rolled PivotalTracker API for pivotal-tracker gem
17
+ - Add Gemfile for easier development
18
+ - Add better test suite with Cucumber and Aruba
19
+ - Add option for appending the branch name (rather than prepending) [Addy
20
+ Naik]
21
+ - Add new `git info` command [Addy Naik]
22
+
23
+ v 0.2.3
24
+ - Allow the developer to specify the integration branch for git finish [Graeme Mathieson]
25
+ - Fixed bug which prevented chores from finishing successfully [Joshua Vial]
26
+ - Added option to allow only pickup items already assigned to you [Mark Butcher]
27
+ - Fix RestClient version issues
28
+
29
+ v 0.2.2
30
+ - Added git chore command
31
+
32
+ v 0.2.1
33
+ - Remove &:to_s shortcut for MRI 1.8.6 compatibility
34
+ - Updated to handle RestClient 1.4
35
+
36
+ v 0.2.0
37
+ - Added git feature and git bug commands
38
+ - Deprecated git feature
39
+ - Improved XPath reliability for Pivotal API requests [Sam Stokes]
40
+
41
+ v 0.1.3
42
+ - Fixed bug preventing command line args from being properly interpretted
43
+
44
+ v 0.1.2
45
+ - Fixed bug introduced in v 0.1.1 which prevented git pick from completing
46
+
47
+ v 0.1.1
48
+ - Updated git pick to tell Pivotal who owns the picked feature
49
+ - Improved Pivotal Tracker framework write ability
50
+
51
+ v 0.1.0
52
+ - Initial release
53
+ - Basic framework for reading from Pivotal Tracker
54
+ - git pick utility
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "http://rubygems.org"
2
+
3
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,82 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ git-pivotal-tracker-centro (1.0.0.rc1)
5
+ pivotal-tracker
6
+
7
+ GEM
8
+ remote: http://rubygems.org/
9
+ specs:
10
+ aruba (0.4.11)
11
+ childprocess (>= 0.2.3)
12
+ cucumber (>= 1.1.1)
13
+ ffi (>= 1.0.11)
14
+ rspec (>= 2.7.0)
15
+ builder (3.0.0)
16
+ childprocess (0.3.1)
17
+ ffi (~> 1.0.6)
18
+ coderay (1.0.5)
19
+ cucumber (1.1.9)
20
+ builder (>= 2.1.2)
21
+ diff-lcs (>= 1.1.2)
22
+ gherkin (~> 2.9.0)
23
+ json (>= 1.4.6)
24
+ term-ansicolor (>= 1.0.6)
25
+ diff-lcs (1.1.3)
26
+ ffi (1.0.11)
27
+ gherkin (2.9.3)
28
+ json (>= 1.4.6)
29
+ happymapper (0.4.0)
30
+ libxml-ruby (~> 2.0)
31
+ json (1.6.6)
32
+ libxml-ruby (2.3.3)
33
+ metaclass (0.0.1)
34
+ method_source (0.7.1)
35
+ mime-types (1.19)
36
+ mocha (0.10.5)
37
+ metaclass (~> 0.0.1)
38
+ multi_json (1.2.0)
39
+ nokogiri (1.5.5)
40
+ pivotal-tracker (0.5.8)
41
+ builder
42
+ builder
43
+ happymapper (>= 0.3.2)
44
+ happymapper (>= 0.3.2)
45
+ nokogiri (>= 1.4.3)
46
+ nokogiri (~> 1.4)
47
+ rest-client (~> 1.6.0)
48
+ rest-client (~> 1.6.0)
49
+ pry (0.9.8.4)
50
+ coderay (~> 1.0.5)
51
+ method_source (~> 0.7.1)
52
+ slop (>= 2.4.4, < 3)
53
+ rake (0.9.2.2)
54
+ rest-client (1.6.7)
55
+ mime-types (>= 1.16)
56
+ rspec (2.9.0)
57
+ rspec-core (~> 2.9.0)
58
+ rspec-expectations (~> 2.9.0)
59
+ rspec-mocks (~> 2.9.0)
60
+ rspec-core (2.9.0)
61
+ rspec-expectations (2.9.0)
62
+ diff-lcs (~> 1.1.3)
63
+ rspec-mocks (2.9.0)
64
+ simplecov (0.6.1)
65
+ multi_json (~> 1.0)
66
+ simplecov-html (~> 0.5.3)
67
+ simplecov-html (0.5.3)
68
+ slop (2.4.4)
69
+ term-ansicolor (1.0.7)
70
+
71
+ PLATFORMS
72
+ ruby
73
+
74
+ DEPENDENCIES
75
+ aruba
76
+ cucumber
77
+ git-pivotal-tracker-centro!
78
+ mocha
79
+ pry
80
+ rake
81
+ rspec
82
+ simplecov
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License
2
+
3
+ Copyright (c) 2012 John Wood
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,49 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ # Set up a test Pivotal project for the Cucumber tests to use
5
+ ENV['PIVOTAL_API_KEY'] = "81f09c932c8bfd2b028ec5e52ec7cf47" # your API key
6
+ ENV['PIVOTAL_TEST_PROJECT'] = "681077" # your test project ID (123456)
7
+ ENV['PIVOTAL_USER'] = "John Wood" # Your user name (Joe Smith)
8
+
9
+ $LOAD_PATH.unshift('lib')
10
+
11
+ task :default => [:spec, :features]
12
+
13
+ task :spec do
14
+ begin
15
+ require 'rspec/core/rake_task'
16
+ RSpec::Core::RakeTask.new do |t|
17
+ t.rspec_opts = ['--color']
18
+ end
19
+ rescue LoadError => e
20
+ puts "RSpec not installed"
21
+ end
22
+ end
23
+
24
+ task :features do
25
+ begin
26
+ require 'cucumber/rake/task'
27
+
28
+ if [ENV['PIVOTAL_API_KEY'], ENV['PIVOTAL_TEST_PROJECT'], ENV['PIVOTAL_USER']].any? { |x| x.nil? || x.empty? }
29
+ raise "ERROR: API key, test project, and user must be set in the Rakefile for the Cucumber tests to run"
30
+ end
31
+
32
+ Cucumber::Rake::Task.new(:features) do |t|
33
+ t.cucumber_opts = "features --format pretty"
34
+ end
35
+ rescue LoadError => e
36
+ puts "Cucumber not installed"
37
+ end
38
+ end
39
+
40
+ task :install do
41
+ puts "Uninstalling..."
42
+ system "gem uninstall -x git-pivotal-tracker-centro"
43
+
44
+ puts "Building..."
45
+ system "gem build git-pivotal-tracker-centro.gemspec"
46
+
47
+ puts "Installing..."
48
+ system "gem install git-pivotal-tracker-centro-#{IO.read("VERSION")}"
49
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 1.0.0.rc1
data/bin/git-finish ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
4
+
5
+ require 'commands/finish'
6
+
7
+ exit Commands::Finish.new(*ARGV).with(STDIN, STDOUT).run!
data/bin/git-info ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
4
+
5
+ require 'commands/info'
6
+
7
+ exit Commands::Info.new(*ARGV).with(STDIN, STDOUT).run!
data/bin/git-start ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
4
+
5
+ require 'commands/start'
6
+
7
+ args = ARGV
8
+ exit Commands::Start.for(*ARGV).with(STDIN, STDOUT).run!
@@ -0,0 +1,88 @@
1
+ Feature: git finish
2
+
3
+ In order to finish the card for the current topic branch you can issue the following
4
+ commands:
5
+
6
+ git finish
7
+ git finish <options>
8
+
9
+ Supported options:
10
+ -k <api_key> - specify the Pivotal API key to use. Overrides configuration.
11
+ -p <project_id> - specify the Pivotal project id to use. Overrides configuration.
12
+
13
+ This will do the following:
14
+ * switch to the master branch
15
+ * delete the local branch
16
+ * delete the remote branch
17
+ * mark the card as finished in Pivotal
18
+
19
+ Background:
20
+ Given I have a started Pivotal Tracker feature
21
+ And I am on the "CURRENT_CARD-feature" branch
22
+
23
+ Scenario: Executing with no settings
24
+ When I run `git-finish --force`
25
+ Then the output should contain each line:
26
+ """
27
+ Pivotal Tracker API Token and Project ID are required
28
+ """
29
+ And the exit status should be 1
30
+
31
+ Scenario: Executing with inline settings
32
+ When I run `git-finish -k PIVOTAL_API_KEY -p PIVOTAL_TEST_PROJECT --force`
33
+ Then the output should contain each line:
34
+ """
35
+ Switching to master
36
+ Destroying local branch
37
+ Destroying remote branch
38
+ Marking Story CURRENT_CARD as finished...
39
+ """
40
+ And I should be on the "master" branch
41
+
42
+ Scenario: Executing with git configuration
43
+ Given a file named ".gitconfig" with:
44
+ """
45
+ [pivotal]
46
+ api-token = PIVOTAL_API_KEY
47
+ full-name = PIVOTAL_USER
48
+ project-id = PIVOTAL_TEST_PROJECT
49
+ """
50
+ When I run `git-finish -k PIVOTAL_API_KEY -p PIVOTAL_TEST_PROJECT --force`
51
+ Then the output should contain each line:
52
+ """
53
+ Switching to master
54
+ Destroying local branch
55
+ Destroying remote branch
56
+ Marking Story CURRENT_CARD as finished...
57
+ """
58
+ And I should be on the "master" branch
59
+
60
+ Scenario: Executing from a misnamed branch
61
+ Given I am on the "missing-an-id" branch
62
+ When I run `git-finish -k PIVOTAL_API_KEY -p PIVOTAL_TEST_PROJECT --force`
63
+ Then the output should contain each line:
64
+ """
65
+ Branch name must contain a Pivotal Tracker story id
66
+ """
67
+ And the exit status should be 1
68
+
69
+ Scenario: Closing chore stories
70
+ Given I have a started Pivotal Tracker chore
71
+ And I am on the "CURRENT_CARD-chore" branch
72
+ And a file named ".gitconfig" with:
73
+ """
74
+ [pivotal]
75
+ api-token = PIVOTAL_API_KEY
76
+ full-name = PIVOTAL_USER
77
+ project-id = PIVOTAL_TEST_PROJECT
78
+ """
79
+ When I run `git-finish -k PIVOTAL_API_KEY -p PIVOTAL_TEST_PROJECT --force`
80
+ Then the output should contain each line:
81
+ """
82
+ Switching to master
83
+ Destroying local branch
84
+ Destroying remote branch
85
+ Marking Story CURRENT_CARD as finished...
86
+ """
87
+ And I should be on the "master" branch
88
+
@@ -0,0 +1,99 @@
1
+ Feature: git info
2
+
3
+ In order to get information about a specific card you can issue one of the following
4
+ commands:
5
+
6
+ git info
7
+ git info <options>
8
+ git info <card_id>
9
+ git info <card_id> <options>
10
+
11
+ Supported options:
12
+ --comments - displays comments for the card
13
+ -k <api_key> - specify the Pivotal API key to use. Overrides configuration.
14
+ -p <project_id> - specify the Pivotal project id to use. Overrides configuration.
15
+ -D - do not prompt for user input, use recommended values by default.
16
+
17
+ Background:
18
+ Given I have a Pivotal Tracker feature named "Test Story" with description "This is the description!"
19
+ And I am on the "CURRENT_CARD-feature" branch
20
+
21
+ Scenario: Executing with no settings
22
+ When I run `git-info`
23
+ Then the output should contain each line:
24
+ """
25
+ Pivotal Tracker API Token and Project ID are required
26
+ """
27
+ And the exit status should be 1
28
+
29
+ Scenario: Grabbing info about current topic branch
30
+ Given I have configured the Git repos for Pivotal
31
+ When I run `git-info`
32
+ Then the output should contain each line:
33
+ """
34
+ Story: Test Story
35
+ URL: http://www.pivotaltracker.com/story/show/CURRENT_CARD
36
+ State: not accepted
37
+ Description:
38
+ This is the description!
39
+ """
40
+
41
+ Scenario: Supplying Pivotal configuration via command line arguments
42
+ When I run `git-info -k PIVOTAL_API_KEY -p PIVOTAL_TEST_PROJECT -n "PIVOTAL_USER" -D`
43
+ Then the output should contain each line:
44
+ """
45
+ Story: Test Story
46
+ URL: http://www.pivotaltracker.com/story/show/CURRENT_CARD
47
+ State: not accepted
48
+ Description:
49
+ This is the description!
50
+ """
51
+
52
+ Scenario: Grabbing info about a specific card in question topic branch
53
+ Given I have a Pivotal Tracker chore named "Test Chore" with description "The chore description!"
54
+ And I have configured the Git repos for Pivotal
55
+ When I run `git-info CURRENT_CARD`
56
+ Then the output should contain each line:
57
+ """
58
+ Story: Test Chore
59
+ URL: http://www.pivotaltracker.com/story/show/CURRENT_CARD
60
+ State: not accepted
61
+ Description:
62
+ The chore description!
63
+ """
64
+
65
+ Scenario: Grabbing info when the card has labels
66
+ Given I have a Pivotal Tracker chore named "Test Chore" with description "The chore description!"
67
+ And the chore is labeled "foo, bar, baz"
68
+ And I have configured the Git repos for Pivotal
69
+ When I run `git-info CURRENT_CARD`
70
+ Then the output should contain each line:
71
+ """
72
+ Story: Test Chore
73
+ URL: http://www.pivotaltracker.com/story/show/CURRENT_CARD
74
+ Labels: bar, baz, foo
75
+ State: not accepted
76
+ Description:
77
+ The chore description!
78
+ """
79
+
80
+ Scenario: Requesting comments on a card using --comments
81
+ Given I have a Pivotal Tracker chore named "Test Chore" with description "The chore description!"
82
+ And the "PIVOTAL_USER" commented on the card "Well, this looks mighty fine!"
83
+ And I have configured the Git repos for Pivotal
84
+ When I run `git-info CURRENT_CARD --comments`
85
+ Then the output should contain "Comments:"
86
+ And the output should contain "Well, this looks mighty fine!"
87
+ And the output should contain "PIVOTAL_USER"
88
+
89
+ Scenario: Grabbing info when not on a topic branch and not supplying a card id
90
+ Given I have configured the Git repos for Pivotal
91
+ And I am on the "foo" branch
92
+ Then I should be on the "foo" branch
93
+ When I run `git-info`
94
+ Then the output should contain each line:
95
+ """
96
+ No story id was supplied and you aren't on a topic branch!
97
+ """
98
+
99
+
@@ -0,0 +1,113 @@
1
+ Feature: git start
2
+
3
+ In order to start the next available card in the project you can issue the following
4
+ commands:
5
+
6
+ git start <options>
7
+ git start <card_type> <options>
8
+
9
+ Supported options:
10
+ -k <api_key> - specify the Pivotal API key to use. Overrides configuration.
11
+ -p <project_id> - specify the Pivotal project id to use. Overrides configuration.
12
+ -D - do not prompt for user input, use recommended values by default.
13
+
14
+ This will check out a topic branch for the card and place you on it.
15
+
16
+ Scenario Outline: Executing with no settings
17
+ When I run `<command>`
18
+ Then the output should contain each line:
19
+ """
20
+ Pivotal Tracker API Token and Project ID are required
21
+ """
22
+ And the exit status should be 1
23
+
24
+ Examples:
25
+ | command |
26
+ | git-start bug |
27
+ | git-start chore |
28
+ | git-start feature |
29
+
30
+ Scenario: Starting the next feature when it is unestimated
31
+ Given I have an unestimated Pivotal Tracker feature
32
+ And I have configured the Git repos for Pivotal
33
+ When I run `git-start feature -D --force`
34
+ Then the output should contain each line:
35
+ """
36
+ Stories in the started state must be estimated.
37
+ """
38
+ And the exit status should be 1
39
+
40
+ # Assumption: that chores can be started without being estimated in Pivotal
41
+ Scenario: Starting the next chore when it is unestimated
42
+ Given I have an unestimated Pivotal Tracker chore
43
+ And I have configured the Git repos for Pivotal
44
+ When I run `git-start chore -D --force`
45
+ Then the output should contain "Switched to a new branch 'CURRENT_CARD-a-chore'"
46
+ And I should be on the "CURRENT_CARD-a-chore" branch
47
+ And card CURRENT_CARD is marked is started in Pivotal Tracker
48
+
49
+ # Assumption: that estimating bugs in Pivotal is turned off
50
+ Scenario: Starting the next bug when it is unestimated
51
+ Given I have an unestimated Pivotal Tracker bug
52
+ And I have configured the Git repos for Pivotal
53
+ When I run `git-start bug -D --force`
54
+ Then the output should contain "Switched to a new branch 'CURRENT_CARD-a-bug'"
55
+ And I should be on the "CURRENT_CARD-a-bug" branch
56
+ And card CURRENT_CARD is marked is started in Pivotal Tracker
57
+
58
+ Scenario Outline: Starting the next estimated card interactively (without -D option)
59
+ Given I have a Pivotal Tracker <card_type>
60
+ And I have configured the Git repos for Pivotal
61
+ When I run `git-start <card_type> --force` interactively
62
+ And I type "a_purple_<card_type>"
63
+ Then the output should contain "Switched to a new branch 'a_purple_<card_type>'"
64
+ And I should be on the "a_purple_<card_type>" branch
65
+ And card CURRENT_CARD is marked is started in Pivotal Tracker
66
+
67
+ Examples:
68
+ | card_type |
69
+ | bug |
70
+ | chore |
71
+ | feature |
72
+
73
+ Scenario Outline: Starting the next estimated card using configured defaults (with -D option)
74
+ Given I have a Pivotal Tracker <card_type>
75
+ And I have configured the Git repos for Pivotal
76
+ When I run `git-start <card_type> -D --force`
77
+ Then the output should contain "Switched to a new branch 'CURRENT_CARD-a-<card_type>'"
78
+ And I should be on the "CURRENT_CARD-a-<card_type>" branch
79
+ And card CURRENT_CARD is marked is started in Pivotal Tracker
80
+
81
+ Examples:
82
+ | card_type | branch_suffix |
83
+ | bug | fix |
84
+ | chore | |
85
+ | feature | |
86
+
87
+ Scenario Outline: Starting a specific card
88
+ Given I have a Pivotal Tracker <card_type>
89
+ And I have configured the Git repos for Pivotal
90
+ When I run `git-start CURRENT_CARD -D --force`
91
+ Then the output should contain "Switched to a new branch 'CURRENT_CARD-a-<card_type>'"
92
+ And I should be on the "CURRENT_CARD-a-<card_type>" branch
93
+ And card CURRENT_CARD is marked is started in Pivotal Tracker
94
+
95
+ Examples:
96
+ | card_type | branch_suffix |
97
+ | bug | fix |
98
+ | chore | |
99
+ | feature | |
100
+
101
+ Scenario Outline: Supplying Pivotal configuration via command line arguments
102
+ Given I have a Pivotal Tracker <card_type>
103
+ And I have configured the Git repos for Pivotal with bogus information
104
+ When I run `git-start <card_type> -k PIVOTAL_API_KEY -p PIVOTAL_TEST_PROJECT -n "PIVOTAL_USER" -D --force`
105
+ Then the output should contain "Switched to a new branch 'CURRENT_CARD-a-<card_type>'"
106
+ And I should be on the "CURRENT_CARD-a-<card_type>" branch
107
+ And card CURRENT_CARD is marked is started in Pivotal Tracker
108
+
109
+ Examples:
110
+ | card_type | branch_suffix |
111
+ | bug | fix |
112
+ | chore | |
113
+ | feature | |
@@ -0,0 +1,119 @@
1
+ STORY_TYPE = /feature|bug|chore|release/
2
+ STORY_STATE = /unscheduled|unstarted|started|finished|delivered|accepted|rejected/
3
+
4
+ Transform /PIVOTAL|CURRENT/ do |placeholder|
5
+ placeholder.
6
+ gsub("PIVOTAL_API_KEY", ENV['PIVOTAL_API_KEY']).
7
+ gsub("PIVOTAL_TEST_PROJECT", ENV['PIVOTAL_TEST_PROJECT']).
8
+ gsub("PIVOTAL_USER", ENV['PIVOTAL_USER']).
9
+ gsub("CURRENT_CARD", current_card.id.to_s)
10
+ end
11
+
12
+ Given "I debug" do
13
+ require 'pry'
14
+ binding.pry
15
+ end
16
+
17
+ Given /^I have configured the Git repos for Pivotal$/ do
18
+ step %|a file named ".gitconfig" with:|, <<-EOT.gsub!(/^\s+\S/, '')
19
+ |[pivotal]
20
+ | api-token = PIVOTAL_API_KEY
21
+ | full-name = PIVOTAL_USER
22
+ | project-id = PIVOTAL_TEST_PROJECT
23
+ | verbose = false
24
+ EOT
25
+ end
26
+
27
+ Given /^I have configured the Git repos for Pivotal with bogus information$/ do
28
+ step %|a file named ".gitconfig" with:|, <<-EOT.gsub!(/^\s+\S/, '')
29
+ |[pivotal]
30
+ | api-token = badtoken
31
+ | full-name = Bad Joe
32
+ | project-id = something
33
+ | remote = origin
34
+ | verbose = false
35
+ EOT
36
+ end
37
+
38
+ Given /^the "([^"]+)" commented on the card "([^"]+)"$/ do |author, text|
39
+ comment_on_story :author => author, :text => text
40
+ end
41
+
42
+ Given /^the (#{STORY_TYPE}|card) is labeled "([^"]+)"$/ do |type, labels|
43
+ update_test_story :labels => labels
44
+ end
45
+
46
+ Given /^I have a(?:n)? (#{STORY_STATE})?\s?Pivotal Tracker (#{STORY_TYPE})$/ do |status, type|
47
+ options = {}
48
+ options[:current_state] = status if status
49
+ create_test_story type, options
50
+ end
51
+
52
+ Given /^I have a(?:n)? unestimated \s?Pivotal Tracker (#{STORY_TYPE})$/ do |type|
53
+ options = { :estimate => -1 }
54
+ create_test_story type, options
55
+ end
56
+
57
+ Given /^I have a(?:n)? (#{STORY_STATE})?\s?Pivotal Tracker (#{STORY_TYPE}) named "([^"]+)" with description "([^"]+)"$/ do |status, type, name, description|
58
+ options = { :name => name, :description => description }
59
+ options[:current_state] = status if status
60
+ create_test_story type, options
61
+ end
62
+
63
+ Given /the card is a (#{STORY_TYPE})/ do |type|
64
+ update_test_story :story_type => type
65
+ end
66
+
67
+ Given /the (#{STORY_TYPE}) is unestimated/ do |type|
68
+ update_test_story :estimate => -1
69
+ end
70
+
71
+ Given /the (#{STORY_TYPE}) is (#{STORY_STATE})/ do |type, state|
72
+ update_test_story :current_state => state
73
+ end
74
+
75
+ Given /^I am on the "([^"]*)" branch$/ do |branch|
76
+ `git checkout -b #{branch} > /dev/null 2>&1`
77
+ end
78
+
79
+ Given /^I have a "([^"]*)" branch$/ do |branch|
80
+ `git branch #{branch} > /dev/null 2>&1`
81
+ end
82
+
83
+ When /^the current card is refreshed$/ do
84
+ refresh_current_card!
85
+ end
86
+
87
+ Then /^the card CURRENT_CARD should (not )?have the "([^"]*)" label$/ do |negate, label|
88
+ if negate
89
+ current_card.labels.to_s.should_not include(label)
90
+ else
91
+ current_card.labels.to_s.should include(label)
92
+ end
93
+ end
94
+
95
+ Then /^the card CURRENT_CARD should have the comment by "([^"]*)":$/ do |author, str|
96
+ current_card.notes.all.last.tap do |note|
97
+ note.author.should eq(author)
98
+ note.text.should include(str)
99
+ end
100
+ end
101
+
102
+ Then /^the card CURRENT_CARD should not have the comment:$/ do |str|
103
+ current_card.notes.all.detect{ |n| n.text.include?(str) }.should be_nil
104
+ end
105
+
106
+
107
+ Then /^I should be on the "([^"]*)" branch$/ do |branch|
108
+ current_branch.should == branch
109
+ end
110
+
111
+ Then /^card (CURRENT_\w+) is marked is started in Pivotal Tracker$/ do |card_id|
112
+ assert_card_is_started(card_id)
113
+ end
114
+
115
+ Then /^the output should contain each line:$/ do |str|
116
+ str.split("\n").each do |line|
117
+ assert_partial_output(line, all_output)
118
+ end
119
+ end