git_helper 2.0.0 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +23 -15
  3. data/Guardfile +1 -1
  4. data/README.md +21 -12
  5. data/Rakefile +1 -37
  6. data/bin/git-helper +3 -10
  7. data/lib/git_helper.rb +5 -2
  8. data/lib/git_helper/change_remote.rb +0 -3
  9. data/lib/git_helper/checkout_default.rb +0 -2
  10. data/lib/git_helper/clean_branches.rb +0 -2
  11. data/lib/git_helper/code_request.rb +0 -5
  12. data/lib/git_helper/empty_commit.rb +0 -2
  13. data/lib/git_helper/forget_local_commits.rb +0 -2
  14. data/lib/git_helper/git_config_reader.rb +1 -3
  15. data/lib/git_helper/gitlab_client.rb +0 -3
  16. data/lib/git_helper/highline_cli.rb +0 -2
  17. data/lib/git_helper/local_code.rb +17 -13
  18. data/lib/git_helper/merge_request.rb +1 -4
  19. data/lib/git_helper/new_branch.rb +0 -3
  20. data/lib/git_helper/octokit_client.rb +0 -3
  21. data/lib/git_helper/pull_request.rb +1 -4
  22. data/lib/git_helper/version.rb +1 -1
  23. data/plugins.zip +0 -0
  24. data/spec/git_helper/change_remote_spec.rb +19 -16
  25. data/spec/git_helper/checkout_default_spec.rb +2 -1
  26. data/spec/git_helper/clean_branches_spec.rb +2 -1
  27. data/spec/git_helper/code_request_spec.rb +21 -18
  28. data/spec/git_helper/empty_commit_spec.rb +2 -1
  29. data/spec/git_helper/forget_local_commits_spec.rb +2 -1
  30. data/spec/git_helper/git_config_reader_spec.rb +11 -8
  31. data/spec/git_helper/gitlab_client_spec.rb +2 -1
  32. data/spec/git_helper/highline_cli_spec.rb +40 -37
  33. data/spec/git_helper/local_code_spec.rb +64 -27
  34. data/spec/git_helper/merge_request_spec.rb +36 -28
  35. data/spec/git_helper/new_branch_spec.rb +2 -1
  36. data/spec/git_helper/octokit_client_spec.rb +2 -1
  37. data/spec/git_helper/pull_request_spec.rb +36 -28
  38. data/spec/spec_helper.rb +2 -1
  39. metadata +21 -6
@@ -1,6 +1,3 @@
1
- require_relative './highline_cli.rb'
2
- require_relative './local_code.rb'
3
-
4
1
  module GitHelper
5
2
  class NewBranch
6
3
  def execute(new_branch_name = nil)
@@ -1,6 +1,3 @@
1
- require 'octokit'
2
- require_relative './git_config_reader.rb'
3
-
4
1
  module GitHelper
5
2
  class OctokitClient
6
3
  def client
@@ -1,7 +1,3 @@
1
- require_relative './octokit_client.rb'
2
- require_relative './highline_cli.rb'
3
- require_relative './local_code.rb'
4
-
5
1
  module GitHelper
6
2
  class GitHubPullRequest
7
3
  attr_accessor :local_repo, :local_branch, :local_code, :cli, :base_branch, :new_pr_title
@@ -98,6 +94,7 @@ module GitHelper
98
94
 
99
95
  private def pr_template_options
100
96
  @pr_template_options ||= local_code.template_options({
97
+ template_directory: '.github',
101
98
  nested_directory_name: 'PULL_REQUEST_TEMPLATE',
102
99
  non_nested_file_name: 'pull_request_template'
103
100
  })
@@ -1,3 +1,3 @@
1
1
  module GitHelper
2
- VERSION = '2.0.0'
2
+ VERSION = '3.1.0'
3
3
  end
Binary file
@@ -1,22 +1,25 @@
1
- require_relative '../../lib/git_helper/change_remote.rb'
1
+ require 'spec_helper'
2
+ require 'git_helper'
2
3
 
3
4
  describe GitHelper::ChangeRemote do
4
- let(:remote1) { 'git@github.com:github-username-old/project-1.git' }
5
+ let(:remote1) { "git@github.com:#{old_owner}/#{project}.git" }
6
+ let(:project) { Faker::Lorem.word }
7
+ let(:cli) { double(:highline_cli, process_directory_remotes?: true) }
8
+ let(:old_owner) { Faker::Internet.username }
9
+ let(:new_owner) { Faker::Internet.username }
10
+ let(:directory_entries) { [ '.', '..', project, Faker::Lorem.word, Faker::Lorem.word ] }
11
+
5
12
  let(:local_code) do
6
13
  double(:local_code,
7
14
  remotes: [remote1],
8
- remote_name: 'origin',
15
+ remote_name: Faker::Lorem.word,
9
16
  ssh_remote?: true,
10
17
  https_remote?: false,
11
- remote_project: 'project-1',
18
+ remote_project: project,
12
19
  remote_source: 'github.com',
13
20
  change_remote: true
14
21
  )
15
22
  end
16
- let(:cli) { double(:highline_cli, process_directory_remotes?: true) }
17
- let(:old_owner) { 'github-username-old' }
18
- let(:new_owner) { 'github-username-new' }
19
- let(:directory_entries) { [ '.', '..', 'project-1', 'project-2', 'project-3' ] }
20
23
 
21
24
  subject { GitHelper::ChangeRemote.new(old_owner, new_owner) }
22
25
 
@@ -27,9 +30,9 @@ describe GitHelper::ChangeRemote do
27
30
 
28
31
  describe '#execute' do
29
32
  before do
30
- allow(Dir).to receive(:pwd).and_return('/Users/firstname/lastname/path/to/project')
33
+ allow(Dir).to receive(:pwd).and_return("/Users/#{Faker::Name.first_name}/#{project}")
31
34
  allow(Dir).to receive(:entries).and_return(directory_entries)
32
- allow(File).to receive(:join).and_return('/Users/firstname/lastname/path/to/project/project-1')
35
+ allow(File).to receive(:join).and_return("/Users/#{Faker::Name.first_name}/#{project}/#{Faker::Lorem.word}")
33
36
  allow(File).to receive(:directory?).and_return(true)
34
37
  allow(subject).to receive(:process_dir)
35
38
  end
@@ -58,13 +61,13 @@ describe GitHelper::ChangeRemote do
58
61
  it 'should definitely look in the file structure' do
59
62
  expect(Dir).to receive(:chdir)
60
63
  expect(File).to receive(:exist?)
61
- subject.send(:process_dir, '/Users/firstname/lastname/path/to/project', '/Users/firstname/lastname/path/to/project/project-1')
64
+ subject.send(:process_dir, "/Users/#{Faker::Name.first_name}/#{project}", "/Users/#{Faker::Name.first_name}/#{project}/#{Faker::Lorem.word}")
62
65
  end
63
66
 
64
67
  context 'when the user says to process the directory' do
65
68
  it 'should call to process the git repository at least once' do
66
69
  expect(subject).to receive(:process_git_repository).at_least(:once)
67
- subject.send(:process_dir, '/Users/firstname/lastname/path/to/project', '/Users/firstname/lastname/path/to/project/project-1')
70
+ subject.send(:process_dir, "/Users/#{Faker::Name.first_name}/#{project}", "/Users/#{Faker::Name.first_name}/#{project}/#{Faker::Lorem.word}")
68
71
  end
69
72
  end
70
73
 
@@ -73,7 +76,7 @@ describe GitHelper::ChangeRemote do
73
76
 
74
77
  it 'should not call to process the directory' do
75
78
  expect(subject).not_to receive(:process_git_repository)
76
- subject.send(:process_dir, '/Users/firstname/lastname/path/to/project', '/Users/firstname/lastname/path/to/project/project-1')
79
+ subject.send(:process_dir, "/Users/#{Faker::Name.first_name}/#{project}", "/Users/#{Faker::Name.first_name}/#{project}/#{Faker::Lorem.word}")
77
80
  end
78
81
  end
79
82
  end
@@ -96,7 +99,7 @@ describe GitHelper::ChangeRemote do
96
99
  end
97
100
 
98
101
  context 'when the remote does not include the old owner' do
99
- let(:remote1) { 'git@github.com:github-username-new/project-1.git' }
102
+ let(:remote1) { "git@github.com:#{new_owner}/#{project}.git" }
100
103
 
101
104
  it 'should not call to process the remote' do
102
105
  expect(subject).not_to receive(:process_remote)
@@ -135,10 +138,10 @@ describe GitHelper::ChangeRemote do
135
138
  let(:local_code) do
136
139
  double(:local_code,
137
140
  remotes: [remote1],
138
- remote_name: 'origin',
141
+ remote_name: Faker::Lorem.word,
139
142
  ssh_remote?: false,
140
143
  https_remote?: false,
141
- remote_project: 'project-1',
144
+ remote_project: project,
142
145
  remote_source: 'github.com',
143
146
  change_remote: true
144
147
  )
@@ -1,4 +1,5 @@
1
- require_relative '../../lib/git_helper/checkout_default.rb'
1
+ require 'spec_helper'
2
+ require 'git_helper'
2
3
 
3
4
  describe GitHelper::CheckoutDefault do
4
5
  let(:local_code) { double(:local_code, checkout_default: :done) }
@@ -1,4 +1,5 @@
1
- require_relative '../../lib/git_helper/clean_branches.rb'
1
+ require 'spec_helper'
2
+ require 'git_helper'
2
3
 
3
4
  describe GitHelper::CleanBranches do
4
5
  let(:local_code) { double(:local_code, clean_branches: :commit) }
@@ -1,9 +1,12 @@
1
- require_relative '../../lib/git_helper/code_request.rb'
1
+ require 'spec_helper'
2
+ require 'git_helper'
2
3
 
3
4
  describe GitHelper::CodeRequest do
4
5
  let(:highline_cli) { double(:highline_cli) }
5
- let(:local_code) { double(:local_code, project_name: 'name', branch: 'branch') }
6
+ let(:local_code) { double(:local_code, project_name: Faker::Lorem.word, branch: Faker::Lorem.word) }
6
7
  let(:process_project) { double(:process_project, create: :created, merge: :merged) }
8
+ let(:base_branch) { Faker::Lorem.word }
9
+ let(:title) { Faker::Lorem.sentence }
7
10
 
8
11
  subject { GitHelper::CodeRequest.new }
9
12
 
@@ -14,8 +17,8 @@ describe GitHelper::CodeRequest do
14
17
 
15
18
  describe '#create' do
16
19
  before do
17
- allow(subject).to receive(:base_branch).and_return('base')
18
- allow(subject).to receive(:new_code_request_title).and_return('Title')
20
+ allow(subject).to receive(:base_branch).and_return(base_branch)
21
+ allow(subject).to receive(:new_code_request_title).and_return(title)
19
22
  end
20
23
 
21
24
  it 'should call to process the project' do
@@ -30,8 +33,8 @@ describe GitHelper::CodeRequest do
30
33
  end
31
34
 
32
35
  it 'should call base_branch and new_code_request_title' do
33
- expect(subject).to receive(:base_branch).and_return('base')
34
- expect(subject).to receive(:new_code_request_title).and_return('Title')
36
+ expect(subject).to receive(:base_branch).and_return(base_branch)
37
+ expect(subject).to receive(:new_code_request_title).and_return(title)
35
38
  allow(subject).to receive(:process_project).and_return(process_project)
36
39
  allow(process_project).to receive(:create)
37
40
  subject.create
@@ -131,7 +134,7 @@ describe GitHelper::CodeRequest do
131
134
 
132
135
  context 'when response is neither' do
133
136
  it 'should raise an error' do
134
- allow(highline_cli).to receive(:conflicting_remote_clarification).and_return('huh?')
137
+ allow(highline_cli).to receive(:conflicting_remote_clarification).and_return(Faker::Lorem.word)
135
138
  expect(subject).to receive(:exit)
136
139
  subject.send(:ask_for_clarification)
137
140
  end
@@ -170,28 +173,28 @@ describe GitHelper::CodeRequest do
170
173
  it 'should call the default branch' do
171
174
  expect(subject).to receive(:default_branch)
172
175
  allow(highline_cli).to receive(:base_branch_default?).at_least(:once)
173
- allow(highline_cli).to receive(:base_branch).at_least(:once).and_return('base')
176
+ allow(highline_cli).to receive(:base_branch).at_least(:once).and_return(base_branch)
174
177
  subject.send(:base_branch)
175
178
  end
176
179
 
177
180
  it 'should ask the CLI to ask the user' do
178
181
  allow(subject).to receive(:default_branch)
179
182
  expect(highline_cli).to receive(:base_branch_default?).at_least(:once)
180
- allow(highline_cli).to receive(:base_branch).at_least(:once).and_return('base')
183
+ allow(highline_cli).to receive(:base_branch).at_least(:once).and_return(base_branch)
181
184
  subject.send(:base_branch)
182
185
  end
183
186
 
184
187
  context 'if the user says no' do
185
- it "definitely asks for the user's base branch" do
188
+ it 'definitely asks for the users base branch' do
186
189
  allow(subject).to receive(:default_branch)
187
190
  expect(highline_cli).to receive(:base_branch_default?).at_least(:once).and_return(false)
188
- expect(highline_cli).to receive(:base_branch).at_least(:once).and_return('base')
191
+ expect(highline_cli).to receive(:base_branch).at_least(:once).and_return(base_branch)
189
192
  subject.send(:base_branch)
190
193
  end
191
194
  end
192
195
 
193
196
  context 'if the user says yes' do
194
- it "does not ask for the user's base branch" do
197
+ it 'does not ask for the users base branch' do
195
198
  allow(subject).to receive(:default_branch)
196
199
  expect(highline_cli).to receive(:base_branch_default?).at_least(:once).and_return(true)
197
200
  expect(highline_cli).not_to receive(:base_branch)
@@ -202,7 +205,7 @@ describe GitHelper::CodeRequest do
202
205
 
203
206
  describe '#autogenerated_title' do
204
207
  it 'should generate a title based on the branch' do
205
- expect(subject).to receive(:local_branch).and_return('branch')
208
+ expect(subject).to receive(:local_branch).and_return(Faker::Lorem.word)
206
209
  expect(local_code).to receive(:generate_title)
207
210
  subject.send(:autogenerated_title)
208
211
  end
@@ -212,28 +215,28 @@ describe GitHelper::CodeRequest do
212
215
  it 'should call autogenerated title method' do
213
216
  expect(subject).to receive(:autogenerated_title)
214
217
  allow(highline_cli).to receive(:accept_autogenerated_title?).at_least(:once)
215
- allow(highline_cli).to receive(:title).at_least(:once).and_return('Title')
218
+ allow(highline_cli).to receive(:title).at_least(:once).and_return(title)
216
219
  subject.send(:new_code_request_title)
217
220
  end
218
221
 
219
222
  it 'should ask the CLI to ask the user' do
220
223
  allow(subject).to receive(:autogenerated_title)
221
224
  expect(highline_cli).to receive(:accept_autogenerated_title?).at_least(:once)
222
- allow(highline_cli).to receive(:title).at_least(:once).and_return('Title')
225
+ allow(highline_cli).to receive(:title).at_least(:once).and_return(title)
223
226
  subject.send(:new_code_request_title)
224
227
  end
225
228
 
226
229
  context 'if the user says no' do
227
- it "definitely asks for the user's title" do
230
+ it 'definitely asks for the users title' do
228
231
  allow(subject).to receive(:autogenerated_title)
229
232
  expect(highline_cli).to receive(:accept_autogenerated_title?).at_least(:once).and_return(false)
230
- expect(highline_cli).to receive(:title).at_least(:once).and_return('Title')
233
+ expect(highline_cli).to receive(:title).at_least(:once).and_return(title)
231
234
  subject.send(:new_code_request_title)
232
235
  end
233
236
  end
234
237
 
235
238
  context 'if the user says yes to original title' do
236
- it "does not ask for the user's chosen title" do
239
+ it 'does not ask for the users chosen title' do
237
240
  allow(subject).to receive(:autogenerated_title)
238
241
  expect(highline_cli).to receive(:accept_autogenerated_title?).at_least(:once).and_return(true)
239
242
  expect(highline_cli).not_to receive(:title)
@@ -1,4 +1,5 @@
1
- require_relative '../../lib/git_helper/empty_commit.rb'
1
+ require 'spec_helper'
2
+ require 'git_helper'
2
3
 
3
4
  describe GitHelper::EmptyCommit do
4
5
  let(:local_code) { double(:local_code, empty_commit: :commit) }
@@ -1,4 +1,5 @@
1
- require_relative '../../lib/git_helper/forget_local_commits.rb'
1
+ require 'spec_helper'
2
+ require 'git_helper'
2
3
 
3
4
  describe GitHelper::ForgetLocalCommits do
4
5
  let(:local_code) { double(:local_code, forget_local_commits: :commit) }
@@ -1,13 +1,15 @@
1
- require_relative '../../lib/git_helper/git_config_reader.rb'
1
+ require 'spec_helper'
2
+ require 'git_helper'
2
3
 
3
4
  describe GitHelper::GitConfigReader do
4
- let(:github_token) { '1234ASDF1234ASDF' }
5
- let(:gitlab_token) { 'ASDF123ASDF1234' }
5
+ let(:github_token) { Faker::Internet.password(max_length: 10) }
6
+ let(:gitlab_token) { Faker::Internet.password(max_length: 10) }
7
+
6
8
  let(:config_file) {
7
9
  {
8
- github_user: 'github-user-name',
10
+ github_user: Faker::Internet.username,
9
11
  github_token: github_token,
10
- gitlab_user: 'gitlab-user-name',
12
+ gitlab_user: Faker::Internet.username,
11
13
  gitlab_token: gitlab_token
12
14
  }
13
15
  }
@@ -47,13 +49,14 @@ describe GitHelper::GitConfigReader do
47
49
 
48
50
  describe '#git_config_file_path' do
49
51
  it 'should look in the current directory' do
50
- expect(Dir).to receive(:pwd).and_return('/Users/firstnamelastname/path/to/git_helper')
52
+ expect(Dir).to receive(:pwd).and_return("/Users/#{Faker::Name.first_name}/#{Faker::Lorem.word}")
51
53
  subject.send(:git_config_file_path)
52
54
  end
53
55
 
54
56
  it 'should return the base path with the git config file at the end' do
55
- allow(Dir).to receive(:pwd).and_return('/Users/firstnamelastname/path/to/git_helper')
56
- expect(subject.send(:git_config_file_path)).to eq('/Users/firstnamelastname/.git_config.yml')
57
+ user = Faker::Name.first_name
58
+ allow(Dir).to receive(:pwd).and_return("/Users/#{user}/#{Faker::Lorem.word}")
59
+ expect(subject.send(:git_config_file_path)).to eq("/Users/#{user}/.git_helper/config.yml")
57
60
  end
58
61
  end
59
62
  end
@@ -1,4 +1,5 @@
1
- require_relative '../../lib/git_helper/gitlab_client.rb'
1
+ require 'spec_helper'
2
+ require 'git_helper'
2
3
 
3
4
  describe GitHelper::GitLabClient do
4
5
  let(:git_config_reader) { double(:git_config_reader, gitlab_token: :token) }
@@ -1,4 +1,5 @@
1
- require_relative '../../lib/git_helper/highline_cli.rb'
1
+ require 'spec_helper'
2
+ require 'git_helper'
2
3
 
3
4
  describe GitHelper::HighlineCli do
4
5
  let(:response) { double(:response, readline: true, to_i: 5) }
@@ -11,7 +12,7 @@ describe GitHelper::HighlineCli do
11
12
  end
12
13
 
13
14
  describe '#new_branch_name' do
14
- it "should ask the subject's ask method" do
15
+ it 'should ask the subjects ask method' do
15
16
  expect(subject).to receive(:ask).with('New branch name?')
16
17
  subject.new_branch_name
17
18
  end
@@ -22,34 +23,34 @@ describe GitHelper::HighlineCli do
22
23
  end
23
24
 
24
25
  describe '#process_directory_remotes' do
25
- it "should ask the subject's ask method" do
26
+ it 'should ask the subjects ask method' do
26
27
  expect(subject).to receive(:ask).and_return('y')
27
- subject.process_directory_remotes?('directory')
28
+ subject.process_directory_remotes?(Faker::Lorem.word)
28
29
  end
29
30
 
30
31
  it 'should be a boolean at the end' do
31
32
  allow(subject).to receive(:ask).and_return('y')
32
- expect([true, false]).to include(subject.process_directory_remotes?('directory'))
33
+ expect([true, false]).to include(subject.process_directory_remotes?(Faker::Lorem.word))
33
34
  end
34
35
 
35
36
  it 'should come out as a true boolean if somebody responds y' do
36
37
  allow(subject).to receive(:ask).and_return('y')
37
- expect(subject.process_directory_remotes?('directory')).to eq(true)
38
+ expect(subject.process_directory_remotes?(Faker::Lorem.word)).to eq(true)
38
39
  end
39
40
 
40
41
  it 'should come out as a false boolean if somebody responds n' do
41
42
  allow(subject).to receive(:ask).and_return('n')
42
- expect(subject.process_directory_remotes?('directory')).to eq(false)
43
+ expect(subject.process_directory_remotes?(Faker::Lorem.word)).to eq(false)
43
44
  end
44
45
 
45
46
  it 'should come out as true if somebody presses enter' do
46
47
  allow(subject).to receive(:ask).and_return('')
47
- expect(subject.accept_autogenerated_title?('directory')).to eq(true)
48
+ expect(subject.accept_autogenerated_title?(Faker::Lorem.word)).to eq(true)
48
49
  end
49
50
  end
50
51
 
51
52
  describe '#conflicting_remote_clarification' do
52
- it "should ask the subject's ask method" do
53
+ it 'should ask the subjects ask method' do
53
54
  expect(subject).to receive(:ask).with('Found git remotes for both GitHub and GitLab. Would you like to proceed with GitLab or GitHub? (github/gitlab)').and_return('gitlab')
54
55
  subject.conflicting_remote_clarification
55
56
  end
@@ -60,7 +61,7 @@ describe GitHelper::HighlineCli do
60
61
  end
61
62
 
62
63
  describe '#title' do
63
- it "should ask the subject's ask method" do
64
+ it 'should ask the subjects ask method' do
64
65
  expect(subject).to receive(:ask).with('Title?')
65
66
  subject.title
66
67
  end
@@ -71,7 +72,7 @@ describe GitHelper::HighlineCli do
71
72
  end
72
73
 
73
74
  describe '#base_branch' do
74
- it "should ask the subject's ask method" do
75
+ it 'should ask the subjects ask method' do
75
76
  expect(subject).to receive(:ask).with('Base branch?')
76
77
  subject.base_branch
77
78
  end
@@ -82,92 +83,94 @@ describe GitHelper::HighlineCli do
82
83
  end
83
84
 
84
85
  describe '#code_request_id' do
85
- it "should ask the subject's ask method" do
86
- expect(subject).to receive(:ask).with('Example Request ID?')
87
- subject.code_request_id('Example')
86
+ let(:phrase) { Faker::Lorem.sentence }
87
+
88
+ it 'should ask the subjects ask method' do
89
+ expect(subject).to receive(:ask).with("#{phrase} Request ID?")
90
+ subject.code_request_id(phrase)
88
91
  end
89
92
 
90
93
  it 'should come out a string' do
91
- expect(subject.code_request_id('Example')).to be_a(String)
94
+ expect(subject.code_request_id(phrase)).to be_a(String)
92
95
  end
93
96
  end
94
97
 
95
98
  describe '#accept_autogenerated_title' do
96
- it "should ask the subject's ask method" do
99
+ it 'should ask the subjects ask method' do
97
100
  expect(subject).to receive(:ask).and_return('y')
98
- subject.accept_autogenerated_title?('Title Example')
101
+ subject.accept_autogenerated_title?(Faker::Lorem.sentence)
99
102
  end
100
103
 
101
104
  it 'should be a boolean at the end' do
102
105
  allow(subject).to receive(:ask).and_return('y')
103
- expect([true, false]).to include(subject.accept_autogenerated_title?('Title Example'))
106
+ expect([true, false]).to include(subject.accept_autogenerated_title?(Faker::Lorem.sentence))
104
107
  end
105
108
 
106
109
  it 'should come out as a true boolean if somebody responds y' do
107
110
  allow(subject).to receive(:ask).and_return('y')
108
- expect(subject.accept_autogenerated_title?('Title Example')).to eq(true)
111
+ expect(subject.accept_autogenerated_title?(Faker::Lorem.sentence)).to eq(true)
109
112
  end
110
113
 
111
114
  it 'should come out as a true boolean if somebody responds n' do
112
115
  allow(subject).to receive(:ask).and_return('n')
113
- expect(subject.accept_autogenerated_title?('Title Example')).to eq(false)
116
+ expect(subject.accept_autogenerated_title?(Faker::Lorem.sentence)).to eq(false)
114
117
  end
115
118
 
116
119
  it 'should come out as a true boolean if somebody responds yes' do
117
120
  allow(subject).to receive(:ask).and_return('yes')
118
- expect(subject.accept_autogenerated_title?('Title Example')).to eq(true)
121
+ expect(subject.accept_autogenerated_title?(Faker::Lorem.sentence)).to eq(true)
119
122
  end
120
123
 
121
124
  it 'should come out as a false boolean if somebody responds no' do
122
125
  allow(subject).to receive(:ask).and_return('no')
123
- expect(subject.accept_autogenerated_title?('Title Example')).to eq(false)
126
+ expect(subject.accept_autogenerated_title?(Faker::Lorem.sentence)).to eq(false)
124
127
  end
125
128
 
126
129
  it 'should come out as true if somebody presses enter' do
127
130
  allow(subject).to receive(:ask).and_return('')
128
- expect(subject.accept_autogenerated_title?('Title Example')).to eq(true)
131
+ expect(subject.accept_autogenerated_title?(Faker::Lorem.sentence)).to eq(true)
129
132
  end
130
133
  end
131
134
 
132
135
  describe '#base_branch_default' do
133
- it "should ask the subject's ask method" do
136
+ it 'should ask the subjects ask method' do
134
137
  expect(subject).to receive(:ask).and_return('y')
135
- subject.base_branch_default?('default_branch')
138
+ subject.base_branch_default?(Faker::Lorem.word)
136
139
  end
137
140
 
138
141
  it 'should be a boolean at the end' do
139
142
  allow(subject).to receive(:ask).and_return('y')
140
- expect([true, false]).to include(subject.base_branch_default?('default_branch'))
143
+ expect([true, false]).to include(subject.base_branch_default?(Faker::Lorem.word))
141
144
  end
142
145
 
143
146
  it 'should come out as a true boolean if somebody responds y' do
144
147
  allow(subject).to receive(:ask).and_return('y')
145
- expect(subject.base_branch_default?('default_branch')).to eq(true)
148
+ expect(subject.base_branch_default?(Faker::Lorem.word)).to eq(true)
146
149
  end
147
150
 
148
151
  it 'should come out as a true boolean if somebody responds n' do
149
152
  allow(subject).to receive(:ask).and_return('n')
150
- expect(subject.base_branch_default?('default_branch')).to eq(false)
153
+ expect(subject.base_branch_default?(Faker::Lorem.word)).to eq(false)
151
154
  end
152
155
 
153
156
  it 'should come out as a true boolean if somebody responds yes' do
154
157
  allow(subject).to receive(:ask).and_return('yes')
155
- expect(subject.base_branch_default?('default_branch')).to eq(true)
158
+ expect(subject.base_branch_default?(Faker::Lorem.word)).to eq(true)
156
159
  end
157
160
 
158
161
  it 'should come out as a false boolean if somebody responds no' do
159
162
  allow(subject).to receive(:ask).and_return('no')
160
- expect(subject.base_branch_default?('default_branch')).to eq(false)
163
+ expect(subject.base_branch_default?(Faker::Lorem.word)).to eq(false)
161
164
  end
162
165
 
163
166
  it 'should come out as true if somebody presses enter' do
164
167
  allow(subject).to receive(:ask).and_return('')
165
- expect(subject.base_branch_default?('default_branch')).to eq(true)
168
+ expect(subject.base_branch_default?(Faker::Lorem.word)).to eq(true)
166
169
  end
167
170
  end
168
171
 
169
172
  describe '#merge_method' do
170
- it "should ask the subject's ask_options method" do
173
+ it 'should ask the subjects ask_options method' do
171
174
  expect(subject).to receive(:ask_options).and_return(3)
172
175
  subject.merge_method(['1', '2', '3'])
173
176
  end
@@ -179,7 +182,7 @@ describe GitHelper::HighlineCli do
179
182
  end
180
183
 
181
184
  describe '#template_to_apply' do
182
- it "should ask the subject's ask_options method" do
185
+ it 'should ask the subjects ask_options method' do
183
186
  expect(subject).to receive(:ask_options).and_return(3)
184
187
  subject.template_to_apply(['option1', 'option2', 'option3'], 'example type')
185
188
  end
@@ -193,22 +196,22 @@ describe GitHelper::HighlineCli do
193
196
  describe '#ask' do
194
197
  it 'should ask the highline client ask'do
195
198
  expect(highline_client).to receive(:ask)
196
- subject.send(:ask, 'prompt goes here')
199
+ subject.send(:ask, Faker::Lorem.sentence)
197
200
  end
198
201
 
199
202
  it 'should return a string' do
200
- expect(subject.send(:ask, 'prompt goes here')).to be_a(String)
203
+ expect(subject.send(:ask, Faker::Lorem.sentence)).to be_a(String)
201
204
  end
202
205
  end
203
206
 
204
207
  describe '#ask_options' do
205
208
  it 'should ask the highline client ask'do
206
209
  expect(highline_client).to receive(:ask)
207
- subject.send(:ask_options, 'prompt goes here', ['1', '2', '3'])
210
+ subject.send(:ask_options, Faker::Lorem.sentence, ['1', '2', '3'])
208
211
  end
209
212
 
210
213
  it 'should return an integer' do
211
- expect(subject.send(:ask_options, 'prompt goes here', ['1', '2', '3'])).to be_a(Integer)
214
+ expect(subject.send(:ask_options, Faker::Lorem.sentence, ['1', '2', '3'])).to be_a(Integer)
212
215
  end
213
216
  end
214
217
  end