git-process 1.0.4 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +11 -1
- data/README.md +2 -8
- data/lib/git-process/abstract_error_builder.rb +2 -2
- data/lib/git-process/changed_file_helper.rb +1 -1
- data/lib/git-process/git_abstract_merge_error_builder.rb +2 -1
- data/lib/git-process/git_branch.rb +3 -2
- data/lib/git-process/git_branches.rb +9 -8
- data/lib/git-process/git_lib.rb +18 -19
- data/lib/git-process/git_merge_error.rb +2 -1
- data/lib/git-process/git_process.rb +8 -6
- data/lib/git-process/git_process_error.rb +1 -1
- data/lib/git-process/git_process_options.rb +6 -8
- data/lib/git-process/git_rebase_error.rb +2 -1
- data/lib/git-process/git_status.rb +37 -36
- data/lib/git-process/github_client.rb +8 -10
- data/lib/git-process/github_pull_request.rb +9 -7
- data/lib/git-process/github_service.rb +7 -7
- data/lib/git-process/new_fb.rb +1 -1
- data/lib/git-process/parked_changes_error.rb +2 -1
- data/lib/git-process/pull_request.rb +1 -1
- data/lib/git-process/rebase_to_master.rb +10 -9
- data/lib/git-process/sync.rb +17 -5
- data/lib/git-process/uncommitted_changes_error.rb +1 -1
- data/lib/git-process/version.rb +2 -2
- data/spec/FileHelpers.rb +1 -0
- data/spec/GitRepoHelper.rb +3 -3
- data/spec/changed_file_helper_spec.rb +2 -2
- data/spec/git_abstract_merge_error_builder_spec.rb +32 -28
- data/spec/git_lib_spec.rb +16 -13
- data/spec/git_process_spec.rb +2 -1
- data/spec/git_status_spec.rb +5 -4
- data/spec/github_pull_request_spec.rb +9 -8
- data/spec/github_service_spec.rb +10 -8
- data/spec/rebase_to_master_spec.rb +7 -6
- data/spec/sync_spec.rb +56 -22
- metadata +30 -17
data/spec/git_lib_spec.rb
CHANGED
@@ -6,12 +6,13 @@ describe GitProc::GitLib do
|
|
6
6
|
class GLStub
|
7
7
|
include GitProc::GitLib
|
8
8
|
|
9
|
+
|
9
10
|
def initialize(workdir, log_level)
|
10
11
|
@logger = Logger.new(STDOUT)
|
11
12
|
@logger.level = log_level || Logger::WARN
|
12
13
|
@logger.datetime_format = "%Y-%m-%d %H:%M:%S"
|
13
14
|
f = Logger::Formatter.new
|
14
|
-
@logger.formatter = proc do |
|
15
|
+
@logger.formatter = proc do |_, _, _, msg|
|
15
16
|
"#{msg}\n"
|
16
17
|
end
|
17
18
|
|
@@ -31,6 +32,7 @@ describe GitProc::GitLib do
|
|
31
32
|
@workdir
|
32
33
|
end
|
33
34
|
|
35
|
+
|
34
36
|
def logger
|
35
37
|
@logger
|
36
38
|
end
|
@@ -46,14 +48,14 @@ describe GitProc::GitLib do
|
|
46
48
|
include GitRepoHelper
|
47
49
|
|
48
50
|
it "list all the branches" do
|
49
|
-
create_files(
|
51
|
+
create_files(%w(.gitignore))
|
50
52
|
gitlib.commit('initial')
|
51
53
|
|
52
54
|
gitlib.branch('ba', :base_branch => 'master')
|
53
55
|
gitlib.branch('bb', :base_branch => 'master')
|
54
56
|
gitlib.branch('origin/master', :base_branch => 'master')
|
55
57
|
|
56
|
-
gitlib.branches.names.should ==
|
58
|
+
gitlib.branches.names.should == %w(ba bb master origin/master)
|
57
59
|
end
|
58
60
|
|
59
61
|
end
|
@@ -68,25 +70,25 @@ describe GitProc::GitLib do
|
|
68
70
|
|
69
71
|
|
70
72
|
it "should create a branch with default base" do
|
71
|
-
lib.stub(:command).with(:branch,
|
73
|
+
lib.stub(:command).with(:branch, %w(test_branch master))
|
72
74
|
lib.branch('test_branch')
|
73
75
|
end
|
74
76
|
|
75
77
|
|
76
78
|
it "should create a branch with explicit base" do
|
77
|
-
lib.stub(:command).with(:branch,
|
79
|
+
lib.stub(:command).with(:branch, %w(test_branch other_branch))
|
78
80
|
lib.branch('test_branch', :base_branch => 'other_branch')
|
79
81
|
end
|
80
82
|
|
81
83
|
|
82
84
|
it "should delete a branch without force" do
|
83
|
-
lib.stub(:command).with(:branch,
|
85
|
+
lib.stub(:command).with(:branch, %w(-d test_branch))
|
84
86
|
lib.branch('test_branch', :delete => true)
|
85
87
|
end
|
86
88
|
|
87
89
|
|
88
90
|
it "should delete a branch with force" do
|
89
|
-
lib.stub(:command).with(:branch,
|
91
|
+
lib.stub(:command).with(:branch, %w(-D test_branch))
|
90
92
|
lib.branch('test_branch', :delete => true, :force => true)
|
91
93
|
end
|
92
94
|
|
@@ -107,15 +109,15 @@ describe GitProc::GitLib do
|
|
107
109
|
|
108
110
|
|
109
111
|
it "should push local branch to remote" do
|
110
|
-
lib.should_receive(:command).with(:push,
|
112
|
+
lib.should_receive(:command).with(:push, %w(remote local_branch:test_branch))
|
111
113
|
|
112
114
|
lib.push('remote', 'local_branch', 'test_branch')
|
113
115
|
end
|
114
116
|
|
115
117
|
|
116
118
|
it "should push current branch to remote" do
|
117
|
-
lib.stub(:command).with(:branch,
|
118
|
-
lib.should_receive(:command).with(:push,
|
119
|
+
lib.stub(:command).with(:branch, %w(-a --no-color)).and_return("* my_branch\n")
|
120
|
+
lib.should_receive(:command).with(:push, %w(remote my_branch:my_branch))
|
119
121
|
|
120
122
|
lib.push('remote', 'my_branch', nil)
|
121
123
|
end
|
@@ -124,7 +126,7 @@ describe GitProc::GitLib do
|
|
124
126
|
it "should remove named branch on remote" do
|
125
127
|
lib.stub(:remote_name).and_return('remote')
|
126
128
|
lib.stub(:config).and_return('master')
|
127
|
-
lib.should_receive(:command).with(:push,
|
129
|
+
lib.should_receive(:command).with(:push, %w(remote --delete my_branch))
|
128
130
|
|
129
131
|
lib.push('remote', 'my_branch', nil, :delete => true)
|
130
132
|
end
|
@@ -133,7 +135,7 @@ describe GitProc::GitLib do
|
|
133
135
|
it "should remove current branch on remote" do
|
134
136
|
lib.stub(:remote_name).and_return('remote')
|
135
137
|
lib.stub(:config).and_return('master')
|
136
|
-
lib.should_receive(:command).with(:push,
|
138
|
+
lib.should_receive(:command).with(:push, %w(remote --delete my_branch))
|
137
139
|
|
138
140
|
lib.push('remote', nil, nil, :delete => 'my_branch')
|
139
141
|
end
|
@@ -143,7 +145,7 @@ describe GitProc::GitLib do
|
|
143
145
|
lib.stub(:remote_name).and_return('remote')
|
144
146
|
lib.stub(:config).and_return('master')
|
145
147
|
|
146
|
-
expect {lib.push('remote', nil, nil, :delete => 'master')}.should raise_error GitProc::GitProcessError
|
148
|
+
expect { lib.push('remote', nil, nil, :delete => 'master') }.should raise_error GitProc::GitProcessError
|
147
149
|
end
|
148
150
|
|
149
151
|
end
|
@@ -152,6 +154,7 @@ describe GitProc::GitLib do
|
|
152
154
|
describe "#remote_name" do
|
153
155
|
include GitRepoHelper
|
154
156
|
|
157
|
+
|
155
158
|
def log_level
|
156
159
|
Logger::ERROR
|
157
160
|
end
|
data/spec/git_process_spec.rb
CHANGED
@@ -5,13 +5,14 @@ require 'fileutils'
|
|
5
5
|
describe GitProc::Process do
|
6
6
|
include GitRepoHelper
|
7
7
|
|
8
|
+
|
8
9
|
def log_level
|
9
10
|
Logger::ERROR
|
10
11
|
end
|
11
12
|
|
12
13
|
|
13
14
|
before(:each) do
|
14
|
-
create_files(
|
15
|
+
create_files(%w(.gitignore))
|
15
16
|
gitprocess.commit('initial')
|
16
17
|
end
|
17
18
|
|
data/spec/git_status_spec.rb
CHANGED
@@ -5,6 +5,7 @@ require 'fileutils'
|
|
5
5
|
describe GitProc::GitStatus do
|
6
6
|
include GitRepoHelper
|
7
7
|
|
8
|
+
|
8
9
|
def log_level
|
9
10
|
Logger::ERROR
|
10
11
|
end
|
@@ -39,7 +40,7 @@ describe GitProc::GitStatus do
|
|
39
40
|
|
40
41
|
gitprocess.merge('fb') rescue
|
41
42
|
|
42
|
-
|
43
|
+
status = gitprocess.status
|
43
44
|
status.unmerged.should == ['a']
|
44
45
|
status.modified.should == ['a']
|
45
46
|
end
|
@@ -54,7 +55,7 @@ describe GitProc::GitStatus do
|
|
54
55
|
|
55
56
|
gitprocess.merge('fb') rescue
|
56
57
|
|
57
|
-
|
58
|
+
status = gitprocess.status
|
58
59
|
status.unmerged.should == ['a']
|
59
60
|
status.added.should == ['a']
|
60
61
|
end
|
@@ -72,7 +73,7 @@ describe GitProc::GitStatus do
|
|
72
73
|
|
73
74
|
gitprocess.merge('fb') rescue
|
74
75
|
|
75
|
-
|
76
|
+
status = gitprocess.status
|
76
77
|
status.unmerged.should == ['a']
|
77
78
|
status.deleted.should == ['a']
|
78
79
|
end
|
@@ -90,7 +91,7 @@ describe GitProc::GitStatus do
|
|
90
91
|
|
91
92
|
gitprocess.merge('fb') rescue
|
92
93
|
|
93
|
-
|
94
|
+
status = gitprocess.status
|
94
95
|
status.unmerged.should == ['a']
|
95
96
|
status.deleted.should == ['a']
|
96
97
|
end
|
@@ -9,6 +9,7 @@ require 'tempfile'
|
|
9
9
|
describe GitHub::PullRequest do
|
10
10
|
include GitRepoHelper
|
11
11
|
|
12
|
+
|
12
13
|
def lib
|
13
14
|
unless @lib
|
14
15
|
@lib = double('lib')
|
@@ -38,7 +39,7 @@ describe GitHub::PullRequest do
|
|
38
39
|
|
39
40
|
it "should return a pull request for a good request" do
|
40
41
|
stub_request(:post, "https://api.github.com/repos/test_repo/pulls?access_token=#{test_token}").
|
41
|
-
|
42
|
+
to_return(:status => 200, :body => JSON({:number => 1, :state => 'open'}))
|
42
43
|
|
43
44
|
pull_request.create('test_base', 'test_head', 'test title', 'test body')[:state].should == 'open'
|
44
45
|
end
|
@@ -47,11 +48,11 @@ describe GitHub::PullRequest do
|
|
47
48
|
it "should handle asking for a duplicate pull request" do
|
48
49
|
# trying to create the request should return "HTTP 422: Unprocessable Entity" because it already exists
|
49
50
|
stub_request(:post, "https://api.github.com/repos/test_repo/pulls?access_token=#{test_token}").
|
50
|
-
|
51
|
+
to_return(:status => 422)
|
51
52
|
|
52
53
|
# listing all existing pull requests should contain the current branch
|
53
54
|
stub_request(:get, /test_repo\/pulls\?access_token=/).
|
54
|
-
|
55
|
+
to_return(:status => 200, :body => JSON([{:html_url => 'test_url', :head => {:ref => 'test_head'}, :base => {:ref => 'test_base'}}]))
|
55
56
|
|
56
57
|
pull_request.create('test_base', 'test_head', 'test title', 'test body')[:html_url].should == 'test_url'
|
57
58
|
end
|
@@ -63,9 +64,9 @@ describe GitHub::PullRequest do
|
|
63
64
|
|
64
65
|
it "should close a good current pull request" do
|
65
66
|
stub_request(:get, /test_repo\/pulls\?access_token=/).
|
66
|
-
|
67
|
+
to_return(:status => 200, :body => JSON([{:number => 1, :state => 'open', :html_url => 'test_url', :head => {:ref => 'test_head'}, :base => {:ref => 'test_base'}}]))
|
67
68
|
stub_request(:patch, /test_repo\/pulls\/1\?access_token=/).with(:body => JSON({:state => 'closed'})).
|
68
|
-
|
69
|
+
to_return(:status => 200, :body => JSON({:number => 1, :state => 'closed', :html_url => 'test_url', :head => {:ref => 'test_head'}, :base => {:ref => 'test_base'}}))
|
69
70
|
|
70
71
|
pull_request.close('test_base', 'test_head')[:state].should == 'closed'
|
71
72
|
end
|
@@ -73,7 +74,7 @@ describe GitHub::PullRequest do
|
|
73
74
|
|
74
75
|
it "should close a good current pull request using the pull request number" do
|
75
76
|
stub_request(:patch, /test_repo\/pulls\/1\?access_token=/).with(:body => JSON({:state => 'closed'})).
|
76
|
-
|
77
|
+
to_return(:status => 200, :body => JSON({:number => 1, :state => 'closed', :html_url => 'test_url', :head => {:ref => 'test_head'}, :base => {:ref => 'test_base'}}))
|
77
78
|
|
78
79
|
pull_request.close(1)[:state].should == 'closed'
|
79
80
|
end
|
@@ -81,9 +82,9 @@ describe GitHub::PullRequest do
|
|
81
82
|
|
82
83
|
it "should complain about a missing pull request" do
|
83
84
|
stub_request(:get, /test_repo\/pulls\?access_token=/).
|
84
|
-
|
85
|
+
to_return(:status => 200, :body => JSON([{:number => 1, :state => 'open', :html_url => 'test_url', :head => {:ref => 'test_head'}, :base => {:ref => 'test_base'}}]))
|
85
86
|
|
86
|
-
expect {pull_request.close('test_base', 'missing_head')}.should raise_error GitHub::PullRequest::NotFoundError
|
87
|
+
expect { pull_request.close('test_base', 'missing_head') }.should raise_error GitHub::PullRequest::NotFoundError
|
87
88
|
end
|
88
89
|
|
89
90
|
end
|
data/spec/github_service_spec.rb
CHANGED
@@ -11,6 +11,7 @@ require 'rspec/mocks/mock'
|
|
11
11
|
class GHS
|
12
12
|
include GitHubService
|
13
13
|
|
14
|
+
|
14
15
|
def initialize(user = nil, password = nil, site = nil)
|
15
16
|
@user = user
|
16
17
|
@password = password
|
@@ -24,6 +25,7 @@ class GHS
|
|
24
25
|
@lib.stub(:logger).and_return(logger)
|
25
26
|
end
|
26
27
|
|
28
|
+
|
27
29
|
def lib
|
28
30
|
@lib
|
29
31
|
end
|
@@ -52,7 +54,7 @@ describe GitHubService do
|
|
52
54
|
ghs.lib.should_receive(:config).with('gitProcess.github.authToken', anything).once
|
53
55
|
|
54
56
|
stub_request(:post, /api.github.com\/authorizations/).
|
55
|
-
|
57
|
+
to_return(:status => 200, :body => JSON({:token => test_token}))
|
56
58
|
|
57
59
|
ghs.create_authorization().should == test_token
|
58
60
|
end
|
@@ -60,7 +62,7 @@ describe GitHubService do
|
|
60
62
|
|
61
63
|
it "should 401 for bad password" do
|
62
64
|
stub_request(:post, /api.github.com\/authorizations/).
|
63
|
-
|
65
|
+
to_return(:status => 401)
|
64
66
|
|
65
67
|
lambda { ghs.create_authorization() }.should raise_error Octokit::Unauthorized
|
66
68
|
end
|
@@ -88,7 +90,7 @@ describe GitHubService do
|
|
88
90
|
ghs.lib.should_receive(:config).with('gitProcess.github.authToken', anything).once
|
89
91
|
|
90
92
|
stub_request(:post, /api.github.com\/authorizations/).
|
91
|
-
|
93
|
+
to_return(:status => 200, :body => JSON({:token => test_token}))
|
92
94
|
|
93
95
|
ghs.auth_token.should == test_token
|
94
96
|
end
|
@@ -130,7 +132,7 @@ describe GitHubService do
|
|
130
132
|
ghs.lib.should_receive(:config).with('gitProcess.github.authToken', anything).once
|
131
133
|
|
132
134
|
stub_request(:post, /myco.com\/api\/v3\/authorizations/).
|
133
|
-
|
135
|
+
to_return(:status => 200, :body => JSON({:token => test_token}))
|
134
136
|
|
135
137
|
ghs.create_authorization().should == test_token
|
136
138
|
end
|
@@ -167,14 +169,14 @@ describe GitHubService do
|
|
167
169
|
it "site should raise an error if remote.origin.url not set" do
|
168
170
|
ghs.lib.stub(:config).with('remote.origin.url').and_return('')
|
169
171
|
|
170
|
-
lambda {ghs.site}.should raise_error GitHubService::NoRemoteRepository
|
172
|
+
lambda { ghs.site }.should raise_error GitHubService::NoRemoteRepository
|
171
173
|
end
|
172
174
|
|
173
175
|
|
174
176
|
it "site should not work for a garbase url address" do
|
175
177
|
ghs.lib.stub(:config).with('remote.origin.url').and_return('garbage')
|
176
178
|
|
177
|
-
lambda {ghs.site}.should raise_error URI::InvalidURIError
|
179
|
+
lambda { ghs.site }.should raise_error URI::InvalidURIError
|
178
180
|
end
|
179
181
|
|
180
182
|
|
@@ -196,8 +198,8 @@ describe GitHubService do
|
|
196
198
|
ghs.lib.stub(:config).with('remote.origin.url').and_return('mygithub:jdigger/git-process.git')
|
197
199
|
|
198
200
|
content = "\nHost mygithub\n"+
|
199
|
-
|
200
|
-
|
201
|
+
" User git\n"+
|
202
|
+
" HostName github.myco.com\n"
|
201
203
|
|
202
204
|
in_tempfile(content) do |file|
|
203
205
|
ghs.site(:ssh_config_file => file.path).should == 'http://github.myco.com'
|
@@ -6,6 +6,7 @@ require 'json'
|
|
6
6
|
describe GitProc::RebaseToMaster do
|
7
7
|
include GitRepoHelper
|
8
8
|
|
9
|
+
|
9
10
|
def log_level
|
10
11
|
Logger::ERROR
|
11
12
|
end
|
@@ -67,7 +68,7 @@ describe GitProc::RebaseToMaster do
|
|
67
68
|
# Merge in the new branch; don't error-out because will auto-fix.
|
68
69
|
gitprocess.checkout('fb') do
|
69
70
|
gitprocess.merge('master') rescue
|
70
|
-
|
71
|
+
change_file_and_commit('a', 'merged')
|
71
72
|
end
|
72
73
|
|
73
74
|
# Make another change on master
|
@@ -98,7 +99,7 @@ describe GitProc::RebaseToMaster do
|
|
98
99
|
gitprocess.checkout('_parking_', :new_branch => 'master')
|
99
100
|
change_file_and_commit('a', '')
|
100
101
|
|
101
|
-
expect {gitprocess.verify_preconditions}.should raise_error GitProc::ParkedChangesError
|
102
|
+
expect { gitprocess.verify_preconditions }.should raise_error GitProc::ParkedChangesError
|
102
103
|
end
|
103
104
|
end
|
104
105
|
|
@@ -107,10 +108,10 @@ describe GitProc::RebaseToMaster do
|
|
107
108
|
|
108
109
|
it "should work for an existing pull request" do
|
109
110
|
stub_request(:get, /test_repo\/pulls\?access_token=/).
|
110
|
-
|
111
|
+
to_return(:status => 200, :body => JSON([{:number => 987, :state => 'open', :html_url => 'test_url', :head => {:ref => 'fb'}, :base => {:ref => 'master'}}]))
|
111
112
|
stub_request(:patch, /test_repo\/pulls\/987\?access_token=/).
|
112
|
-
|
113
|
-
|
113
|
+
with(:body => JSON({:state => 'closed'})).
|
114
|
+
to_return(:status => 200, :body => JSON([{:number => 987, :state => 'closed', :html_url => 'test_url', :head => {:ref => 'fb'}, :base => {:ref => 'master'}}]))
|
114
115
|
|
115
116
|
gitprocess.branch('fb', :base_branch => 'master')
|
116
117
|
|
@@ -276,7 +277,7 @@ describe GitProc::RebaseToMaster do
|
|
276
277
|
|
277
278
|
gp.branches.include?('fb').should be_true
|
278
279
|
|
279
|
-
expect {gp.remove_feature_branch}.should raise_error GitProc::GitProcessError
|
280
|
+
expect { gp.remove_feature_branch }.should raise_error GitProc::GitProcessError
|
280
281
|
end
|
281
282
|
end
|
282
283
|
|
data/spec/sync_spec.rb
CHANGED
@@ -5,7 +5,7 @@ describe GitProc::Sync do
|
|
5
5
|
include GitRepoHelper
|
6
6
|
|
7
7
|
before(:each) do
|
8
|
-
create_files(
|
8
|
+
create_files(%w(.gitignore))
|
9
9
|
gitprocess.commit('initial')
|
10
10
|
end
|
11
11
|
|
@@ -53,42 +53,54 @@ describe GitProc::Sync do
|
|
53
53
|
end
|
54
54
|
|
55
55
|
|
56
|
-
|
57
|
-
change_file_and_commit('a', '')
|
56
|
+
describe "when forcing the push" do
|
58
57
|
|
59
|
-
|
58
|
+
def create_process(dir, opts)
|
59
|
+
GitProc::Sync.new(dir, opts.merge({:rebase => false, :force => true}))
|
60
|
+
end
|
60
61
|
|
61
|
-
|
62
|
-
|
63
|
-
change_file_and_commit('a', '
|
62
|
+
|
63
|
+
it "should work when pushing with non-fast-forward" do
|
64
|
+
change_file_and_commit('a', '')
|
65
|
+
|
66
|
+
gitprocess.branch('fb', :base_branch => 'master')
|
67
|
+
|
68
|
+
clone('fb') do |gp|
|
69
|
+
gitprocess.checkout('fb') do
|
70
|
+
change_file_and_commit('a', 'hello', gitprocess)
|
71
|
+
end
|
72
|
+
|
73
|
+
expect {
|
74
|
+
GitProc::Sync.new(gp.workdir, {:rebase => false, :force => true, :log_level => log_level}).runner
|
75
|
+
}.to_not raise_error GitProc::GitExecuteError
|
76
|
+
end
|
64
77
|
end
|
65
78
|
|
66
|
-
expect {
|
67
|
-
GitProc::Sync.new(gp.workdir, {:rebase => false, :force => false, :log_level => log_level}).runner
|
68
|
-
}.should raise_error GitProc::GitExecuteError
|
69
79
|
end
|
70
80
|
|
71
81
|
|
72
|
-
describe "when
|
82
|
+
describe "when changes are made upstream" do
|
73
83
|
|
74
84
|
def create_process(dir, opts)
|
75
|
-
GitProc::Sync.new(dir, opts.merge({:rebase => false, :force =>
|
85
|
+
GitProc::Sync.new(dir, opts.merge({:rebase => false, :force => false}))
|
76
86
|
end
|
77
87
|
|
78
88
|
|
79
|
-
it "should work when pushing with non-fast-forward" do
|
89
|
+
it "should work when pushing with non-fast-forward by merging" do
|
80
90
|
change_file_and_commit('a', '')
|
81
91
|
|
82
92
|
gitprocess.branch('fb', :base_branch => 'master')
|
83
93
|
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
94
|
+
clone('fb') do |gp|
|
95
|
+
|
96
|
+
gitprocess.checkout('fb') do
|
97
|
+
change_file_and_commit('a', 'hello', gitprocess)
|
98
|
+
end
|
88
99
|
|
89
|
-
|
90
|
-
|
91
|
-
|
100
|
+
expect {
|
101
|
+
gp.runner
|
102
|
+
}.to_not raise_error GitProc::GitExecuteError
|
103
|
+
end
|
92
104
|
end
|
93
105
|
|
94
106
|
end
|
@@ -111,7 +123,7 @@ describe GitProc::Sync do
|
|
111
123
|
change_file_and_commit('a', 'hello', gitprocess)
|
112
124
|
end
|
113
125
|
|
114
|
-
expect {gp.runner}.
|
126
|
+
expect { gp.runner }.to_not raise_error GitProc::GitExecuteError
|
115
127
|
end
|
116
128
|
end
|
117
129
|
|
@@ -145,6 +157,28 @@ describe GitProc::Sync do
|
|
145
157
|
end
|
146
158
|
|
147
159
|
|
160
|
+
describe "when there is no remote" do
|
161
|
+
|
162
|
+
def create_process(dir, opts)
|
163
|
+
GitProc::Sync.new(dir, opts.merge({:rebase => true, :force => false, :local => false}))
|
164
|
+
end
|
165
|
+
|
166
|
+
|
167
|
+
it "should not try to fetch or push" do
|
168
|
+
change_file_and_commit('a', '')
|
169
|
+
|
170
|
+
gitprocess.branch('fb', :base_branch => 'master')
|
171
|
+
|
172
|
+
sp = GitProc::Sync.new(gitprocess.workdir, {:rebase => true, :force => false, :local => true, :log_level => log_level})
|
173
|
+
sp.should_not_receive(:fetch)
|
174
|
+
sp.should_not_receive(:push)
|
175
|
+
|
176
|
+
sp.runner
|
177
|
+
end
|
178
|
+
|
179
|
+
end
|
180
|
+
|
181
|
+
|
148
182
|
it "should work with a different remote server name than 'origin'" do
|
149
183
|
change_file_and_commit('a', '')
|
150
184
|
|
@@ -163,7 +197,7 @@ describe GitProc::Sync do
|
|
163
197
|
gitprocess.checkout('_parking_', :new_branch => 'master')
|
164
198
|
change_file_and_commit('a', '')
|
165
199
|
|
166
|
-
expect {gitprocess.verify_preconditions}.
|
200
|
+
expect { gitprocess.verify_preconditions }.to raise_error GitProc::ParkedChangesError
|
167
201
|
end
|
168
202
|
|
169
203
|
end
|