travis 1.11.1 → 1.13.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (158) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +34 -3
  3. data/Rakefile +22 -20
  4. data/bin/travis +5 -3
  5. data/examples/org_overview.rb +2 -0
  6. data/examples/pro_auth.rb +3 -1
  7. data/examples/stream.rb +5 -3
  8. data/lib/travis/auto_login.rb +2 -0
  9. data/lib/travis/cli/accounts.rb +12 -9
  10. data/lib/travis/cli/api_command.rb +85 -81
  11. data/lib/travis/cli/branches.rb +8 -6
  12. data/lib/travis/cli/cache.rb +48 -44
  13. data/lib/travis/cli/cancel.rb +4 -2
  14. data/lib/travis/cli/command.rb +170 -142
  15. data/lib/travis/cli/console.rb +5 -5
  16. data/lib/travis/cli/disable.rb +4 -2
  17. data/lib/travis/cli/enable.rb +14 -12
  18. data/lib/travis/cli/encrypt.rb +57 -57
  19. data/lib/travis/cli/encrypt_file.rb +29 -18
  20. data/lib/travis/cli/endpoint.rb +9 -7
  21. data/lib/travis/cli/env.rb +13 -8
  22. data/lib/travis/cli/help.rb +11 -9
  23. data/lib/travis/cli/history.rb +19 -15
  24. data/lib/travis/cli/init.rb +27 -24
  25. data/lib/travis/cli/lint.rb +10 -8
  26. data/lib/travis/cli/login.rb +17 -11
  27. data/lib/travis/cli/logout.rb +4 -2
  28. data/lib/travis/cli/logs.rb +28 -19
  29. data/lib/travis/cli/monitor.rb +11 -8
  30. data/lib/travis/cli/open.rb +17 -14
  31. data/lib/travis/cli/parser.rb +2 -0
  32. data/lib/travis/cli/pubkey.rb +13 -11
  33. data/lib/travis/cli/raw.rb +4 -3
  34. data/lib/travis/cli/regenerate_token.rb +15 -0
  35. data/lib/travis/cli/remove_token.rb +15 -0
  36. data/lib/travis/cli/repo_command.rb +123 -112
  37. data/lib/travis/cli/report.rb +40 -33
  38. data/lib/travis/cli/repos.rb +14 -9
  39. data/lib/travis/cli/requests.rb +13 -12
  40. data/lib/travis/cli/restart.rb +4 -2
  41. data/lib/travis/cli/settings.rb +41 -35
  42. data/lib/travis/cli/setup/anynines.rb +7 -6
  43. data/lib/travis/cli/setup/appfog.rb +6 -4
  44. data/lib/travis/cli/setup/artifacts.rb +7 -5
  45. data/lib/travis/cli/setup/biicode.rb +6 -4
  46. data/lib/travis/cli/setup/cloud_66.rb +6 -4
  47. data/lib/travis/cli/setup/cloud_control.rb +8 -6
  48. data/lib/travis/cli/setup/cloud_files.rb +7 -5
  49. data/lib/travis/cli/setup/cloud_foundry.rb +9 -7
  50. data/lib/travis/cli/setup/code_deploy.rb +33 -29
  51. data/lib/travis/cli/setup/deis.rb +8 -6
  52. data/lib/travis/cli/setup/divshot.rb +20 -18
  53. data/lib/travis/cli/setup/elastic_beanstalk.rb +10 -8
  54. data/lib/travis/cli/setup/engine_yard.rb +9 -7
  55. data/lib/travis/cli/setup/gcs.rb +9 -7
  56. data/lib/travis/cli/setup/hackage.rb +6 -4
  57. data/lib/travis/cli/setup/heroku.rb +10 -4
  58. data/lib/travis/cli/setup/modulus.rb +5 -3
  59. data/lib/travis/cli/setup/ninefold.rb +7 -5
  60. data/lib/travis/cli/setup/nodejitsu.rb +6 -4
  61. data/lib/travis/cli/setup/npm.rb +6 -4
  62. data/lib/travis/cli/setup/open_shift.rb +8 -6
  63. data/lib/travis/cli/setup/opsworks.rb +24 -22
  64. data/lib/travis/cli/setup/pypi.rb +7 -5
  65. data/lib/travis/cli/setup/releases.rb +6 -6
  66. data/lib/travis/cli/setup/ruby_gems.rb +7 -5
  67. data/lib/travis/cli/setup/s3.rb +12 -8
  68. data/lib/travis/cli/setup/sauce_connect.rb +7 -5
  69. data/lib/travis/cli/setup/service.rb +36 -25
  70. data/lib/travis/cli/setup.rb +7 -3
  71. data/lib/travis/cli/show.rb +10 -8
  72. data/lib/travis/cli/sshkey.rb +31 -27
  73. data/lib/travis/cli/status.rb +5 -3
  74. data/lib/travis/cli/sync.rb +9 -7
  75. data/lib/travis/cli/token.rb +4 -2
  76. data/lib/travis/cli/version.rb +4 -3
  77. data/lib/travis/cli/whatsup.rb +10 -8
  78. data/lib/travis/cli/whoami.rb +2 -2
  79. data/lib/travis/cli.rb +81 -76
  80. data/lib/travis/client/account.rb +8 -6
  81. data/lib/travis/client/artifact.rb +16 -12
  82. data/lib/travis/client/auto_login.rb +7 -4
  83. data/lib/travis/client/broadcast.rb +2 -0
  84. data/lib/travis/client/build.rb +7 -3
  85. data/lib/travis/client/cache.rb +4 -2
  86. data/lib/travis/client/commit.rb +5 -2
  87. data/lib/travis/client/entity.rb +50 -46
  88. data/lib/travis/client/env_var.rb +13 -8
  89. data/lib/travis/client/error.rb +5 -3
  90. data/lib/travis/client/has_uuid.rb +3 -1
  91. data/lib/travis/client/job.rb +8 -3
  92. data/lib/travis/client/lint_result.rb +2 -0
  93. data/lib/travis/client/listener.rb +70 -55
  94. data/lib/travis/client/methods.rb +26 -5
  95. data/lib/travis/client/namespace.rb +20 -16
  96. data/lib/travis/client/not_loadable.rb +3 -1
  97. data/lib/travis/client/repository.rb +34 -22
  98. data/lib/travis/client/request.rb +5 -2
  99. data/lib/travis/client/restartable.rb +2 -0
  100. data/lib/travis/client/session.rb +118 -88
  101. data/lib/travis/client/settings.rb +8 -3
  102. data/lib/travis/client/singleton_setting.rb +2 -0
  103. data/lib/travis/client/ssh_key.rb +2 -0
  104. data/lib/travis/client/states.rb +8 -6
  105. data/lib/travis/client/user.rb +2 -0
  106. data/lib/travis/client/weak_entity.rb +6 -3
  107. data/lib/travis/client.rb +4 -1
  108. data/lib/travis/pro/auto_login.rb +2 -0
  109. data/lib/travis/pro.rb +2 -0
  110. data/lib/travis/tools/assets.rb +6 -3
  111. data/lib/travis/tools/completion.rb +10 -6
  112. data/lib/travis/tools/formatter.rb +20 -14
  113. data/lib/travis/tools/github.rb +59 -49
  114. data/lib/travis/tools/notification.rb +18 -13
  115. data/lib/travis/tools/safe_string.rb +4 -1
  116. data/lib/travis/tools/ssl_key.rb +5 -2
  117. data/lib/travis/tools/system.rb +11 -6
  118. data/lib/travis/version.rb +3 -1
  119. data/lib/travis.rb +3 -1
  120. data/spec/cli/api_command_spec.rb +11 -8
  121. data/spec/cli/cancel_spec.rb +2 -4
  122. data/spec/cli/encrypt_file_spec.rb +9 -7
  123. data/spec/cli/encrypt_spec.rb +19 -17
  124. data/spec/cli/endpoint_spec.rb +12 -10
  125. data/spec/cli/help_spec.rb +14 -12
  126. data/spec/cli/history_spec.rb +2 -0
  127. data/spec/cli/init_spec.rb +35 -33
  128. data/spec/cli/logs_spec.rb +2 -0
  129. data/spec/cli/open_spec.rb +6 -4
  130. data/spec/cli/repo_command_spec.rb +8 -4
  131. data/spec/cli/restart_spec.rb +2 -4
  132. data/spec/cli/setup/service_spec.rb +17 -18
  133. data/spec/cli/setup_spec.rb +2 -4
  134. data/spec/cli/show_spec.rb +4 -2
  135. data/spec/cli/status_spec.rb +7 -5
  136. data/spec/cli/token_spec.rb +7 -5
  137. data/spec/cli/version_spec.rb +2 -0
  138. data/spec/cli/whoami_spec.rb +9 -7
  139. data/spec/client/account_spec.rb +28 -20
  140. data/spec/client/auto_login_spec.rb +12 -9
  141. data/spec/client/broadcast_spec.rb +5 -3
  142. data/spec/client/build_spec.rb +28 -24
  143. data/spec/client/commit_spec.rb +17 -14
  144. data/spec/client/job_spec.rb +27 -23
  145. data/spec/client/methods_spec.rb +8 -4
  146. data/spec/client/namespace_spec.rb +8 -4
  147. data/spec/client/repository_spec.rb +33 -30
  148. data/spec/client/session_spec.rb +71 -67
  149. data/spec/client/user_spec.rb +13 -10
  150. data/spec/client_spec.rb +6 -4
  151. data/spec/pro_spec.rb +5 -3
  152. data/spec/spec_helper.rb +3 -1
  153. data/spec/support/fake_api.rb +662 -662
  154. data/spec/support/fake_github.rb +6 -3
  155. data/spec/support/helpers.rb +13 -8
  156. data/spec/travis_spec.rb +5 -3
  157. data/travis.gemspec +402 -399
  158. metadata +31 -49
@@ -1,53 +1,52 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Travis::CLI::Setup::Service do
4
6
  subject :service do
5
- repository = double('repository',{:slug => 'test_slug'})
6
- setup = double('Setup', :repository => repository)
7
+ repository = double('repository', { slug: 'test_slug' })
8
+ setup = double('Setup', repository:)
7
9
  described_class.new(setup)
8
10
  end
9
-
11
+
10
12
  describe '#deploy' do
11
-
12
13
  subject :deploy_config do
13
- {'provider' => 'dummy'}
14
+ { 'provider' => 'dummy' }
14
15
  end
15
-
16
+
16
17
  before do
17
18
  allow(service).to receive(:configure).and_yield(deploy_config)
18
19
  allow(service).to receive(:on).and_return(nil)
19
20
  end
20
-
21
+
21
22
  context 'with no existing deploy section' do
22
-
23
23
  it 'creates section contents without optional items' do
24
24
  service.send(:deploy, 'dummy') { |_| }
25
25
  expect(deploy_config).to include(
26
- 'provider' => 'dummy',
27
- 'skip_cleanup' => 'true'
26
+ 'provider' => 'dummy',
27
+ 'skip_cleanup' => 'true'
28
28
  )
29
29
  end
30
30
  end
31
-
31
+
32
32
  context 'with existing deploy section' do
33
33
  it 'doesn\'t overwrite existing skip_cleanup' do
34
- deploy_config['skip_cleanup']='false'
34
+ deploy_config['skip_cleanup'] = 'false'
35
35
  service.send(:deploy, 'dummy') { |_| }
36
- expect(deploy_config).to include('skip_cleanup' => 'false')
36
+ expect(deploy_config).to include('skip_cleanup' => 'false')
37
37
  end
38
38
 
39
39
  it 'doesn\'t set skip_cleanup for v2' do
40
- deploy_config['edge']='true'
40
+ deploy_config['edge'] = 'true'
41
41
  service.send(:deploy, 'dummy') { |_| }
42
42
  expect(deploy_config).not_to include('skip_cleanup')
43
43
  end
44
-
44
+
45
45
  it 'sets skip_cleanup for explicit v1' do
46
- deploy_config['edge']='false'
46
+ deploy_config['edge'] = 'false'
47
47
  service.send(:deploy, 'dummy') { |_| }
48
- expect(deploy_config).to include('skip_cleanup' => 'true')
48
+ expect(deploy_config).to include('skip_cleanup' => 'true')
49
49
  end
50
50
  end
51
-
52
51
  end
53
52
  end
@@ -1,5 +1,3 @@
1
- require 'spec_helper'
1
+ # frozen_string_literal: true
2
2
 
3
- describe Travis::CLI::Setup do
4
- # TODO
5
- end
3
+ require 'spec_helper'
@@ -1,9 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Travis::CLI::Show do
4
6
  example 'show 6180.1' do
5
7
  run_cli('show', '6180.1', '-E').should be_success
6
- stdout.should include("Config: ")
7
- stdout.should include("env: GEM=railties")
8
+ stdout.should include('Config: ')
9
+ stdout.should include('env: GEM=railties')
8
10
  end
9
11
  end
@@ -1,27 +1,29 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Travis::CLI::Status do
4
- example "travis status" do
6
+ example 'travis status' do
5
7
  run_cli('status').should be_success
6
8
  stdout.should be == "failed\n"
7
9
  end
8
10
 
9
- example "travis status -x" do
11
+ example 'travis status -x' do
10
12
  run_cli('status', '-x').should_not be_success
11
13
  stdout.should be == "failed\n"
12
14
  end
13
15
 
14
- example "travis status -q" do
16
+ example 'travis status -q' do
15
17
  run_cli('status', '-q').should be_success
16
18
  stdout.should be_empty
17
19
  end
18
20
 
19
- example "travis status -pqx" do
21
+ example 'travis status -pqx' do
20
22
  run_cli('endpoint', '-pqx').should_not be_success
21
23
  stdout.should be_empty
22
24
  end
23
25
 
24
- example "travis status -i" do
26
+ example 'travis status -i' do
25
27
  run_cli('status', '-i', '--skip-completion-check', '-r', 'travis-ci/travis.rb').should be_success
26
28
  stdout.should be == "build #6180 failed\n"
27
29
  end
@@ -1,15 +1,17 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Travis::CLI::Token do
4
- example "travis token (access token set)" do
6
+ example 'travis token (access token set)' do
5
7
  run_cli('token', '-t', 'super-secret').should be_success
6
- stdout.should == "super-secret\n"
8
+ stdout.should
7
9
  stderr.should be_empty
8
10
  end
9
11
 
10
- example "travis token -i (access token set)" do
12
+ example 'travis token -i (access token set)' do
11
13
  run_cli('token', '-it', 'super-secret').should be_success
12
- stdout.should == "Your access token is super-secret\n"
14
+ stdout.should
13
15
  stderr.should be_empty
14
16
  end
15
17
 
@@ -17,6 +19,6 @@ describe Travis::CLI::Token do
17
19
  run_cli('token').should_not be_success
18
20
 
19
21
  stdout.should be_empty
20
- stderr.should == "not logged in, please run #{File.basename($0)} login\n"
22
+ stderr.should == "not logged in, please run #{File.basename($PROGRAM_NAME)} login\n"
21
23
  end
22
24
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Travis::CLI::Version do
@@ -1,32 +1,34 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Travis::CLI::Whoami do
4
- example "travis whoami" do
6
+ example 'travis whoami' do
5
7
  run_cli('whoami').should_not be_success
6
8
  stdout.should be_empty
7
- stderr.should be == "not logged in, please run #{File.basename $0} login\n"
9
+ stderr.should be == "not logged in, please run #{File.basename $PROGRAM_NAME} login\n"
8
10
  end
9
11
 
10
- example "travis whoami --pro" do
12
+ example 'travis whoami --pro' do
11
13
  run_cli('whoami', '--pro').should_not be_success
12
14
  stdout.should be_empty
13
- stderr.should be == "not logged in, please run #{File.basename $0} login --pro\n"
15
+ stderr.should be == "not logged in, please run #{File.basename $PROGRAM_NAME} login\n"
14
16
  end
15
17
 
16
- example "travis whoami -t token" do
18
+ example 'travis whoami -t token' do
17
19
  run_cli('whoami', '-t', 'token').should be_success
18
20
  stdout.should be == "rkh\n"
19
21
  stderr.should be_empty
20
22
  end
21
23
 
22
- example "TRAVIS_TOKEN=token travis whoami" do
24
+ example 'TRAVIS_TOKEN=token travis whoami' do
23
25
  ENV['TRAVIS_TOKEN'] = 'token'
24
26
  run_cli('whoami').should be_success
25
27
  stdout.should be == "rkh\n"
26
28
  stderr.should be_empty
27
29
  end
28
30
 
29
- example "travis whoami -t token -i" do
31
+ example 'travis whoami -t token -i' do
30
32
  run_cli('whoami', '-t', 'token', '-i').should be_success
31
33
  stdout.should be == "You are rkh (Konstantin Haase)\n"
32
34
  stderr.should be_empty
@@ -1,32 +1,40 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Travis::Client::Account do
4
- context "from all accounts" do
5
- let(:session) { Travis::Client.new }
6
+ context 'with all accounts' do
6
7
  subject { session.accounts.first }
7
- its(:name) { should be == 'Konstantin Haase' }
8
- its(:login) { should be == 'rkh' }
9
- its(:type) { should be == 'user' }
10
- its(:repos_count) { should be == 200 }
11
- its(:inspect) { should be == "#<Travis::Client::Account: rkh>" }
12
- end
13
8
 
14
- context "known account" do
15
9
  let(:session) { Travis::Client.new }
16
- subject { session.account('rkh') }
17
- its(:name) { should be == 'Konstantin Haase' }
18
- its(:login) { should be == 'rkh' }
19
- its(:type) { should be == 'user' }
20
- its(:repos_count) { should be == 200 }
21
- its(:inspect) { should be == "#<Travis::Client::Account: rkh>" }
10
+
11
+ its(:name) { is_expected.to be == 'Konstantin Haase' }
12
+ its(:login) { is_expected.to be == 'rkh' }
13
+ its(:type) { is_expected.to be == 'user' }
14
+ its(:repos_count) { is_expected.to be == 200 }
15
+ its(:inspect) { is_expected.to be == '#<Travis::Client::Account: rkh>' }
22
16
  end
23
17
 
24
- context "known account" do
18
+ context 'with known account' do
19
+ subject { session.account('rkh') }
20
+
25
21
  let(:session) { Travis::Client.new }
22
+
23
+ its(:name) { is_expected.to be == 'Konstantin Haase' }
24
+ its(:login) { is_expected.to be == 'rkh' }
25
+ its(:type) { is_expected.to be == 'user' }
26
+ its(:repos_count) { is_expected.to be == 200 }
27
+ its(:inspect) { is_expected.to be == '#<Travis::Client::Account: rkh>' }
28
+ end
29
+
30
+ context 'with known account and nil name' do
26
31
  subject { session.account('foo') }
27
- its(:name) { should be_nil }
28
- its(:login) { should be == 'foo' }
29
- its(:type) { should be_nil }
30
- its(:inspect) { should be == "#<Travis::Client::Account: foo>" }
32
+
33
+ let(:session) { Travis::Client.new }
34
+
35
+ its(:name) { is_expected.to be_nil }
36
+ its(:login) { is_expected.to be == 'foo' }
37
+ its(:type) { is_expected.to be_nil }
38
+ its(:inspect) { is_expected.to be == '#<Travis::Client::Account: foo>' }
31
39
  end
32
40
  end
@@ -1,22 +1,25 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'travis/client/auto_login'
2
4
  require 'spec_helper'
3
5
 
4
6
  describe Travis::Client::AutoLogin do
5
- let(:auto_login_with_token) { Travis::Client::AutoLogin.new(Travis::Client.new, { config_file: travis_config }) }
6
- let(:auto_login_without_token) { Travis::Client::AutoLogin.new(Travis::Client.new) }
7
- let(:travis_config) { File.expand_path("../support/fake_travis_config.yml", File.dirname(__FILE__)) }
7
+ let(:auto_login_with_token) { described_class.new(Travis::Client.new, { config_file: travis_config }) }
8
+ let(:auto_login_without_token) { described_class.new(Travis::Client.new) }
9
+ let(:travis_config) { File.expand_path('../support/fake_travis_config.yml', File.dirname(__FILE__)) }
8
10
 
9
- context "authenticate" do
10
- context "when user has a token in cli config" do
11
- it "does not call Tools::Github#with_token" do
12
- expect_any_instance_of(Travis::Tools::Github).to_not receive(:with_token)
11
+ context 'when user authenticates' do
12
+ context 'when user has a token in cli config' do
13
+ it 'does not call Tools::Github#with_token' do
14
+ expect_any_instance_of(Travis::Tools::Github).not_to receive(:with_token)
13
15
  auto_login_with_token.authenticate
14
16
  end
15
17
  end
16
18
 
17
- context "when user does not have a token in cli config" do
19
+ context 'when user does not have a token in cli config' do
18
20
  before { auto_login_without_token.github.stub(:with_token).and_return(true) }
19
- it "calls Tools::Github#with_token" do
21
+
22
+ it 'calls Tools::Github#with_token' do
20
23
  expect(auto_login_without_token.github).to receive(:with_token)
21
24
  auto_login_without_token.authenticate
22
25
  end
@@ -1,10 +1,12 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Travis::Client::Broadcast do
4
- let(:session) { Travis::Client.new }
5
6
  subject { session.broadcasts.first }
6
7
 
7
- its(:id) { should be == 1 }
8
- its(:message) { should be == "Hello!" }
8
+ let(:session) { Travis::Client.new }
9
9
 
10
+ its(:id) { is_expected.to be == 1 }
11
+ its(:message) { is_expected.to be == 'Hello!' }
10
12
  end
@@ -1,31 +1,35 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Travis::Client::Build do
6
+ subject { session.build(4_125_095) }
7
+
4
8
  let(:session) { Travis::Client.new }
5
- subject { session.build(4125095) }
6
- its(:number) { should be == '6180' }
7
- its(:state) { should be == 'failed' }
8
- its(:duration) { should be == 5019 }
9
- its(:started_at) { should be_a(Time) }
10
- its(:finished_at) { should be_nil }
11
- its(:inspect) { should be == "#<Travis::Client::Build: rails/rails#6180>" }
12
- its(:color) { should be == 'red' }
13
- its(:commit) { should be_a(Travis::Client::Commit) }
14
- its(:jobs) { should be_an(Array) }
15
- its(:repository) { should be == session.repo('rails/rails') }
16
9
 
17
- it { should be == subject.repository.last_build }
10
+ its(:number) { is_expected.to be == '6180' }
11
+ its(:state) { is_expected.to be == 'failed' }
12
+ its(:duration) { is_expected.to be == 5019 }
13
+ its(:started_at) { is_expected.to be_a(Time) }
14
+ its(:finished_at) { is_expected.to be_nil }
15
+ its(:inspect) { is_expected.to be == '#<Travis::Client::Build: rails/rails#6180>' }
16
+ its(:color) { is_expected.to be == 'red' }
17
+ its(:commit) { is_expected.to be_a(Travis::Client::Commit) }
18
+ its(:jobs) { is_expected.to be_an(Array) }
19
+ its(:repository) { is_expected.to be == session.repo('rails/rails') }
20
+
21
+ it { is_expected.to be == subject.repository.last_build }
18
22
 
19
- it { should_not be_pending }
20
- it { should be_started }
21
- it { should be_finished }
22
- it { should_not be_passed }
23
- it { should_not be_errored }
24
- it { should be_failed }
25
- it { should_not be_canceled }
26
- it { should be_created }
27
- it { should be_red }
28
- it { should_not be_green }
29
- it { should_not be_yellow }
30
- it { should be_unsuccessful }
23
+ it { is_expected.not_to be_pending }
24
+ it { is_expected.to be_started }
25
+ it { is_expected.to be_finished }
26
+ it { is_expected.not_to be_passed }
27
+ it { is_expected.not_to be_errored }
28
+ it { is_expected.to be_failed }
29
+ it { is_expected.not_to be_canceled }
30
+ it { is_expected.to be_created }
31
+ it { is_expected.to be_red }
32
+ it { is_expected.not_to be_green }
33
+ it { is_expected.not_to be_yellow }
34
+ it { is_expected.to be_unsuccessful }
31
35
  end
@@ -1,22 +1,25 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Travis::Client::Build do
6
+ subject { session.build(4_125_095).commit }
7
+
4
8
  let(:session) { Travis::Client.new }
5
- subject { session.build(4125095).commit }
6
9
 
7
- its(:sha) { should be == 'a0265b98f16c6e33be32aa3f57231d1189302400' }
8
- its(:short_sha) { should be == 'a0265b9' }
9
- its(:branch) { should be == 'master' }
10
- its(:message) { should be == 'Associaton -> Association' }
11
- its(:committed_at) { should be_a(Time) }
12
- its(:author_name) { should be == 'Steve Klabnik' }
13
- its(:author_email) { should be == 'steve@steveklabnik.com' }
14
- its(:committer_name) { should be == 'Steve Klabnik' }
15
- its(:committer_email) { should be == 'steve@steveklabnik.com' }
16
- its(:compare_url) { should be == 'https://github.com/rails/rails/compare/6581d798e830...a0265b98f16c' }
17
- its(:subject) { should be == 'Associaton -> Association' }
10
+ its(:sha) { is_expected.to be == 'a0265b98f16c6e33be32aa3f57231d1189302400' }
11
+ its(:short_sha) { is_expected.to be == 'a0265b9' }
12
+ its(:branch) { is_expected.to be == 'master' }
13
+ its(:message) { is_expected.to be == 'Associaton -> Association' }
14
+ its(:committed_at) { is_expected.to be_a(Time) }
15
+ its(:author_name) { is_expected.to be == 'Steve Klabnik' }
16
+ its(:author_email) { is_expected.to be == 'steve@steveklabnik.com' }
17
+ its(:committer_name) { is_expected.to be == 'Steve Klabnik' }
18
+ its(:committer_email) { is_expected.to be == 'steve@steveklabnik.com' }
19
+ its(:compare_url) { is_expected.to be == 'https://github.com/rails/rails/compare/6581d798e830...a0265b98f16c' }
20
+ its(:subject) { is_expected.to be == 'Associaton -> Association' }
18
21
 
19
- specify "with missing data" do
20
- session.load("commit" => { "id" => 12 })['commit'].subject.should be_empty
22
+ specify 'with missing data' do
23
+ session.load('commit' => { 'id' => 12 })['commit'].subject.should be_empty
21
24
  end
22
25
  end
@@ -1,30 +1,34 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Travis::Client::Job do
6
+ subject { session.job(4_125_097) }
7
+
4
8
  let(:session) { Travis::Client.new }
5
- subject { session.job(4125097) }
6
- its(:number) { should be == '6180.2' }
7
- its(:state) { should be == 'passed' }
8
- its(:started_at) { should be_a(Time) }
9
- its(:finished_at) { should be_a(Time) }
10
- its(:inspect) { should be == "#<Travis::Client::Job: rails/rails#6180.2>" }
11
- its(:color) { should be == 'green' }
12
- its(:commit) { should be_a(Travis::Client::Commit) }
13
- its(:repository) { should be == session.repo('rails/rails') }
14
- its(:duration) { should be == 905 }
15
9
 
16
- it { should be == subject.build.jobs[1] }
10
+ its(:number) { is_expected.to be == '6180.2' }
11
+ its(:state) { is_expected.to be == 'passed' }
12
+ its(:started_at) { is_expected.to be_a(Time) }
13
+ its(:finished_at) { is_expected.to be_a(Time) }
14
+ its(:inspect) { is_expected.to be == '#<Travis::Client::Job: rails/rails#6180.2>' }
15
+ its(:color) { is_expected.to be == 'green' }
16
+ its(:commit) { is_expected.to be_a(Travis::Client::Commit) }
17
+ its(:repository) { is_expected.to be == session.repo('rails/rails') }
18
+ its(:duration) { is_expected.to be == 905 }
19
+
20
+ it { is_expected.to be == subject.build.jobs[1] }
17
21
 
18
- it { should_not be_pending }
19
- it { should be_started }
20
- it { should be_finished }
21
- it { should be_passed }
22
- it { should_not be_errored }
23
- it { should_not be_failed }
24
- it { should_not be_canceled }
25
- it { should be_created }
26
- it { should_not be_red }
27
- it { should be_green }
28
- it { should_not be_yellow }
29
- it { should_not be_unsuccessful }
22
+ it { is_expected.not_to be_pending }
23
+ it { is_expected.to be_started }
24
+ it { is_expected.to be_finished }
25
+ it { is_expected.to be_passed }
26
+ it { is_expected.not_to be_errored }
27
+ it { is_expected.not_to be_failed }
28
+ it { is_expected.not_to be_canceled }
29
+ it { is_expected.to be_created }
30
+ it { is_expected.not_to be_red }
31
+ it { is_expected.to be_green }
32
+ it { is_expected.not_to be_yellow }
33
+ it { is_expected.not_to be_unsuccessful }
30
34
  end
@@ -1,13 +1,17 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Travis::Client::Methods do
6
+ subject { OpenStruct.new(session:).extend(described_class) }
7
+
4
8
  let(:session) { Travis::Client.new }
5
- subject { OpenStruct.new(:session => session).extend(Travis::Client::Methods) }
9
+
6
10
  before { subject.access_token = 'token' }
7
11
 
8
- its(:api_endpoint) { should be == 'https://api.travis-ci.org/' }
9
- its(:repos) { should be == session.find_many(Travis::Client::Repository) }
10
- its(:user) { should be == session.find_one(Travis::Client::User) }
12
+ its(:api_endpoint) { is_expected.to be == 'https://api.travis-ci.com/' }
13
+ its(:repos) { is_expected.to be == session.find_many(Travis::Client::Repository) }
14
+ its(:user) { is_expected.to be == session.find_one(Travis::Client::User) }
11
15
 
12
16
  it 'fetches a single repo' do
13
17
  subject.repo(891).slug.should be == 'rails/rails'
@@ -1,18 +1,22 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Travis::Client::Namespace do
4
- it { should be_a(Travis::Client::Methods) }
6
+ subject(:namespace) { described_class.new }
7
+
8
+ it { is_expected.to be_a(Travis::Client::Methods) }
5
9
 
6
10
  it 'creates a dummy for repos' do
7
- repo = subject::Repository
11
+ repo = namespace::Repository
8
12
  repo.find_one('rails/rails').should be_a(Travis::Client::Repository)
9
13
  repo.find_many.should be_an(Array)
10
14
  repo.current.should be == repo.find_many
11
15
  end
12
16
 
13
17
  it 'creates a dummy for user' do
14
- subject.access_token = 'token'
15
- user = subject::User
18
+ namespace.access_token = 'token'
19
+ user = namespace::User
16
20
  user.find_one.should be_a(Travis::Client::User)
17
21
  user.current.should be == user.find_one
18
22
  end
@@ -1,39 +1,42 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Travis::Client::Repository do
6
+ subject(:repository) { session.repo('rails/rails') }
7
+
4
8
  let(:session) { Travis::Client.new }
5
- subject { session.repo('rails/rails') }
6
9
 
7
- its(:slug) { should be == 'rails/rails' }
8
- its(:description) { should_not be_empty }
9
- its(:last_build_id) { should be == 4125095 }
10
- its(:last_build_number) { should be == '6180' }
11
- its(:last_build_state) { should be == 'failed' }
12
- its(:last_build_duration) { should be == 5019 }
13
- its(:last_build_started_at) { should be_a(Time) }
14
- its(:last_build_finished_at) { should be_nil }
15
- its(:inspect) { should be == "#<Travis::Client::Repository: rails/rails>" }
16
- its(:key) { should be_a(Travis::Client::Repository::Key) }
17
- its(:last_build) { should be_a(Travis::Client::Build) }
18
- its(:color) { should be == 'red' }
19
- its(:github_language) { should be == 'Ruby' }
20
- its(:owner_name) { should be == 'rails' }
21
- its(:owner) { should be == session.account("rails") }
10
+ its(:slug) { is_expected.to be == 'rails/rails' }
11
+ its(:description) { is_expected.not_to be_empty }
12
+ its(:last_build_id) { is_expected.to be == 4_125_095 }
13
+ its(:last_build_number) { is_expected.to be == '6180' }
14
+ its(:last_build_state) { is_expected.to be == 'failed' }
15
+ its(:last_build_duration) { is_expected.to be == 5019 }
16
+ its(:last_build_started_at) { is_expected.to be_a(Time) }
17
+ its(:last_build_finished_at) { is_expected.to be_nil }
18
+ its(:inspect) { is_expected.to be == '#<Travis::Client::Repository: rails/rails>' }
19
+ its(:key) { is_expected.to be_a(Travis::Client::Repository::Key) }
20
+ its(:last_build) { is_expected.to be_a(Travis::Client::Build) }
21
+ its(:color) { is_expected.to be == 'red' }
22
+ its(:github_language) { is_expected.to be == 'Ruby' }
23
+ its(:owner_name) { is_expected.to be == 'rails' }
24
+ its(:owner) { is_expected.to be == session.account('rails') }
22
25
 
23
- it { should_not be_pending }
24
- it { should be_started }
25
- it { should be_finished }
26
- it { should_not be_passed }
27
- it { should_not be_errored }
28
- it { should be_failed }
29
- it { should_not be_canceled }
30
- it { should be_created }
31
- it { should be_red }
32
- it { should_not be_green }
33
- it { should_not be_yellow }
34
- it { should be_unsuccessful }
26
+ it { is_expected.not_to be_pending }
27
+ it { is_expected.to be_started }
28
+ it { is_expected.to be_finished }
29
+ it { is_expected.not_to be_passed }
30
+ it { is_expected.not_to be_errored }
31
+ it { is_expected.to be_failed }
32
+ it { is_expected.not_to be_canceled }
33
+ it { is_expected.to be_created }
34
+ it { is_expected.to be_red }
35
+ it { is_expected.not_to be_green }
36
+ it { is_expected.not_to be_yellow }
37
+ it { is_expected.to be_unsuccessful }
35
38
 
36
- it 'should expose the pubkey fingerprint' do
37
- subject.public_key.fingerprint.should be == 'foobar'
39
+ it 'exposes the pubkey fingerprint' do
40
+ repository.public_key.fingerprint.should be == 'foobar'
38
41
  end
39
42
  end