gitlab 4.2.0 → 4.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. checksums.yaml +5 -5
  2. data/.rubocop.yml +33 -0
  3. data/.travis.yml +8 -3
  4. data/README.md +7 -7
  5. data/Rakefile +11 -3
  6. data/gitlab.gemspec +11 -11
  7. data/lib/gitlab.rb +2 -2
  8. data/lib/gitlab/api.rb +2 -1
  9. data/lib/gitlab/cli.rb +2 -6
  10. data/lib/gitlab/cli_helpers.rb +18 -20
  11. data/lib/gitlab/client.rb +8 -5
  12. data/lib/gitlab/client/branches.rb +4 -4
  13. data/lib/gitlab/client/build_variables.rb +64 -2
  14. data/lib/gitlab/client/deployments.rb +32 -0
  15. data/lib/gitlab/client/groups.rb +49 -0
  16. data/lib/gitlab/client/issues.rb +71 -0
  17. data/lib/gitlab/client/merge_requests.rb +1 -0
  18. data/lib/gitlab/client/pipeline_schedules.rb +133 -0
  19. data/lib/gitlab/client/pipeline_triggers.rb +2 -2
  20. data/lib/gitlab/client/projects.rb +1 -1
  21. data/lib/gitlab/client/repository_files.rb +2 -2
  22. data/lib/gitlab/client/users.rb +5 -5
  23. data/lib/gitlab/configuration.rb +2 -2
  24. data/lib/gitlab/error.rb +10 -2
  25. data/lib/gitlab/file_response.rb +1 -1
  26. data/lib/gitlab/help.rb +5 -6
  27. data/lib/gitlab/page_links.rb +2 -2
  28. data/lib/gitlab/request.rb +34 -50
  29. data/lib/gitlab/shell.rb +5 -8
  30. data/lib/gitlab/version.rb +1 -1
  31. data/spec/fixtures/deployment.json +57 -0
  32. data/spec/fixtures/deployments.json +116 -0
  33. data/spec/fixtures/group_edit.json +14 -0
  34. data/spec/fixtures/group_subgroups.json +16 -0
  35. data/spec/fixtures/pipeline_schedule.json +32 -0
  36. data/spec/fixtures/pipeline_schedule_create.json +21 -0
  37. data/spec/fixtures/pipeline_schedule_update.json +26 -0
  38. data/spec/fixtures/pipeline_schedule_variable.json +5 -0
  39. data/spec/fixtures/pipeline_schedule_variable_update.json +5 -0
  40. data/spec/fixtures/pipeline_schedules.json +22 -0
  41. data/spec/gitlab/api_spec.rb +11 -0
  42. data/spec/gitlab/cli_helpers_spec.rb +14 -15
  43. data/spec/gitlab/cli_spec.rb +11 -11
  44. data/spec/gitlab/client/award_emojis_spec.rb +55 -55
  45. data/spec/gitlab/client/boards_spec.rb +12 -12
  46. data/spec/gitlab/client/branches_spec.rb +22 -22
  47. data/spec/gitlab/client/build_variables_spec.rb +93 -10
  48. data/spec/gitlab/client/builds_spec.rb +36 -36
  49. data/spec/gitlab/client/commits_spec.rb +21 -21
  50. data/spec/gitlab/client/deployments_spec.rb +38 -0
  51. data/spec/gitlab/client/environments_spec.rb +18 -18
  52. data/spec/gitlab/client/groups_spec.rb +73 -22
  53. data/spec/gitlab/client/issues_spec.rb +121 -22
  54. data/spec/gitlab/client/jobs_spec.rb +13 -13
  55. data/spec/gitlab/client/keys_spec.rb +2 -2
  56. data/spec/gitlab/client/labels_spec.rb +12 -12
  57. data/spec/gitlab/client/merge_requests_spec.rb +23 -23
  58. data/spec/gitlab/client/milestones_spec.rb +12 -12
  59. data/spec/gitlab/client/namespaces_spec.rb +3 -3
  60. data/spec/gitlab/client/notes_spec.rb +40 -40
  61. data/spec/gitlab/client/pipeline_schedules_spec.rb +158 -0
  62. data/spec/gitlab/client/pipeline_triggers_spec.rb +17 -17
  63. data/spec/gitlab/client/pipelines_spec.rb +22 -22
  64. data/spec/gitlab/client/projects_spec.rb +75 -75
  65. data/spec/gitlab/client/repositories_spec.rb +16 -16
  66. data/spec/gitlab/client/repository_files_spec.rb +10 -10
  67. data/spec/gitlab/client/runners_spec.rb +20 -22
  68. data/spec/gitlab/client/services_spec.rb +6 -6
  69. data/spec/gitlab/client/snippets_spec.rb +12 -12
  70. data/spec/gitlab/client/system_hooks_spec.rb +12 -12
  71. data/spec/gitlab/client/tags_spec.rb +19 -20
  72. data/spec/gitlab/client/todos_spec.rb +12 -12
  73. data/spec/gitlab/client/users_spec.rb +49 -49
  74. data/spec/gitlab/error_spec.rb +50 -23
  75. data/spec/gitlab/file_response_spec.rb +6 -6
  76. data/spec/gitlab/help_spec.rb +5 -5
  77. data/spec/gitlab/objectified_hash_spec.rb +8 -8
  78. data/spec/gitlab/page_links_spec.rb +1 -1
  79. data/spec/gitlab/paginated_response_spec.rb +4 -4
  80. data/spec/gitlab/request_spec.rb +19 -19
  81. data/spec/gitlab/shell_spec.rb +12 -12
  82. data/spec/gitlab_spec.rb +13 -14
  83. data/spec/spec_helper.rb +10 -45
  84. metadata +46 -3
@@ -1,45 +1,72 @@
1
1
  require "spec_helper"
2
+ require "stringio"
2
3
 
3
4
  describe Gitlab::Error do
4
- describe "#handle_message" do
5
- require "stringio"
5
+ let(:request_object) { HTTParty::Request.new(Net::HTTP::Get, '/') }
6
+ let(:response_object) { Net::HTTPOK.new('1.1', 200, 'OK') }
7
+ let(:body) { StringIO.new("{foo:'bar'}") }
8
+ let(:parsed_response) { -> { body } }
6
9
 
7
- before do
8
- request_object = HTTParty::Request.new(Net::HTTP::Get, '/')
9
- response_object = Net::HTTPOK.new('1.1', 200, 'OK')
10
- body = StringIO.new("{foo:'bar'}")
11
- def body.message; self.string; end
10
+ let(:response) do
11
+ HTTParty::Response.new(
12
+ request_object,
13
+ response_object,
14
+ parsed_response,
15
+ body: body
16
+ )
17
+ end
12
18
 
13
- parsed_response = lambda { body }
14
- response_object['last-modified'] = Date.new(2010, 1, 15).to_s
15
- response_object['content-length'] = "1024"
19
+ let(:error) { Gitlab::Error::ResponseError.new(response) }
20
+ let(:date) { Date.new(2010, 1, 15).to_s }
16
21
 
17
- response = HTTParty::Response.new(request_object, response_object, parsed_response, body: body)
18
- @error = Gitlab::Error::ResponseError.new(response)
22
+ before do
23
+ def body.message
24
+ string
25
+ end
26
+
27
+ response_object['last-modified'] = date
28
+ response_object['content-length'] = "1024"
29
+ end
19
30
 
20
- @array = Array.new(['First message.', 'Second message.'])
21
- @obj_h = Gitlab::ObjectifiedHash.new(user: ['not set'],
22
- password: ['too short'],
23
- embed_entity: { foo: ['bar'], sna: ['fu'] })
31
+ describe "#handle_message" do
32
+ let(:array) { Array.new(['First message.', 'Second message.']) }
33
+ let(:obj_h) do
34
+ Gitlab::ObjectifiedHash.new(
35
+ user: ['not set'],
36
+ password: ['too short'],
37
+ embed_entity: { foo: ['bar'], sna: ['fu'] }
38
+ )
24
39
  end
25
40
 
26
41
  context "when passed an ObjectifiedHash" do
27
- it "should return a joined string of error messages sorted by key" do
28
- expect(@error.send(:handle_message, @obj_h)).to eq("'embed_entity' (foo: bar) (sna: fu), 'password' too short, 'user' not set")
42
+ it "returns a joined string of error messages sorted by key" do
43
+ expect(error.send(:handle_message, obj_h)).
44
+ to eq(
45
+ "'embed_entity' (foo: bar) (sna: fu), 'password' too short, 'user' not set"
46
+ )
29
47
  end
30
48
  end
31
49
 
32
50
  context "when passed an Array" do
33
- it "should return a joined string of messages" do
34
- expect(@error.send(:handle_message, @array)).to eq("First message. Second message.")
51
+ it "returns a joined string of messages" do
52
+ expect(error.send(:handle_message, array)).
53
+ to eq("First message. Second message.")
35
54
  end
36
55
  end
37
56
 
38
57
  context "when passed a String" do
39
- it "should return the String untouched" do
40
- error = 'this is an error string'
41
- expect(@error.send(:handle_message, error)).to eq('this is an error string')
58
+ it "returns the String untouched" do
59
+ error_str = 'this is an error string'
60
+
61
+ expect(error.send(:handle_message, error_str)).
62
+ to eq(error_str)
42
63
  end
43
64
  end
44
65
  end
66
+
67
+ describe "#response_message" do
68
+ it "returns the message of the parsed_response" do
69
+ expect(error.response_message).to eq(body.string)
70
+ end
71
+ end
45
72
  end
@@ -6,26 +6,26 @@ describe Gitlab::FileResponse do
6
6
  end
7
7
 
8
8
  context '.empty?' do
9
- it "shoudl return false" do
9
+ it "returns false" do
10
10
  expect(@file_response.empty?).to be false
11
11
  end
12
12
  end
13
13
 
14
14
  context '.to_hash' do
15
- it "should have `filename` key and `data` key" do
15
+ it "has `filename` key and `data` key" do
16
16
  h = @file_response.to_hash
17
- expect(h.has_key?(:filename)).to be_truthy
18
- expect(h.has_key?(:data)).to be_truthy
17
+ expect(h.key?(:filename)).to be_truthy
18
+ expect(h.key?(:data)).to be_truthy
19
19
  end
20
20
  end
21
21
 
22
22
  context '.parse_headers!' do
23
- it "should parse headers" do
23
+ it "parses headers" do
24
24
  @file_response.parse_headers!('Content-Disposition' => 'attachment; filename=artifacts.zip')
25
25
  expect(@file_response.filename).to eq "artifacts.zip"
26
26
  end
27
27
 
28
- it "should handle quoted filenames" do
28
+ it "handles quoted filenames" do
29
29
  @file_response.parse_headers!('Content-Disposition' => 'attachment; filename="artifacts.zip"')
30
30
  expect(@file_response.filename).to eq "artifacts.zip"
31
31
  end
@@ -3,14 +3,14 @@ require 'spec_helper'
3
3
  describe Gitlab::Help do
4
4
  describe ".ri_cmd" do
5
5
  context "ri command found" do
6
- it "should return the path to RI" do
6
+ it "returns the path to RI" do
7
7
  allow(Gitlab::Help).to receive(:`).with(/which ri/).and_return('/usr/bin/ri')
8
8
  expect(Gitlab::Help.ri_cmd).to eq('/usr/bin/ri')
9
9
  end
10
10
  end
11
11
 
12
12
  context "ri command NOT found" do
13
- it "should raise" do
13
+ it "raises RuntimeError" do
14
14
  allow(Gitlab::Help).to receive(:`).with(/which ri/).and_return('')
15
15
  expect { Gitlab::Help.ri_cmd }.to raise_error RuntimeError
16
16
  end
@@ -23,11 +23,11 @@ describe Gitlab::Help do
23
23
  @help_output = "Gitlab.#{@cmd}(4, 'new-branch', 'master')"
24
24
  @help_output_with_options = "Gitlab.groups({ per_page: 3 })"
25
25
  end
26
- it "should return a String of modified output" do
26
+ it "returns a String of modified output" do
27
27
  Gitlab::Help.change_help_output! @cmd, @help_output
28
28
  expect(@help_output).to eq("Gitlab.create_branch 4 'new-branch' 'master'")
29
29
  end
30
- it "should format options hash and return a String of modified output" do
30
+ it "formats options hash and return a String of modified output" do
31
31
  Gitlab::Help.change_help_output! 'groups', @help_output_with_options
32
32
  expect(@help_output_with_options).to eq("Gitlab.groups \"{ per_page: 3 }\"")
33
33
  end
@@ -38,7 +38,7 @@ describe Gitlab::Help do
38
38
  @cmd = 'create_tag'
39
39
  @namespace = Gitlab::Help.namespace @cmd
40
40
  end
41
- it "should return the full namespace for a command" do
41
+ it "returns the full namespace for a command" do
42
42
  expect(@namespace).to be_a String
43
43
  expect(@namespace).to eq("Gitlab::Client::Tags.#{@cmd}")
44
44
  end
@@ -6,42 +6,42 @@ describe Gitlab::ObjectifiedHash do
6
6
  @oh = Gitlab::ObjectifiedHash.new @hash
7
7
  end
8
8
 
9
- it "should objectify hash" do
9
+ it "objectifies a hash" do
10
10
  expect(@oh.a).to eq(@hash[:a])
11
11
  expect(@oh.b).to eq(@hash[:b])
12
12
  end
13
13
 
14
14
  describe "#to_hash" do
15
- it "should return an original hash" do
15
+ it "returns an original hash" do
16
16
  expect(@oh.to_hash).to eq(@hash)
17
17
  end
18
18
 
19
- it "should have an alias #to_h" do
19
+ it "has an alias #to_h" do
20
20
  expect(@oh.respond_to?(:to_h)).to be_truthy
21
21
  end
22
22
  end
23
23
 
24
24
  describe "#inspect" do
25
- it "should return a formatted string" do
25
+ it "returns a formatted string" do
26
26
  pretty_string = "#<#{@oh.class.name}:#{@oh.object_id} {hash: #{@hash}}"
27
27
  expect(@oh.inspect).to eq(pretty_string)
28
28
  end
29
29
  end
30
30
 
31
31
  describe "#respond_to" do
32
- it "should return true for methods this object responds to through method_missing as sym" do
32
+ it "returns true for methods this object responds to through method_missing as sym" do
33
33
  expect(@oh.respond_to?(:a)).to be_truthy
34
34
  end
35
35
 
36
- it "should return true for methods this object responds to through method_missing as string" do
36
+ it "returns true for methods this object responds to through method_missing as string" do
37
37
  expect(@oh.respond_to?('string')).to be_truthy
38
38
  end
39
39
 
40
- it "should not care if you use a string or symbol to reference a method" do
40
+ it "does not care if you use a string or symbol to reference a method" do
41
41
  expect(@oh.respond_to?(:string)).to be_truthy
42
42
  end
43
43
 
44
- it "should not care if you use a string or symbol to reference a method" do
44
+ it "does not care if you use a string or symbol to reference a method" do
45
45
  expect(@oh.respond_to?('symbol')).to be_truthy
46
46
  end
47
47
  end
@@ -6,7 +6,7 @@ describe Gitlab::PageLinks do
6
6
  end
7
7
 
8
8
  context '.extract_links' do
9
- it 'should extract link header appropriately' do
9
+ it 'extracts link header appropriately' do
10
10
  expect(@page_links.last).to eql 'http://example.com/api/v3/projects?page=20&per_page=5'
11
11
  expect(@page_links.first).to eql 'http://example.com/api/v3/projects?page=1&per_page=5'
12
12
  expect(@page_links.next).to eql 'http://example.com/api/v3/projects?page=9&per_page=5'
@@ -6,7 +6,7 @@ describe Gitlab::PaginatedResponse do
6
6
  @paginated_response = Gitlab::PaginatedResponse.new array
7
7
  end
8
8
 
9
- it "should respond to *_page and has_*_page methods" do
9
+ it "responds to *_page and has_*_page methods" do
10
10
  expect(@paginated_response).to respond_to :first_page
11
11
  expect(@paginated_response).to respond_to :last_page
12
12
  expect(@paginated_response).to respond_to :next_page
@@ -18,7 +18,7 @@ describe Gitlab::PaginatedResponse do
18
18
  end
19
19
 
20
20
  context '.parse_headers!' do
21
- it "should parse headers" do
21
+ it "parses headers" do
22
22
  @paginated_response.parse_headers!('Link' => "<http://example.com/api/v3/projects?page=1&per_page=5>; rel=\"first\", <http://example.com/api/v3/projects?page=20&per_page=5>; rel=\"last\"")
23
23
  client = @paginated_response.client = double('client')
24
24
  first_page_response = double('first_page_response')
@@ -38,7 +38,7 @@ describe Gitlab::PaginatedResponse do
38
38
  end
39
39
 
40
40
  context '.each_page' do
41
- it "should iterate pages" do
41
+ it "iterates pages" do
42
42
  next_page = double('next_page')
43
43
  allow(@paginated_response).to receive(:has_next_page?).and_return(true)
44
44
  allow(@paginated_response).to receive(:next_page).and_return(next_page)
@@ -48,7 +48,7 @@ describe Gitlab::PaginatedResponse do
48
48
  end
49
49
 
50
50
  context '.auto_paginate' do
51
- it "should returns an array if block is not given" do
51
+ it "returns an array if block is not given" do
52
52
  next_page = double('next_page')
53
53
  allow(@paginated_response).to receive(:has_next_page?).and_return(true)
54
54
  allow(@paginated_response).to receive(:next_page).and_return(next_page)
@@ -1,16 +1,16 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Gitlab::Request do
4
- it { should respond_to :get }
5
- it { should respond_to :post }
6
- it { should respond_to :put }
7
- it { should respond_to :delete }
4
+ it { is_expected.to respond_to :get }
5
+ it { is_expected.to respond_to :post }
6
+ it { is_expected.to respond_to :put }
7
+ it { is_expected.to respond_to :delete }
8
8
  before do
9
9
  @request = Gitlab::Request.new
10
10
  end
11
11
 
12
12
  describe ".default_options" do
13
- it "should have default values" do
13
+ it "has default values" do
14
14
  default_options = Gitlab::Request.default_options
15
15
  expect(default_options).to be_a Hash
16
16
  expect(default_options[:parser]).to be_a Proc
@@ -21,7 +21,7 @@ describe Gitlab::Request do
21
21
  end
22
22
 
23
23
  describe ".parse" do
24
- it "should return ObjectifiedHash" do
24
+ it "returns ObjectifiedHash" do
25
25
  body = JSON.unparse(a: 1, b: 2)
26
26
  expect(Gitlab::Request.parse(body)).to be_an Gitlab::ObjectifiedHash
27
27
  expect(Gitlab::Request.parse("true")).to be true
@@ -31,43 +31,43 @@ describe Gitlab::Request do
31
31
  end
32
32
  end
33
33
 
34
- describe "#set_request_defaults" do
34
+ describe "#request_defaults" do
35
35
  context "when endpoint is not set" do
36
- it "should raise Error::MissingCredentials" do
36
+ it "raises Error::MissingCredentials" do
37
37
  @request.endpoint = nil
38
38
  expect do
39
- @request.set_request_defaults
39
+ @request.request_defaults
40
40
  end.to raise_error(Gitlab::Error::MissingCredentials, 'Please set an endpoint to API')
41
41
  end
42
42
  end
43
43
 
44
44
  context "when endpoint is set" do
45
45
  before(:each) do
46
- @request.endpoint = 'http://rabbit-hole.example.org'
46
+ @request.endpoint = 'http://rabbit-hole.example.com'
47
47
  end
48
48
 
49
- it "should set default_params" do
50
- @request.set_request_defaults('sudoer')
49
+ it "sets default_params" do
50
+ @request.request_defaults('sudoer')
51
51
  expect(Gitlab::Request.default_params).to eq(sudo: 'sudoer')
52
52
  end
53
53
  end
54
54
  end
55
55
 
56
- describe "#set_authorization_header" do
57
- it "should raise MissingCredentials when auth_token and private_token are not set" do
56
+ describe "#authorization_header" do
57
+ it "raises MissingCredentials when auth_token and private_token are not set" do
58
58
  expect do
59
- @request.send(:set_authorization_header, {})
59
+ @request.send(:authorization_header, {})
60
60
  end.to raise_error(Gitlab::Error::MissingCredentials)
61
61
  end
62
62
 
63
- it "should set the correct header when given a private_token" do
63
+ it "sets the correct header when given a private_token" do
64
64
  @request.private_token = 'ys9BtunN3rDKbaJCYXaN'
65
- expect(@request.send(:set_authorization_header, {})).to eq("PRIVATE-TOKEN" => 'ys9BtunN3rDKbaJCYXaN')
65
+ expect(@request.send(:authorization_header, {})).to eq("PRIVATE-TOKEN" => 'ys9BtunN3rDKbaJCYXaN')
66
66
  end
67
67
 
68
- it "should set the correct header when setting an auth_token via the private_token config option" do
68
+ it "sets the correct header when setting an auth_token via the private_token config option" do
69
69
  @request.private_token = '3225e2804d31fea13fc41fc83bffef00cfaedc463118646b154acc6f94747603'
70
- expect(@request.send(:set_authorization_header, {})).to eq("Authorization" => "Bearer 3225e2804d31fea13fc41fc83bffef00cfaedc463118646b154acc6f94747603")
70
+ expect(@request.send(:authorization_header, {})).to eq("Authorization" => "Bearer 3225e2804d31fea13fc41fc83bffef00cfaedc463118646b154acc6f94747603")
71
71
  end
72
72
  end
73
73
  end
@@ -7,7 +7,7 @@ describe Gitlab::Shell do
7
7
 
8
8
  describe ".execute" do
9
9
  context "invalid command" do
10
- it "should raise" do
10
+ it "raises RuntimeError" do
11
11
  expect { Gitlab::Shell.execute 'foobar', [] }.to raise_error(RuntimeError)
12
12
  end
13
13
  end
@@ -18,27 +18,27 @@ describe Gitlab::Shell do
18
18
  @history = Gitlab::Shell.history
19
19
  end
20
20
 
21
- it "should return a Gitlab::Shell::History instance" do
21
+ it "returns a Gitlab::Shell::History instance" do
22
22
  expect(@history).to be_a Gitlab::Shell::History
23
23
  end
24
- it "should respond to :save" do
24
+ it "responds to :save" do
25
25
  expect(@history).to respond_to :save
26
26
  end
27
- it "should respond to :load" do
27
+ it "responds to :load" do
28
28
  expect(@history).to respond_to :load
29
29
  end
30
- it "should respond to :<<" do
30
+ it "responds to :<<" do
31
31
  expect(@history).to respond_to :<<
32
32
  end
33
33
  end
34
34
 
35
35
  describe ".setup" do
36
- it "should set the Readline completion_proc" do
36
+ it "sets the Readline completion_proc" do
37
37
  completion = Readline.completion_proc
38
38
  expect(completion).to be_truthy
39
39
  expect(completion).to be_a Proc
40
40
  end
41
- it "should set the Readline completion_append_character" do
41
+ it "sets the Readline completion_append_character" do
42
42
  completion_character = Readline.completion_append_character
43
43
  expect(completion_character).to eq(' ')
44
44
  end
@@ -48,21 +48,21 @@ describe Gitlab::Shell do
48
48
  before do
49
49
  @comp = Gitlab::Shell.completion
50
50
  end
51
- it "should return a Proc object" do
51
+ it "returns a Proc object" do
52
52
  expect(@comp).to be_a Proc
53
53
  end
54
54
  context "called with an argument" do
55
- it "should return an Array of matching commands" do
55
+ it "returns an Array of matching commands" do
56
56
  completed_cmds = @comp.call 'group'
57
57
  expect(completed_cmds).to be_a Array
58
- expect(completed_cmds.sort).to eq(%w(group group_members group_projects group_search groups))
58
+ expect(completed_cmds.sort).to eq(%w(group group_member group_members group_projects group_search group_subgroups group_variable group_variables groups))
59
59
  end
60
60
  end
61
61
  end
62
62
 
63
63
  describe ".parse_input" do
64
64
  context "with arguments" do
65
- it "should set command & arguments" do
65
+ it "sets command & arguments" do
66
66
  Gitlab::Shell.parse_input('create_branch 1 "api" "master"')
67
67
  expect(Gitlab::Shell.command).to eq('create_branch')
68
68
  expect(Gitlab::Shell.arguments).to eq(%w(1 api master))
@@ -70,7 +70,7 @@ describe Gitlab::Shell do
70
70
  end
71
71
 
72
72
  context "without arguments" do
73
- it 'should set command & empty arguments' do
73
+ it 'sets command & empty arguments' do
74
74
  Gitlab::Shell.parse_input('exit')
75
75
  expect(Gitlab::Shell.command).to eq('exit')
76
76
  expect(Gitlab::Shell.arguments).to be_empty
@@ -4,11 +4,11 @@ describe Gitlab do
4
4
  after { Gitlab.reset }
5
5
 
6
6
  describe ".client" do
7
- it "should be a Gitlab::Client" do
7
+ it "is a Gitlab::Client" do
8
8
  expect(Gitlab.client).to be_a Gitlab::Client
9
9
  end
10
10
 
11
- it "should not override each other" do
11
+ it "does not override each other" do
12
12
  client1 = Gitlab.client(endpoint: 'https://api1.example.com', private_token: '001')
13
13
  client2 = Gitlab.client(endpoint: 'https://api2.example.com', private_token: '002')
14
14
  expect(client1.endpoint).to eq('https://api1.example.com')
@@ -17,14 +17,14 @@ describe Gitlab do
17
17
  expect(client2.private_token).to eq('002')
18
18
  end
19
19
 
20
- it "should set private_token to the auth_token when provided" do
20
+ it "sets private_token to the auth_token when provided" do
21
21
  client = Gitlab.client(endpoint: 'https://api2.example.com', auth_token: '3225e2804d31fea13fc41fc83bffef00cfaedc463118646b154acc6f94747603')
22
22
  expect(client.private_token).to eq('3225e2804d31fea13fc41fc83bffef00cfaedc463118646b154acc6f94747603')
23
23
  end
24
24
  end
25
25
 
26
26
  describe ".actions" do
27
- it "should return an array of client methods" do
27
+ it "returns an array of client methods" do
28
28
  actions = Gitlab.actions
29
29
  expect(actions).to be_an Array
30
30
  expect(actions.first).to be_a Symbol
@@ -33,41 +33,41 @@ describe Gitlab do
33
33
  end
34
34
 
35
35
  describe ".endpoint=" do
36
- it "should set endpoint" do
36
+ it "sets endpoint" do
37
37
  Gitlab.endpoint = 'https://api.example.com'
38
38
  expect(Gitlab.endpoint).to eq('https://api.example.com')
39
39
  end
40
40
  end
41
41
 
42
42
  describe ".private_token=" do
43
- it "should set private_token" do
43
+ it "sets private_token" do
44
44
  Gitlab.private_token = 'secret'
45
45
  expect(Gitlab.private_token).to eq('secret')
46
46
  end
47
47
  end
48
48
 
49
49
  describe ".auth_token=" do
50
- it "should set auth_token", focus: true do
50
+ it "sets auth_token", focus: true do
51
51
  Gitlab.auth_token = 'auth_secret'
52
52
  expect(Gitlab.private_token).to eq('auth_secret')
53
53
  end
54
54
  end
55
55
 
56
56
  describe ".sudo=" do
57
- it "should set sudo" do
57
+ it "sets sudo" do
58
58
  Gitlab.sudo = 'user'
59
59
  expect(Gitlab.sudo).to eq('user')
60
60
  end
61
61
  end
62
62
 
63
63
  describe ".user_agent" do
64
- it "should return default user_agent" do
64
+ it "returns default user_agent" do
65
65
  expect(Gitlab.user_agent).to eq(Gitlab::Configuration::DEFAULT_USER_AGENT)
66
66
  end
67
67
  end
68
68
 
69
69
  describe ".user_agent=" do
70
- it "should set user_agent" do
70
+ it "sets user_agent" do
71
71
  Gitlab.user_agent = 'Custom User Agent'
72
72
  expect(Gitlab.user_agent).to eq('Custom User Agent')
73
73
  end
@@ -75,7 +75,7 @@ describe Gitlab do
75
75
 
76
76
  describe ".configure" do
77
77
  Gitlab::Configuration::VALID_OPTIONS_KEYS.each do |key|
78
- it "should set #{key}" do
78
+ it "sets #{key}" do
79
79
  Gitlab.configure do |config|
80
80
  config.send("#{key}=", key)
81
81
  expect(Gitlab.send(key)).to eq(key)
@@ -89,9 +89,8 @@ describe Gitlab do
89
89
  Gitlab.endpoint = 'https://api.example.com'
90
90
  request = class_spy(Gitlab::Request).as_stubbed_const
91
91
 
92
- Gitlab.http_proxy('fazbearentertainment.com', 1987, 'ffazbear', 'itsme')
93
- expect(request).to have_received(:http_proxy).
94
- with('fazbearentertainment.com', 1987, 'ffazbear', 'itsme')
92
+ Gitlab.http_proxy('proxy.example.net', 1987, 'user', 'pass')
93
+ expect(request).to have_received(:http_proxy).with('proxy.example.net', 1987, 'user', 'pass')
95
94
  end
96
95
  end
97
96
  end