git_helper 3.6.0 → 3.6.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e4cab8515ee7c8c8e345b477178e3352c600ff5db7bab81e8c3479c7db13bc7a
4
- data.tar.gz: 53d031494e6e52826f7911c8f06337e82853f069e3cbfc18275d5f918886a443
3
+ metadata.gz: 64c4ad9b8acf74b29b341f534243721f4bf168d1d15c524e052a201b867e9c6d
4
+ data.tar.gz: '01228b5f41daa653e47e11a33f5cde747edfc795759ab5b7c0b474d655538431'
5
5
  SHA512:
6
- metadata.gz: 446213efbe6058b0ab790750b390a05dfb7b47793554667ceb20a1c2720a9140c10e2aa9368d2127b62dce538b60b19826c9a9b6380ca88ff7046194e4cf20b9
7
- data.tar.gz: 9db27ee02e2cc0a5f343b4c0f32b022cc9cbab48e152bb03c38ce8c8360258d9ff68be8154955653fd14b5d3f0c2184ea778ce0fe820b955a3e0b16f00bb78ca
6
+ metadata.gz: 90f31e2053f842aaa9a536de4a79c9e2e066fd08c8703367520b2728e39a3b9aa88374230fbc2211993c709077cc573272e2e79dc996d5009dbdd864986c0541
7
+ data.tar.gz: e683017056105ba89126467da7cea039ee7c0d88350f8971ed0e130d85fcc0e2ea383600e7e88c01806d68540e2183bb5e30f6a8130d9fbabdce4bcbba545ab8
data/Gemfile.lock CHANGED
@@ -1,48 +1,22 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- git_helper (3.5.1)
5
- gitlab
6
- gli
7
- highline_wrapper
8
- octokit
4
+ git_helper (3.6.1.pre.test)
5
+ gli (~> 2.13)
6
+ highline_wrapper (~> 1.1)
9
7
 
10
8
  GEM
11
9
  remote: https://rubygems.org/
12
10
  specs:
13
- addressable (2.8.0)
14
- public_suffix (>= 2.0.2, < 5.0)
15
11
  ast (2.4.2)
16
12
  coderay (1.1.3)
17
- concurrent-ruby (1.1.9)
18
- diff-lcs (1.4.4)
19
- faker (2.19.0)
20
- i18n (>= 1.6, < 2)
21
- faraday (1.8.0)
22
- faraday-em_http (~> 1.0)
23
- faraday-em_synchrony (~> 1.0)
24
- faraday-excon (~> 1.1)
25
- faraday-httpclient (~> 1.0.1)
26
- faraday-net_http (~> 1.0)
27
- faraday-net_http_persistent (~> 1.1)
28
- faraday-patron (~> 1.0)
29
- faraday-rack (~> 1.0)
30
- multipart-post (>= 1.2, < 3)
31
- ruby2_keywords (>= 0.0.4)
32
- faraday-em_http (1.0.0)
33
- faraday-em_synchrony (1.0.0)
34
- faraday-excon (1.1.0)
35
- faraday-httpclient (1.0.1)
36
- faraday-net_http (1.0.1)
37
- faraday-net_http_persistent (1.2.0)
38
- faraday-patron (1.0.0)
39
- faraday-rack (1.0.0)
40
- ffi (1.15.4)
41
- formatador (0.3.0)
42
- gitlab (4.17.0)
43
- httparty (~> 0.18)
44
- terminal-table (~> 1.5, >= 1.5.1)
45
- gli (2.20.1)
13
+ concurrent-ruby (1.1.10)
14
+ diff-lcs (1.5.0)
15
+ faker (3.0.0)
16
+ i18n (>= 1.8.11, < 2)
17
+ ffi (1.15.5)
18
+ formatador (1.1.0)
19
+ gli (2.21.0)
46
20
  guard (2.18.0)
47
21
  formatador (>= 0.2.4)
48
22
  listen (>= 2.7, < 4.0)
@@ -58,88 +32,74 @@ GEM
58
32
  guard-compat (~> 1.1)
59
33
  rspec (>= 2.99.0, < 4.0)
60
34
  highline (2.0.3)
61
- highline_wrapper (1.3.0)
35
+ highline_wrapper (1.3.1)
62
36
  highline (~> 2.0)
63
- httparty (0.20.0)
64
- mime-types (~> 3.0)
65
- multi_xml (>= 0.5.2)
66
- i18n (1.8.10)
37
+ i18n (1.12.0)
67
38
  concurrent-ruby (~> 1.0)
68
- listen (3.7.0)
39
+ json (2.6.3)
40
+ listen (3.7.1)
69
41
  rb-fsevent (~> 0.10, >= 0.10.3)
70
42
  rb-inotify (~> 0.9, >= 0.9.10)
71
43
  lumberjack (1.2.8)
72
44
  method_source (1.0.0)
73
- mime-types (3.3.1)
74
- mime-types-data (~> 3.2015)
75
- mime-types-data (3.2021.0901)
76
- multi_xml (0.6.0)
77
- multipart-post (2.1.1)
78
45
  nenv (0.3.0)
79
46
  notiffany (0.1.3)
80
47
  nenv (~> 0.1)
81
48
  shellany (~> 0.0)
82
- octokit (4.21.0)
83
- faraday (>= 0.9)
84
- sawyer (~> 0.8.0, >= 0.5.3)
85
- parallel (1.21.0)
86
- parser (3.0.2.0)
49
+ parallel (1.22.1)
50
+ parser (3.1.3.0)
87
51
  ast (~> 2.4.1)
88
52
  pry (0.14.1)
89
53
  coderay (~> 1.1)
90
54
  method_source (~> 1.0)
91
- public_suffix (4.0.6)
92
- rainbow (3.0.0)
93
- rb-fsevent (0.11.0)
55
+ rainbow (3.1.1)
56
+ rb-fsevent (0.11.2)
94
57
  rb-inotify (0.10.1)
95
58
  ffi (~> 1.0)
96
- regexp_parser (2.1.1)
59
+ regexp_parser (2.6.1)
97
60
  rexml (3.2.5)
98
- rspec (3.10.0)
99
- rspec-core (~> 3.10.0)
100
- rspec-expectations (~> 3.10.0)
101
- rspec-mocks (~> 3.10.0)
102
- rspec-core (3.10.1)
103
- rspec-support (~> 3.10.0)
104
- rspec-expectations (3.10.1)
61
+ rspec (3.12.0)
62
+ rspec-core (~> 3.12.0)
63
+ rspec-expectations (~> 3.12.0)
64
+ rspec-mocks (~> 3.12.0)
65
+ rspec-core (3.12.0)
66
+ rspec-support (~> 3.12.0)
67
+ rspec-expectations (3.12.1)
105
68
  diff-lcs (>= 1.2.0, < 2.0)
106
- rspec-support (~> 3.10.0)
107
- rspec-mocks (3.10.2)
69
+ rspec-support (~> 3.12.0)
70
+ rspec-mocks (3.12.1)
108
71
  diff-lcs (>= 1.2.0, < 2.0)
109
- rspec-support (~> 3.10.0)
110
- rspec-support (3.10.2)
111
- rubocop (1.22.1)
72
+ rspec-support (~> 3.12.0)
73
+ rspec-support (3.12.0)
74
+ rubocop (1.40.0)
75
+ json (~> 2.3)
112
76
  parallel (~> 1.10)
113
- parser (>= 3.0.0.0)
77
+ parser (>= 3.1.2.1)
114
78
  rainbow (>= 2.2.2, < 4.0)
115
79
  regexp_parser (>= 1.8, < 3.0)
116
- rexml
117
- rubocop-ast (>= 1.12.0, < 2.0)
80
+ rexml (>= 3.2.5, < 4.0)
81
+ rubocop-ast (>= 1.23.0, < 2.0)
118
82
  ruby-progressbar (~> 1.7)
119
83
  unicode-display_width (>= 1.4.0, < 3.0)
120
- rubocop-ast (1.12.0)
121
- parser (>= 3.0.1.1)
84
+ rubocop-ast (1.24.0)
85
+ parser (>= 3.1.1.0)
122
86
  ruby-progressbar (1.11.0)
123
- ruby2_keywords (0.0.5)
124
- sawyer (0.8.2)
125
- addressable (>= 2.3.5)
126
- faraday (> 0.8, < 2.0)
127
87
  shellany (0.0.1)
128
- terminal-table (1.6.0)
129
- thor (1.1.0)
130
- unicode-display_width (2.1.0)
88
+ thor (1.2.1)
89
+ unicode-display_width (2.3.0)
131
90
 
132
91
  PLATFORMS
133
- x86_64-darwin-19
92
+ arm64-darwin-21
93
+ arm64-darwin-22
134
94
 
135
95
  DEPENDENCIES
136
- bundler
137
- faker
96
+ bundler (~> 2.2)
97
+ faker (~> 3.0)
138
98
  git_helper!
139
- guard-rspec
140
- pry
141
- rspec
142
- rubocop
99
+ guard-rspec (~> 4.3)
100
+ pry (~> 0.13)
101
+ rspec (~> 3.9)
102
+ rubocop (~> 1.10)
143
103
 
144
104
  BUNDLED WITH
145
- 2.2.29
105
+ 2.3.26
data/Guardfile CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  guard :rspec, cmd: 'bundle exec rspec', all_on_start: true do
4
+ watch('spec/spec_helper.rb') { 'spec' }
5
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
4
6
  watch(%r{^spec/.+_spec\.rb$})
5
- watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
6
- watch('spec/spec_helper.rb') { 'spec' }
7
7
  end
@@ -108,7 +108,7 @@ module GitHelper
108
108
  # rubocop:enable Metrics/AbcSize
109
109
 
110
110
  def read_template(file_name)
111
- File.open(file_name).read
111
+ File.read(file_name)
112
112
  end
113
113
 
114
114
  # rubocop:disable Metrics/AbcSize
@@ -122,14 +122,14 @@ module GitHelper
122
122
  branch_arr.first.capitalize
123
123
  elsif branch_arr[0].scan(/(\w+)/).any? && branch_arr[1].scan(/(\d+)/).any? # branch includes jira_123 at beginning
124
124
  issue = "#{branch_arr[0].upcase}-#{branch_arr[1]}"
125
- description = branch_arr[2..-1].join(' ')
125
+ description = branch_arr[2..].join(' ')
126
126
  "#{issue} #{description.capitalize}"
127
127
  elsif branch_arr[0].scan(/(\w+-\d+)/).any? # branch includes string jira-123 at beginning
128
128
  issue = branch_arr[0].upcase
129
- description = branch_arr[1..-1].join(' ')
129
+ description = branch_arr[1..].join(' ')
130
130
  "#{issue} #{description.capitalize}"
131
131
  else # plain words
132
- branch_arr[0..-1].join(' ').capitalize
132
+ branch_arr[0..].join(' ').capitalize
133
133
  end
134
134
  end
135
135
  # rubocop:enable Metrics/MethodLength
@@ -29,21 +29,16 @@ module GitHelper
29
29
  puts "Creating merge request: #{new_mr_title}"
30
30
  mr = gitlab_client.create_merge_request(local_project, options)
31
31
 
32
- raise StandardError, mr.message if mr.diff_refs.nil? || mr.web_url.nil?
33
-
34
- if mr.diff_refs['base_sha'] == mr.diff_refs['head_sha']
32
+ if mr.web_url && mr.diff_refs && (mr.diff_refs['base_sha'] == mr.diff_refs['head_sha'])
35
33
  puts "Merge request was created, but no commits have been pushed to GitLab: #{mr.web_url}"
36
- else
34
+ elsif mr.web_url
37
35
  puts "Merge request successfully created: #{mr.web_url}"
36
+ else
37
+ raise StandardError, (mr.message.instance_of?(Array) ? mr.message.first : mr.message)
38
38
  end
39
39
  rescue StandardError => e
40
40
  puts 'Could not create merge request:'
41
-
42
- if e.message.include?('Another open merge request already exists')
43
- puts ' A merge request already exists for this branch'
44
- else
45
- puts " #{e.message}"
46
- end
41
+ puts " #{e.message}"
47
42
  end
48
43
  # rubocop:enable Metrics/AbcSize
49
44
  # rubocop:enable Metrics/MethodLength
@@ -32,8 +32,8 @@ module GitHelper
32
32
  return unless answer
33
33
 
34
34
  create_or_update_plugin_files
35
- puts "\nNow add this line to your ~/.bash_profile:\n" \
36
- ' export PATH=/path/to/computer/home/.git_helper/plugins:$PATH'
35
+ puts "\nNow add this line to your ~/.bash_profile:\n " \
36
+ 'export PATH=/path/to/computer/home/.git_helper/plugins:$PATH'
37
37
  puts "\nDone!"
38
38
  end
39
39
 
@@ -66,8 +66,8 @@ module GitHelper
66
66
  file_contents << ":gitlab_user: #{ask_question('GitLab username?')}\n"
67
67
  file_contents << ':gitlab_token: ' \
68
68
  "#{ask_question(
69
- 'GitLab personal access token? (Navigate to https://gitlab.com/-/profile/personal_access_tokens' \
70
- ' to create a new personal access token)',
69
+ 'GitLab personal access token? (Navigate to https://gitlab.com/-/profile/personal_access_tokens ' \
70
+ 'to create a new personal access token)',
71
71
  secret: true
72
72
  )}\n"
73
73
  end
@@ -81,7 +81,6 @@ module GitHelper
81
81
  end
82
82
 
83
83
  # rubocop:disable Metrics/MethodLength
84
- # rubocop:disable Metrics/AbcSize
85
84
  private def create_or_update_plugin_files
86
85
  plugins_dir = "#{Dir.pwd.scan(%r{\A/\w*/\w*/}).first}.git_helper/plugins"
87
86
  plugins_url = 'https://api.github.com/repos/emmahsax/git_helper/contents/plugins'
@@ -89,7 +88,7 @@ module GitHelper
89
88
  token = git_config_reader.github_token
90
89
  user = git_config_reader.github_user
91
90
 
92
- Dir.mkdir(plugins_dir) unless File.exist?(plugins_dir)
91
+ FileUtils.mkdir_p(plugins_dir)
93
92
 
94
93
  all_plugins = JSON.parse(`curl -s -u #{user}:#{token} -H "#{header}" -L "#{plugins_url}"`)
95
94
 
@@ -99,7 +98,6 @@ module GitHelper
99
98
  end
100
99
  end
101
100
  # rubocop:enable Metrics/MethodLength
102
- # rubocop:enable Metrics/AbcSize
103
101
 
104
102
  private def config_file
105
103
  git_config_reader.git_config_file_path
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GitHelper
4
- VERSION = '3.6.0'
4
+ VERSION = '3.6.2'
5
5
  end
data/lib/git_helper.rb CHANGED
@@ -6,7 +6,7 @@ require 'highline_wrapper'
6
6
 
7
7
  files = "#{File.expand_path(File.join(File.dirname(File.absolute_path(__FILE__)), 'git_helper'))}/**/*.rb"
8
8
 
9
- Dir[files].each do |file|
9
+ Dir[files].sort.each do |file|
10
10
  require_relative file
11
11
  end
12
12
 
data/renovate.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "$schema": "https://docs.renovatebot.com/renovate-schema.json",
3
+ "extends": [
4
+ "config:base"
5
+ ]
6
+ }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git_helper
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.6.0
4
+ version: 3.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Emma Sax
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-10-09 00:00:00.000000000 Z
11
+ date: 2022-12-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gli
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '2.15'
61
+ version: '3.0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '2.15'
68
+ version: '3.0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: guard-rspec
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -154,25 +154,12 @@ files:
154
154
  - lib/git_helper/setup.rb
155
155
  - lib/git_helper/version.rb
156
156
  - plugins.zip
157
- - spec/git_helper/change_remote_spec.rb
158
- - spec/git_helper/checkout_default_spec.rb
159
- - spec/git_helper/clean_branches_spec.rb
160
- - spec/git_helper/code_request_spec.rb
161
- - spec/git_helper/empty_commit_spec.rb
162
- - spec/git_helper/forget_local_commits_spec.rb
163
- - spec/git_helper/git_config_reader_spec.rb
164
- - spec/git_helper/github_client_spec.rb
165
- - spec/git_helper/gitlab_client_spec.rb
166
- - spec/git_helper/local_code_spec.rb
167
- - spec/git_helper/merge_request_spec.rb
168
- - spec/git_helper/new_branch_spec.rb
169
- - spec/git_helper/pull_request_spec.rb
170
- - spec/git_helper/setup_spec.rb
171
- - spec/spec_helper.rb
157
+ - renovate.json
172
158
  homepage: https://github.com/emmahsax/git_helper
173
159
  licenses:
174
160
  - BSD-3-Clause
175
- metadata: {}
161
+ metadata:
162
+ rubygems_mfa_required: 'true'
176
163
  post_install_message:
177
164
  rdoc_options: []
178
165
  require_paths:
@@ -188,23 +175,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
188
175
  - !ruby/object:Gem::Version
189
176
  version: '0'
190
177
  requirements: []
191
- rubygems_version: 3.2.22
178
+ rubygems_version: 3.3.26
192
179
  signing_key:
193
180
  specification_version: 4
194
181
  summary: A set of GitHub and GitLab workflow scripts
195
- test_files:
196
- - spec/spec_helper.rb
197
- - spec/git_helper/change_remote_spec.rb
198
- - spec/git_helper/checkout_default_spec.rb
199
- - spec/git_helper/clean_branches_spec.rb
200
- - spec/git_helper/code_request_spec.rb
201
- - spec/git_helper/empty_commit_spec.rb
202
- - spec/git_helper/forget_local_commits_spec.rb
203
- - spec/git_helper/git_config_reader_spec.rb
204
- - spec/git_helper/github_client_spec.rb
205
- - spec/git_helper/gitlab_client_spec.rb
206
- - spec/git_helper/local_code_spec.rb
207
- - spec/git_helper/merge_request_spec.rb
208
- - spec/git_helper/new_branch_spec.rb
209
- - spec/git_helper/pull_request_spec.rb
210
- - spec/git_helper/setup_spec.rb
182
+ test_files: []
@@ -1,176 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
- require 'git_helper'
5
-
6
- describe GitHelper::ChangeRemote do
7
- let(:remote1) { "git@github.com:#{old_owner}/#{project}.git" }
8
- let(:project) { Faker::Lorem.word }
9
- let(:highline_wrapper) { double(:highline_wrapper, ask_yes_no: true) }
10
- let(:old_owner) { Faker::Internet.username }
11
- let(:new_owner) { Faker::Internet.username }
12
- let(:directory_entries) { ['.', '..', project, Faker::Lorem.word, Faker::Lorem.word] }
13
-
14
- let(:local_code) do
15
- double(:local_code,
16
- remotes: [remote1],
17
- remote_name: Faker::Lorem.word,
18
- ssh_remote?: true,
19
- https_remote?: false,
20
- remote_project: project,
21
- remote_source: 'github.com',
22
- change_remote: true)
23
- end
24
-
25
- subject { GitHelper::ChangeRemote.new(old_owner, new_owner) }
26
-
27
- before do
28
- allow(HighlineWrapper).to receive(:new).and_return(highline_wrapper)
29
- allow(GitHelper::LocalCode).to receive(:new).and_return(local_code)
30
- allow(subject).to receive(:puts)
31
- end
32
-
33
- describe '#execute' do
34
- before do
35
- allow(Dir).to receive(:pwd).and_return("/Users/#{Faker::Name.first_name}/#{project}")
36
- allow(Dir).to receive(:entries).and_return(directory_entries)
37
- allow(File).to receive(:join).and_return("/Users/#{Faker::Name.first_name}/#{project}/#{Faker::Lorem.word}")
38
- allow(File).to receive(:directory?).and_return(true)
39
- allow(subject).to receive(:process_dir)
40
- end
41
-
42
- it 'should call to process at least one directory' do
43
- expect(subject).to receive(:process_dir).at_least(:once)
44
- subject.execute
45
- end
46
-
47
- it 'should definitely look in the file structure' do
48
- expect(Dir).to receive(:pwd)
49
- expect(Dir).to receive(:entries)
50
- expect(File).to receive(:join)
51
- expect(File).to receive(:directory?)
52
- subject.execute
53
- end
54
- end
55
-
56
- describe '#process_dir' do
57
- before do
58
- allow(Dir).to receive(:chdir).and_return(nil)
59
- allow(File).to receive(:exist?).and_return(true)
60
- allow(subject).to receive(:process_git_repository)
61
- end
62
-
63
- it 'should definitely look in the file structure' do
64
- expect(Dir).to receive(:chdir)
65
- expect(File).to receive(:exist?)
66
- subject.send(:process_dir, "/Users/#{Faker::Name.first_name}/#{project}", "/Users/#{Faker::Name.first_name}/#{project}/#{Faker::Lorem.word}")
67
- end
68
-
69
- context 'when the user says to process the directory' do
70
- it 'should call to process the git repository at least once' do
71
- expect(subject).to receive(:process_git_repository).at_least(:once)
72
- subject.send(:process_dir, "/Users/#{Faker::Name.first_name}/#{project}", "/Users/#{Faker::Name.first_name}/#{project}/#{Faker::Lorem.word}")
73
- end
74
- end
75
-
76
- context 'when the user says not to process the directory' do
77
- let(:highline_wrapper) { double(:highline_wrapper, ask_yes_no: false) }
78
-
79
- it 'should not call to process the directory' do
80
- expect(subject).not_to receive(:process_git_repository)
81
- subject.send(:process_dir, "/Users/#{Faker::Name.first_name}/#{project}", "/Users/#{Faker::Name.first_name}/#{project}/#{Faker::Lorem.word}")
82
- end
83
- end
84
- end
85
-
86
- describe '#process_git_repository' do
87
- before do
88
- allow(subject).to receive(:process_remote).and_return(nil)
89
- end
90
-
91
- it 'should call local_code' do
92
- expect(GitHelper::LocalCode).to receive(:new)
93
- subject.send(:process_git_repository)
94
- end
95
-
96
- context 'when the remote includes the old owner' do
97
- it 'should call to process the remote' do
98
- expect(subject).to receive(:process_remote)
99
- subject.send(:process_git_repository)
100
- end
101
- end
102
-
103
- context 'when the remote does not include the old owner' do
104
- let(:remote1) { "git@github.com:#{new_owner}/#{project}.git" }
105
-
106
- it 'should not call to process the remote' do
107
- expect(subject).not_to receive(:process_remote)
108
- subject.send(:process_git_repository)
109
- end
110
- end
111
- end
112
-
113
- describe '#process_remote' do
114
- it 'should always get the remote name' do
115
- expect(local_code).to receive(:remote_name)
116
- subject.send(:process_remote, remote1)
117
- end
118
-
119
- it 'should always attempt to change the remote' do
120
- expect(local_code).to receive(:change_remote)
121
- subject.send(:process_remote, remote1)
122
- end
123
-
124
- it 'should attempt to get the remote repo exactly once' do
125
- expect(local_code).to receive(:remote_project).exactly(:once)
126
- subject.send(:process_remote, remote1)
127
- end
128
-
129
- it 'should attempt to get the remote source exactly once' do
130
- expect(local_code).to receive(:remote_source).exactly(:once)
131
- subject.send(:process_remote, remote1)
132
- end
133
-
134
- it 'should ask if the remote is SSH' do
135
- expect(local_code).to receive(:ssh_remote?)
136
- subject.send(:process_remote, remote1)
137
- end
138
-
139
- context 'https remote' do
140
- let(:local_code) do
141
- double(:local_code,
142
- remotes: [remote1],
143
- remote_name: Faker::Lorem.word,
144
- ssh_remote?: false,
145
- https_remote?: false,
146
- remote_project: project,
147
- remote_source: 'github.com',
148
- change_remote: true)
149
- end
150
-
151
- it 'should ask if the remote is SSH' do
152
- expect(local_code).to receive(:ssh_remote?)
153
- subject.send(:process_remote, remote1)
154
- end
155
-
156
- it 'should ask if the remote is https' do
157
- expect(local_code).to receive(:https_remote?)
158
- subject.send(:process_remote, remote1)
159
- end
160
- end
161
- end
162
-
163
- describe '#local_code' do
164
- it 'should create a new local code instance' do
165
- expect(GitHelper::LocalCode).to receive(:new)
166
- subject.send(:local_code)
167
- end
168
- end
169
-
170
- describe '#highline' do
171
- it 'should create a new highline_wrapper instance' do
172
- expect(HighlineWrapper).to receive(:new)
173
- subject.send(:highline)
174
- end
175
- end
176
- end
@@ -1,21 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
- require 'git_helper'
5
-
6
- describe GitHelper::CheckoutDefault do
7
- let(:local_code) { double(:local_code, checkout_default: :done) }
8
-
9
- subject { GitHelper::CheckoutDefault.new }
10
-
11
- it 'should call GitHelper::LocalCode' do
12
- expect(GitHelper::LocalCode).to receive(:new).and_return(local_code)
13
- subject.execute
14
- end
15
-
16
- it 'should call the checkout_default method from the local code class' do
17
- allow(GitHelper::LocalCode).to receive(:new).and_return(local_code)
18
- expect(local_code).to receive(:checkout_default)
19
- subject.execute
20
- end
21
- end
@@ -1,21 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'spec_helper'
4
- require 'git_helper'
5
-
6
- describe GitHelper::CleanBranches do
7
- let(:local_code) { double(:local_code, clean_branches: :commit) }
8
-
9
- subject { GitHelper::CleanBranches.new }
10
-
11
- it 'should call GitHelper::LocalCode' do
12
- expect(GitHelper::LocalCode).to receive(:new).and_return(local_code)
13
- subject.execute
14
- end
15
-
16
- it 'should call the clean_branches method from the local code class' do
17
- allow(GitHelper::LocalCode).to receive(:new).and_return(local_code)
18
- expect(local_code).to receive(:clean_branches)
19
- subject.execute
20
- end
21
- end