git-pivotal-tracker-integration 1.3.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +13 -2
- data/bin/git-finish +2 -2
- data/bin/git-release +1 -1
- data/bin/git-start +1 -1
- data/lib/git-pivotal-tracker-integration/command/base.rb +4 -4
- data/lib/git-pivotal-tracker-integration/command/command.rb +1 -1
- data/lib/git-pivotal-tracker-integration/command/configuration.rb +18 -18
- data/lib/git-pivotal-tracker-integration/command/finish.rb +7 -5
- data/lib/git-pivotal-tracker-integration/command/release.rb +6 -6
- data/lib/git-pivotal-tracker-integration/command/start.rb +10 -10
- data/lib/git-pivotal-tracker-integration/util/git.rb +39 -37
- data/lib/git-pivotal-tracker-integration/util/shell.rb +3 -3
- data/lib/git-pivotal-tracker-integration/util/story.rb +18 -22
- data/lib/git-pivotal-tracker-integration/util/util.rb +1 -1
- data/lib/git-pivotal-tracker-integration/version-update/gradle.rb +5 -5
- data/lib/git-pivotal-tracker-integration/version-update/version_update.rb +1 -1
- data/spec/git-pivotal-tracker-integration/command/base_spec.rb +6 -6
- data/spec/git-pivotal-tracker-integration/command/configuration_spec.rb +32 -32
- data/spec/git-pivotal-tracker-integration/command/finish_spec.rb +10 -10
- data/spec/git-pivotal-tracker-integration/command/release_spec.rb +18 -18
- data/spec/git-pivotal-tracker-integration/command/start_spec.rb +16 -16
- data/spec/git-pivotal-tracker-integration/util/git_spec.rb +98 -88
- data/spec/git-pivotal-tracker-integration/util/shell_spec.rb +11 -11
- data/spec/git-pivotal-tracker-integration/util/story_spec.rb +35 -35
- data/spec/git-pivotal-tracker-integration/version-update/gradle_spec.rb +18 -18
- metadata +6 -6
@@ -13,9 +13,9 @@
|
|
13
13
|
# See the License for the specific language governing permissions and
|
14
14
|
# limitations under the License.
|
15
15
|
|
16
|
-
require
|
16
|
+
require 'git-pivotal-tracker-integration/util/util'
|
17
17
|
|
18
|
-
#
|
18
|
+
# Utilities for dealing with the shell
|
19
19
|
class GitPivotalTrackerIntegration::Util::Shell
|
20
20
|
|
21
21
|
# Executes a command
|
@@ -27,7 +27,7 @@ class GitPivotalTrackerIntegration::Util::Shell
|
|
27
27
|
def self.exec(command, abort_on_failure = true)
|
28
28
|
result = `#{command}`
|
29
29
|
if $?.exitstatus != 0 && abort_on_failure
|
30
|
-
abort
|
30
|
+
abort 'FAIL'
|
31
31
|
end
|
32
32
|
|
33
33
|
result
|
@@ -13,11 +13,11 @@
|
|
13
13
|
# See the License for the specific language governing permissions and
|
14
14
|
# limitations under the License.
|
15
15
|
|
16
|
-
require
|
17
|
-
require
|
18
|
-
require
|
16
|
+
require 'git-pivotal-tracker-integration/util/util'
|
17
|
+
require 'highline/import'
|
18
|
+
require 'pivotal-tracker'
|
19
19
|
|
20
|
-
#
|
20
|
+
# Utilities for dealing with +PivotalTracker::Story+s
|
21
21
|
class GitPivotalTrackerIntegration::Util::Story
|
22
22
|
|
23
23
|
# Print a human readable version of a story. This pretty prints the title,
|
@@ -26,12 +26,12 @@ class GitPivotalTrackerIntegration::Util::Story
|
|
26
26
|
# @param [PivotalTracker::Story] story the story to pretty print
|
27
27
|
# @return [void]
|
28
28
|
def self.pretty_print(story)
|
29
|
-
print_label
|
29
|
+
print_label LABEL_TITLE
|
30
30
|
print_value story.name
|
31
31
|
|
32
32
|
description = story.description
|
33
33
|
if !description.nil? && !description.empty?
|
34
|
-
print_label
|
34
|
+
print_label 'Description'
|
35
35
|
print_value description
|
36
36
|
end
|
37
37
|
|
@@ -54,8 +54,6 @@ class GitPivotalTrackerIntegration::Util::Story
|
|
54
54
|
# @param [Fixnum] limit The number maximum number of stories the user can choose from
|
55
55
|
# @return [PivotalTracker::Story] The Pivotal Tracker story selected by the user
|
56
56
|
def self.select_story(project, filter = nil, limit = 5)
|
57
|
-
story = nil
|
58
|
-
|
59
57
|
if filter =~ /[[:digit:]]/
|
60
58
|
story = project.stories.find filter.to_i
|
61
59
|
else
|
@@ -67,39 +65,37 @@ class GitPivotalTrackerIntegration::Util::Story
|
|
67
65
|
|
68
66
|
private
|
69
67
|
|
70
|
-
|
68
|
+
CANDIDATE_STATES = %w(rejected unstarted unscheduled).freeze
|
71
69
|
|
72
|
-
|
70
|
+
LABEL_DESCRIPTION = 'Description'.freeze
|
73
71
|
|
74
|
-
|
72
|
+
LABEL_TITLE = 'Title'.freeze
|
75
73
|
|
76
|
-
|
74
|
+
LABEL_WIDTH = (LABEL_DESCRIPTION.length + 2).freeze
|
77
75
|
|
78
|
-
|
76
|
+
CONTENT_WIDTH = (HighLine.new.output_cols - LABEL_WIDTH).freeze
|
79
77
|
|
80
78
|
def self.print_label(label)
|
81
|
-
print "%#{
|
79
|
+
print "%#{LABEL_WIDTH}s" % ["#{label}: "]
|
82
80
|
end
|
83
81
|
|
84
82
|
def self.print_value(value)
|
85
83
|
if value.nil? || value.empty?
|
86
|
-
puts
|
84
|
+
puts ''
|
87
85
|
else
|
88
|
-
value.scan(/\S.{0,#{
|
86
|
+
value.scan(/\S.{0,#{CONTENT_WIDTH - 2}}\S(?=\s|$)|\S+/).each_with_index do |line, index|
|
89
87
|
if index == 0
|
90
88
|
puts line
|
91
89
|
else
|
92
|
-
puts "%#{
|
90
|
+
puts "%#{LABEL_WIDTH}s%s" % ['', line]
|
93
91
|
end
|
94
92
|
end
|
95
93
|
end
|
96
94
|
end
|
97
95
|
|
98
96
|
def self.find_story(project, type, limit)
|
99
|
-
story = nil
|
100
|
-
|
101
97
|
criteria = {
|
102
|
-
:current_state =>
|
98
|
+
:current_state => CANDIDATE_STATES,
|
103
99
|
:limit => limit
|
104
100
|
}
|
105
101
|
if type
|
@@ -111,10 +107,10 @@ class GitPivotalTrackerIntegration::Util::Story
|
|
111
107
|
story = candidates[0]
|
112
108
|
else
|
113
109
|
story = choose do |menu|
|
114
|
-
menu.prompt =
|
110
|
+
menu.prompt = 'Choose story to start: '
|
115
111
|
|
116
112
|
candidates.each do |story|
|
117
|
-
name = type ? story.name :
|
113
|
+
name = type ? story.name : '%-7s %s' % [story.story_type.upcase, story.name]
|
118
114
|
menu.choice(name) { story }
|
119
115
|
end
|
120
116
|
end
|
@@ -13,7 +13,7 @@
|
|
13
13
|
# See the License for the specific language governing permissions and
|
14
14
|
# limitations under the License.
|
15
15
|
|
16
|
-
require
|
16
|
+
require 'git_pivotal_tracker_integration'
|
17
17
|
|
18
18
|
# A module encapsulating utilities for the project
|
19
19
|
module GitPivotalTrackerIntegration::Util
|
@@ -13,7 +13,7 @@
|
|
13
13
|
# See the License for the specific language governing permissions and
|
14
14
|
# limitations under the License.
|
15
15
|
|
16
|
-
require
|
16
|
+
require 'git-pivotal-tracker-integration/version-update/version_update'
|
17
17
|
|
18
18
|
# A version updater for dealing with _typical_ Gradle projects. This updater
|
19
19
|
# assumes that the version of the current project is stored within a
|
@@ -25,11 +25,11 @@ class GitPivotalTrackerIntegration::VersionUpdate::Gradle
|
|
25
25
|
#
|
26
26
|
# @param [String] root The root of the repository
|
27
27
|
def initialize(root)
|
28
|
-
@gradle_properties = File.expand_path
|
28
|
+
@gradle_properties = File.expand_path 'gradle.properties', root
|
29
29
|
|
30
30
|
if File.exist? @gradle_properties
|
31
31
|
groups = nil
|
32
|
-
File.open(@gradle_properties,
|
32
|
+
File.open(@gradle_properties, 'r') do |file|
|
33
33
|
groups = file.read().scan(/version[=:](.*)/)
|
34
34
|
end
|
35
35
|
@version = groups[0] ? groups[0][0]: nil
|
@@ -39,7 +39,7 @@ class GitPivotalTrackerIntegration::VersionUpdate::Gradle
|
|
39
39
|
# Whether this updater supports updating this project
|
40
40
|
#
|
41
41
|
# @return [Boolean] +true+ if a valid version number was found on
|
42
|
-
#
|
42
|
+
# initialization, +false+ otherwise
|
43
43
|
def supports?
|
44
44
|
!@version.nil?
|
45
45
|
end
|
@@ -58,7 +58,7 @@ class GitPivotalTrackerIntegration::VersionUpdate::Gradle
|
|
58
58
|
def update_version(new_version)
|
59
59
|
contents = File.read(@gradle_properties)
|
60
60
|
contents = contents.gsub(/(version[=:])#{@version}/, "\\1#{new_version}")
|
61
|
-
File.open(@gradle_properties,
|
61
|
+
File.open(@gradle_properties, 'w') { |file| file.write(contents) }
|
62
62
|
end
|
63
63
|
|
64
64
|
end
|
@@ -13,7 +13,7 @@
|
|
13
13
|
# See the License for the specific language governing permissions and
|
14
14
|
# limitations under the License.
|
15
15
|
|
16
|
-
require
|
16
|
+
require 'git_pivotal_tracker_integration'
|
17
17
|
|
18
18
|
# A module encapsulating version update implementations
|
19
19
|
module GitPivotalTrackerIntegration::VersionUpdate
|
@@ -13,10 +13,10 @@
|
|
13
13
|
# See the License for the specific language governing permissions and
|
14
14
|
# limitations under the License.
|
15
15
|
|
16
|
-
require
|
17
|
-
require
|
18
|
-
require
|
19
|
-
require
|
16
|
+
require 'spec_helper'
|
17
|
+
require 'git-pivotal-tracker-integration/command/base'
|
18
|
+
require 'git-pivotal-tracker-integration/command/configuration'
|
19
|
+
require 'git-pivotal-tracker-integration/util/git'
|
20
20
|
|
21
21
|
describe GitPivotalTrackerIntegration::Command::Base do
|
22
22
|
|
@@ -24,7 +24,7 @@ describe GitPivotalTrackerIntegration::Command::Base do
|
|
24
24
|
$stdout = StringIO.new
|
25
25
|
$stderr = StringIO.new
|
26
26
|
|
27
|
-
@project = double(
|
27
|
+
@project = double('project')
|
28
28
|
GitPivotalTrackerIntegration::Util::Git.should_receive(:repository_root)
|
29
29
|
GitPivotalTrackerIntegration::Command::Configuration.any_instance.should_receive(:api_token)
|
30
30
|
GitPivotalTrackerIntegration::Command::Configuration.any_instance.should_receive(:project_id)
|
@@ -32,7 +32,7 @@ describe GitPivotalTrackerIntegration::Command::Base do
|
|
32
32
|
@base = GitPivotalTrackerIntegration::Command::Base.new
|
33
33
|
end
|
34
34
|
|
35
|
-
it
|
35
|
+
it 'should not run' do
|
36
36
|
lambda { @base.run }.should raise_error
|
37
37
|
end
|
38
38
|
end
|
@@ -13,10 +13,10 @@
|
|
13
13
|
# See the License for the specific language governing permissions and
|
14
14
|
# limitations under the License.
|
15
15
|
|
16
|
-
require
|
17
|
-
require
|
18
|
-
require
|
19
|
-
require
|
16
|
+
require 'spec_helper'
|
17
|
+
require 'git-pivotal-tracker-integration/command/configuration'
|
18
|
+
require 'git-pivotal-tracker-integration/util/git'
|
19
|
+
require 'pivotal-tracker'
|
20
20
|
|
21
21
|
describe GitPivotalTrackerIntegration::Command::Configuration do
|
22
22
|
|
@@ -26,60 +26,60 @@ describe GitPivotalTrackerIntegration::Command::Configuration do
|
|
26
26
|
@configuration = GitPivotalTrackerIntegration::Command::Configuration.new
|
27
27
|
end
|
28
28
|
|
29
|
-
it
|
30
|
-
GitPivotalTrackerIntegration::Util::Git.should_receive(:get_config).with(
|
29
|
+
it 'should not prompt the user for the API token if it is already configured' do
|
30
|
+
GitPivotalTrackerIntegration::Util::Git.should_receive(:get_config).with('pivotal.api-token', :inherited).and_return('test_api_token')
|
31
31
|
|
32
32
|
api_token = @configuration.api_token
|
33
33
|
|
34
|
-
expect(api_token).to eq(
|
34
|
+
expect(api_token).to eq('test_api_token')
|
35
35
|
end
|
36
36
|
|
37
|
-
it
|
38
|
-
GitPivotalTrackerIntegration::Util::Git.should_receive(:get_config).with(
|
39
|
-
@configuration.should_receive(:ask).and_return(
|
40
|
-
GitPivotalTrackerIntegration::Util::Git.should_receive(:set_config).with(
|
37
|
+
it 'should prompt the user for the API token if it is not configured' do
|
38
|
+
GitPivotalTrackerIntegration::Util::Git.should_receive(:get_config).with('pivotal.api-token', :inherited).and_return('')
|
39
|
+
@configuration.should_receive(:ask).and_return('test_api_token')
|
40
|
+
GitPivotalTrackerIntegration::Util::Git.should_receive(:set_config).with('pivotal.api-token', 'test_api_token', :global)
|
41
41
|
|
42
42
|
api_token = @configuration.api_token
|
43
43
|
|
44
|
-
expect(api_token).to eq(
|
44
|
+
expect(api_token).to eq('test_api_token')
|
45
45
|
end
|
46
46
|
|
47
|
-
it
|
48
|
-
GitPivotalTrackerIntegration::Util::Git.should_receive(:get_config).with(
|
47
|
+
it 'should not prompt the user for the project id if it is already configured' do
|
48
|
+
GitPivotalTrackerIntegration::Util::Git.should_receive(:get_config).with('pivotal.project-id', :inherited).and_return('test_project_id')
|
49
49
|
|
50
50
|
project_id = @configuration.project_id
|
51
51
|
|
52
|
-
expect(project_id).to eq(
|
52
|
+
expect(project_id).to eq('test_project_id')
|
53
53
|
end
|
54
54
|
|
55
|
-
it
|
56
|
-
GitPivotalTrackerIntegration::Util::Git.should_receive(:get_config).with(
|
57
|
-
menu = double(
|
55
|
+
it 'should prompt the user for the API token if it is not configured' do
|
56
|
+
GitPivotalTrackerIntegration::Util::Git.should_receive(:get_config).with('pivotal.project-id', :inherited).and_return('')
|
57
|
+
menu = double('menu')
|
58
58
|
menu.should_receive(:prompt=)
|
59
59
|
PivotalTracker::Project.should_receive(:all).and_return([
|
60
|
-
PivotalTracker::Project.new(:id =>
|
61
|
-
PivotalTracker::Project.new(:id =>
|
62
|
-
menu.should_receive(:choice).with(
|
63
|
-
menu.should_receive(:choice).with(
|
64
|
-
@configuration.should_receive(:choose) { |&arg| arg.call menu }.and_return(
|
65
|
-
GitPivotalTrackerIntegration::Util::Git.should_receive(:set_config).with(
|
60
|
+
PivotalTracker::Project.new(:id => 'id-2', :name => 'name-2'),
|
61
|
+
PivotalTracker::Project.new(:id => 'id-1', :name => 'name-1')])
|
62
|
+
menu.should_receive(:choice).with('name-1')
|
63
|
+
menu.should_receive(:choice).with('name-2')
|
64
|
+
@configuration.should_receive(:choose) { |&arg| arg.call menu }.and_return('test_project_id')
|
65
|
+
GitPivotalTrackerIntegration::Util::Git.should_receive(:set_config).with('pivotal.project-id', 'test_project_id', :local)
|
66
66
|
|
67
67
|
project_id = @configuration.project_id
|
68
68
|
|
69
|
-
expect(project_id).to eq(
|
69
|
+
expect(project_id).to eq('test_project_id')
|
70
70
|
end
|
71
71
|
|
72
|
-
it
|
73
|
-
GitPivotalTrackerIntegration::Util::Git.should_receive(:set_config).with(
|
72
|
+
it 'should persist the story when requested' do
|
73
|
+
GitPivotalTrackerIntegration::Util::Git.should_receive(:set_config).with('pivotal-story-id', 12345678, :branch)
|
74
74
|
|
75
75
|
@configuration.story = PivotalTracker::Story.new(:id => 12345678)
|
76
76
|
end
|
77
77
|
|
78
|
-
it
|
79
|
-
project = double(
|
80
|
-
stories = double(
|
81
|
-
story = double(
|
82
|
-
GitPivotalTrackerIntegration::Util::Git.should_receive(:get_config).with(
|
78
|
+
it 'should return a story when requested' do
|
79
|
+
project = double('project')
|
80
|
+
stories = double('stories')
|
81
|
+
story = double('story')
|
82
|
+
GitPivotalTrackerIntegration::Util::Git.should_receive(:get_config).with('pivotal-story-id', :branch).and_return('12345678')
|
83
83
|
project.should_receive(:stories).and_return(stories)
|
84
84
|
stories.should_receive(:find).with(12345678).and_return(story)
|
85
85
|
|
@@ -13,11 +13,11 @@
|
|
13
13
|
# See the License for the specific language governing permissions and
|
14
14
|
# limitations under the License.
|
15
15
|
|
16
|
-
require
|
17
|
-
require
|
18
|
-
require
|
19
|
-
require
|
20
|
-
require
|
16
|
+
require 'spec_helper'
|
17
|
+
require 'git-pivotal-tracker-integration/command/configuration'
|
18
|
+
require 'git-pivotal-tracker-integration/command/finish'
|
19
|
+
require 'git-pivotal-tracker-integration/util/git'
|
20
|
+
require 'pivotal-tracker'
|
21
21
|
|
22
22
|
describe GitPivotalTrackerIntegration::Command::Finish do
|
23
23
|
|
@@ -25,7 +25,7 @@ describe GitPivotalTrackerIntegration::Command::Finish do
|
|
25
25
|
$stdout = StringIO.new
|
26
26
|
$stderr = StringIO.new
|
27
27
|
|
28
|
-
@project = double(
|
28
|
+
@project = double('project')
|
29
29
|
GitPivotalTrackerIntegration::Util::Git.should_receive(:repository_root)
|
30
30
|
GitPivotalTrackerIntegration::Command::Configuration.any_instance.should_receive(:api_token)
|
31
31
|
GitPivotalTrackerIntegration::Command::Configuration.any_instance.should_receive(:project_id)
|
@@ -33,13 +33,13 @@ describe GitPivotalTrackerIntegration::Command::Finish do
|
|
33
33
|
@finish = GitPivotalTrackerIntegration::Command::Finish.new
|
34
34
|
end
|
35
35
|
|
36
|
-
it
|
36
|
+
it 'should run' do
|
37
37
|
GitPivotalTrackerIntegration::Util::Git.should_receive(:trivial_merge?)
|
38
38
|
GitPivotalTrackerIntegration::Command::Configuration.any_instance.should_receive(:story)
|
39
39
|
GitPivotalTrackerIntegration::Util::Git.should_receive(:merge)
|
40
|
-
GitPivotalTrackerIntegration::Util::Git.should_receive(:branch_name).and_return(
|
41
|
-
GitPivotalTrackerIntegration::Util::Git.should_receive(:push).with(
|
40
|
+
GitPivotalTrackerIntegration::Util::Git.should_receive(:branch_name).and_return('master')
|
41
|
+
GitPivotalTrackerIntegration::Util::Git.should_receive(:push).with('master')
|
42
42
|
|
43
|
-
@finish.run
|
43
|
+
@finish.run nil
|
44
44
|
end
|
45
45
|
end
|
@@ -13,12 +13,12 @@
|
|
13
13
|
# See the License for the specific language governing permissions and
|
14
14
|
# limitations under the License.
|
15
15
|
|
16
|
-
require
|
17
|
-
require
|
18
|
-
require
|
19
|
-
require
|
20
|
-
require
|
21
|
-
require
|
16
|
+
require 'spec_helper'
|
17
|
+
require 'git-pivotal-tracker-integration/command/configuration'
|
18
|
+
require 'git-pivotal-tracker-integration/command/release'
|
19
|
+
require 'git-pivotal-tracker-integration/util/git'
|
20
|
+
require 'git-pivotal-tracker-integration/util/story'
|
21
|
+
require 'pivotal-tracker'
|
22
22
|
|
23
23
|
describe GitPivotalTrackerIntegration::Command::Release do
|
24
24
|
|
@@ -26,7 +26,7 @@ describe GitPivotalTrackerIntegration::Command::Release do
|
|
26
26
|
$stdout = StringIO.new
|
27
27
|
$stderr = StringIO.new
|
28
28
|
|
29
|
-
@project = double(
|
29
|
+
@project = double('project')
|
30
30
|
GitPivotalTrackerIntegration::Util::Git.should_receive(:repository_root)
|
31
31
|
GitPivotalTrackerIntegration::Command::Configuration.any_instance.should_receive(:api_token)
|
32
32
|
GitPivotalTrackerIntegration::Command::Configuration.any_instance.should_receive(:project_id)
|
@@ -34,22 +34,22 @@ describe GitPivotalTrackerIntegration::Command::Release do
|
|
34
34
|
@release = GitPivotalTrackerIntegration::Command::Release.new
|
35
35
|
end
|
36
36
|
|
37
|
-
it
|
37
|
+
it 'should run' do
|
38
38
|
story = PivotalTracker::Story.new(:id => 12345678)
|
39
|
-
updater = double(
|
39
|
+
updater = double('updater')
|
40
40
|
GitPivotalTrackerIntegration::Util::Story.should_receive(:select_story).and_return(story)
|
41
41
|
GitPivotalTrackerIntegration::Util::Story.should_receive(:pretty_print)
|
42
42
|
GitPivotalTrackerIntegration::VersionUpdate::Gradle.should_receive(:new).and_return(updater)
|
43
43
|
updater.should_receive(:supports?).and_return(true)
|
44
|
-
updater.should_receive(:current_version).and_return(
|
45
|
-
@release.should_receive(:ask).and_return(
|
46
|
-
@release.should_receive(:ask).and_return(
|
47
|
-
updater.should_receive(:update_version).with(
|
48
|
-
GitPivotalTrackerIntegration::Util::Git.should_receive(:create_release_tag).with(
|
49
|
-
updater.should_receive(:update_version).with(
|
50
|
-
GitPivotalTrackerIntegration::Util::Git.should_receive(:create_commit).with(
|
51
|
-
GitPivotalTrackerIntegration::Util::Git.should_receive(:branch_name).and_return(
|
52
|
-
GitPivotalTrackerIntegration::Util::Git.should_receive(:push).with(
|
44
|
+
updater.should_receive(:current_version).and_return('test_current_version')
|
45
|
+
@release.should_receive(:ask).and_return('test_release_version')
|
46
|
+
@release.should_receive(:ask).and_return('test_next_version')
|
47
|
+
updater.should_receive(:update_version).with('test_release_version')
|
48
|
+
GitPivotalTrackerIntegration::Util::Git.should_receive(:create_release_tag).with('test_release_version', story)
|
49
|
+
updater.should_receive(:update_version).with('test_next_version')
|
50
|
+
GitPivotalTrackerIntegration::Util::Git.should_receive(:create_commit).with('test_next_version Development', story)
|
51
|
+
GitPivotalTrackerIntegration::Util::Git.should_receive(:branch_name).and_return('master')
|
52
|
+
GitPivotalTrackerIntegration::Util::Git.should_receive(:push).with('master', 'vtest_release_version')
|
53
53
|
|
54
54
|
@release.run(nil)
|
55
55
|
end
|
@@ -13,12 +13,12 @@
|
|
13
13
|
# See the License for the specific language governing permissions and
|
14
14
|
# limitations under the License.
|
15
15
|
|
16
|
-
require
|
17
|
-
require
|
18
|
-
require
|
19
|
-
require
|
20
|
-
require
|
21
|
-
require
|
16
|
+
require 'spec_helper'
|
17
|
+
require 'git-pivotal-tracker-integration/command/configuration'
|
18
|
+
require 'git-pivotal-tracker-integration/command/start'
|
19
|
+
require 'git-pivotal-tracker-integration/util/git'
|
20
|
+
require 'git-pivotal-tracker-integration/util/story'
|
21
|
+
require 'pivotal-tracker'
|
22
22
|
|
23
23
|
describe GitPivotalTrackerIntegration::Command::Start do
|
24
24
|
|
@@ -26,8 +26,8 @@ describe GitPivotalTrackerIntegration::Command::Start do
|
|
26
26
|
$stdout = StringIO.new
|
27
27
|
$stderr = StringIO.new
|
28
28
|
|
29
|
-
@project = double(
|
30
|
-
@story = double(
|
29
|
+
@project = double('project')
|
30
|
+
@story = double('story')
|
31
31
|
GitPivotalTrackerIntegration::Util::Git.should_receive(:repository_root)
|
32
32
|
GitPivotalTrackerIntegration::Command::Configuration.any_instance.should_receive(:api_token)
|
33
33
|
GitPivotalTrackerIntegration::Command::Configuration.any_instance.should_receive(:project_id)
|
@@ -35,20 +35,20 @@ describe GitPivotalTrackerIntegration::Command::Start do
|
|
35
35
|
@start = GitPivotalTrackerIntegration::Command::Start.new
|
36
36
|
end
|
37
37
|
|
38
|
-
it
|
39
|
-
GitPivotalTrackerIntegration::Util::Story.should_receive(:select_story).with(@project,
|
38
|
+
it 'should run' do
|
39
|
+
GitPivotalTrackerIntegration::Util::Story.should_receive(:select_story).with(@project, 'test_filter').and_return(@story)
|
40
40
|
GitPivotalTrackerIntegration::Util::Story.should_receive(:pretty_print)
|
41
41
|
@story.should_receive(:id).twice.and_return(12345678)
|
42
|
-
@start.should_receive(:ask).and_return(
|
43
|
-
GitPivotalTrackerIntegration::Util::Git.should_receive(:create_branch).with(
|
42
|
+
@start.should_receive(:ask).and_return('development_branch')
|
43
|
+
GitPivotalTrackerIntegration::Util::Git.should_receive(:create_branch).with('12345678-development_branch')
|
44
44
|
GitPivotalTrackerIntegration::Command::Configuration.any_instance.should_receive(:story=)
|
45
45
|
GitPivotalTrackerIntegration::Util::Git.should_receive(:add_hook)
|
46
|
-
GitPivotalTrackerIntegration::Util::Git.should_receive(:get_config).with(
|
46
|
+
GitPivotalTrackerIntegration::Util::Git.should_receive(:get_config).with('user.name').and_return('test_owner')
|
47
47
|
@story.should_receive(:update).with(
|
48
|
-
:current_state =>
|
49
|
-
:owned_by =>
|
48
|
+
:current_state => 'started',
|
49
|
+
:owned_by => 'test_owner'
|
50
50
|
)
|
51
51
|
|
52
|
-
@start.run
|
52
|
+
@start.run 'test_filter'
|
53
53
|
end
|
54
54
|
end
|