tugboat 2.2.2 → 2.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +520 -0
  3. data/CHANGELOG.md +9 -0
  4. data/Gemfile +0 -6
  5. data/README.md +34 -2
  6. data/Rakefile +6 -1
  7. data/bin/tugboat +2 -2
  8. data/features/cassettes/config/Array_of_SSH_Keys_in_Config.yml +1 -1
  9. data/features/cassettes/config/Single_SSH_key_as_number_in_config.yml +1 -1
  10. data/features/step_definitions/steps.rb +1 -1
  11. data/features/support/env.rb +7 -3
  12. data/lib/tugboat.rb +2 -2
  13. data/lib/tugboat/cli.rb +394 -444
  14. data/lib/tugboat/config.rb +43 -61
  15. data/lib/tugboat/middleware.rb +33 -33
  16. data/lib/tugboat/middleware/add_key.rb +12 -13
  17. data/lib/tugboat/middleware/ask_for_credentials.rb +12 -13
  18. data/lib/tugboat/middleware/base.rb +25 -20
  19. data/lib/tugboat/middleware/check_configuration.rb +3 -6
  20. data/lib/tugboat/middleware/check_credentials.rb +0 -1
  21. data/lib/tugboat/middleware/check_droplet_active.rb +2 -4
  22. data/lib/tugboat/middleware/check_droplet_inactive.rb +2 -4
  23. data/lib/tugboat/middleware/config.rb +3 -5
  24. data/lib/tugboat/middleware/confirm_action.rb +4 -6
  25. data/lib/tugboat/middleware/create_droplet.rb +27 -44
  26. data/lib/tugboat/middleware/custom_logger.rb +52 -54
  27. data/lib/tugboat/middleware/destroy_droplet.rb +5 -6
  28. data/lib/tugboat/middleware/destroy_image.rb +5 -6
  29. data/lib/tugboat/middleware/find_droplet.rb +43 -47
  30. data/lib/tugboat/middleware/find_image.rb +23 -29
  31. data/lib/tugboat/middleware/halt_droplet.rb +9 -10
  32. data/lib/tugboat/middleware/info_droplet.rb +30 -33
  33. data/lib/tugboat/middleware/info_image.rb +1 -1
  34. data/lib/tugboat/middleware/inject_client.rb +8 -10
  35. data/lib/tugboat/middleware/inject_configuration.rb +1 -2
  36. data/lib/tugboat/middleware/list_droplets.rb +9 -10
  37. data/lib/tugboat/middleware/list_images.rb +9 -9
  38. data/lib/tugboat/middleware/list_regions.rb +1 -1
  39. data/lib/tugboat/middleware/list_sizes.rb +1 -1
  40. data/lib/tugboat/middleware/list_ssh_keys.rb +1 -3
  41. data/lib/tugboat/middleware/password_reset.rb +6 -7
  42. data/lib/tugboat/middleware/rebuild_droplet.rb +7 -7
  43. data/lib/tugboat/middleware/resize_droplet.rb +6 -7
  44. data/lib/tugboat/middleware/restart_droplet.rb +4 -11
  45. data/lib/tugboat/middleware/snapshot_droplet.rb +7 -8
  46. data/lib/tugboat/middleware/ssh_droplet.rb +30 -31
  47. data/lib/tugboat/middleware/start_droplet.rb +5 -5
  48. data/lib/tugboat/middleware/wait_for_state.rb +2 -3
  49. data/lib/tugboat/version.rb +1 -1
  50. data/spec/cli/add_key_spec.rb +25 -28
  51. data/spec/cli/authorize_cli_spec.rb +57 -60
  52. data/spec/cli/config_cli_spec.rb +8 -11
  53. data/spec/cli/create_cli_spec.rb +40 -46
  54. data/spec/cli/debug_cli_spec.rb +29 -29
  55. data/spec/cli/destroy_cli_spec.rb +58 -60
  56. data/spec/cli/destroy_image_cli_spec.rb +42 -45
  57. data/spec/cli/droplets_cli_spec.rb +62 -64
  58. data/spec/cli/env_variable_spec.rb +14 -15
  59. data/spec/cli/halt_cli_spec.rb +65 -69
  60. data/spec/cli/help_cli_spec.rb +8 -8
  61. data/spec/cli/images_cli_spec.rb +28 -30
  62. data/spec/cli/info_cli_spec.rb +144 -147
  63. data/spec/cli/info_image_cli_spec.rb +57 -60
  64. data/spec/cli/keys_cli_spec.rb +8 -10
  65. data/spec/cli/password_reset_cli_spec.rb +56 -56
  66. data/spec/cli/rebuild_cli_spec.rb +194 -198
  67. data/spec/cli/regions_cli_spec.rb +8 -8
  68. data/spec/cli/resize_cli_spec.rb +54 -56
  69. data/spec/cli/restart_cli_spec.rb +53 -57
  70. data/spec/cli/sizes_cli_spec.rb +7 -8
  71. data/spec/cli/snapshot_cli_spec.rb +50 -53
  72. data/spec/cli/ssh_cli_spec.rb +41 -42
  73. data/spec/cli/start_cli_spec.rb +48 -52
  74. data/spec/cli/verify_cli_spec.rb +22 -25
  75. data/spec/cli/version_cli_spec.rb +6 -8
  76. data/spec/cli/wait_cli_spec.rb +50 -52
  77. data/spec/config_spec.rb +56 -57
  78. data/spec/middleware/base_spec.rb +5 -6
  79. data/spec/middleware/check_configuration_spec.rb +5 -7
  80. data/spec/middleware/check_credentials_spec.rb +9 -10
  81. data/spec/middleware/check_droplet_active_spec.rb +5 -7
  82. data/spec/middleware/check_droplet_inactive_spec.rb +5 -7
  83. data/spec/middleware/find_droplet_spec.rb +4 -5
  84. data/spec/middleware/find_image_spec.rb +4 -5
  85. data/spec/middleware/inject_client_spec.rb +9 -12
  86. data/spec/middleware/inject_configuration_spec.rb +4 -7
  87. data/spec/middleware/ssh_droplet_spec.rb +70 -73
  88. data/spec/shared/environment.rb +18 -20
  89. data/spec/spec_helper.rb +4 -4
  90. data/tugboat.gemspec +10 -6
  91. metadata +88 -17
@@ -1,37 +1,37 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Tugboat::CLI do
4
- include_context "spec"
4
+ include_context 'spec'
5
5
 
6
- describe "ssh" do
6
+ describe 'ssh' do
7
7
  it "tries to fetch the droplet's IP from the API" do
8
- stub_request(:get, "https://api.digitalocean.com/v2/droplets?page=1&per_page=1").
9
- with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization'=>'Bearer foo', 'Content-Type'=>'application/json', 'User-Agent'=>'Faraday v0.9.2'}).
10
- to_return(:status => 200, :body => fixture('show_droplets'), :headers => {})
8
+ stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=1').
9
+ with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.11.0' }).
10
+ to_return(status: 200, body: fixture('show_droplets'), headers: {})
11
11
 
12
- stub_request(:get, "https://api.digitalocean.com/v2/droplets?page=1&per_page=200").
13
- to_return(:headers => {'Content-Type' => 'application/json'}, :status => 200, :body => fixture("show_droplets"))
14
- allow(Kernel).to receive(:exec).with('ssh', anything(), anything(),anything(), anything(),anything(), anything(),anything(), anything(),anything(), anything(),anything(), anything(),anything())
12
+ stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=200').
13
+ to_return(headers: { 'Content-Type' => 'application/json' }, status: 200, body: fixture('show_droplets'))
14
+ allow(Kernel).to receive(:exec).with('ssh', anything, anything, anything, anything, anything, anything, anything, anything, anything, anything, anything, anything, anything)
15
15
 
16
- @cli.ssh("example.com")
16
+ cli.ssh('example.com')
17
17
  end
18
18
 
19
19
  it "wait's until droplet active if -w command is given and droplet already active" do
20
- stub_request(:get, "https://api.digitalocean.com/v2/droplets?page=1&per_page=1").
21
- with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization'=>'Bearer foo', 'Content-Type'=>'application/json', 'User-Agent'=>'Faraday v0.9.2'}).
22
- to_return(:status => 200, :body => "", :headers => {})
20
+ stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=1').
21
+ with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.11.0' }).
22
+ to_return(status: 200, body: '', headers: {})
23
23
 
24
- stub_request(:get, "https://api.digitalocean.com/v2/droplets/6918990?per_page=200").
25
- with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization'=>'Bearer foo', 'Content-Type'=>'application/json', 'User-Agent'=>'Faraday v0.9.2'}).
26
- to_return(:status => 200, :body => fixture('show_droplet'), :headers => {})
24
+ stub_request(:get, 'https://api.digitalocean.com/v2/droplets/6918990?per_page=200').
25
+ with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.11.0' }).
26
+ to_return(status: 200, body: fixture('show_droplet'), headers: {})
27
27
 
28
- stub_request(:get, "https://api.digitalocean.com/v2/droplets?page=1&per_page=200").
29
- to_return(:headers => {'Content-Type' => 'application/json'}, :status => 200, :body => fixture("show_droplets"))
30
- allow(Kernel).to receive(:exec).with('ssh', anything(), anything(),anything(), anything(),anything(), anything(),anything(), anything(),anything(), anything(),anything(), anything(),anything())
28
+ stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=200').
29
+ to_return(headers: { 'Content-Type' => 'application/json' }, status: 200, body: fixture('show_droplets'))
30
+ allow(Kernel).to receive(:exec).with('ssh', anything, anything, anything, anything, anything, anything, anything, anything, anything, anything, anything, anything, anything)
31
31
 
32
- @cli.options = @cli.options.merge(:wait => true)
32
+ cli.options = cli.options.merge(wait: true)
33
33
 
34
- @cli.ssh("example.com")
34
+ cli.ssh('example.com')
35
35
 
36
36
  expect($stdout.string).to eq <<-eos
37
37
  Droplet fuzzy name provided. Finding droplet ID...done\e[0m, 6918990 (example.com)
@@ -44,24 +44,24 @@ SShing with options: -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownH
44
44
  end
45
45
 
46
46
  it "wait's until droplet active if -w command is given and droplet eventually active" do
47
- stub_request(:get, "https://api.digitalocean.com/v2/droplets?page=1&per_page=1").
48
- with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization'=>'Bearer foo', 'Content-Type'=>'application/json', 'User-Agent'=>'Faraday v0.9.2'}).
49
- to_return(:status => 200, :body => "", :headers => {})
47
+ stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=1').
48
+ with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.11.0' }).
49
+ to_return(status: 200, body: '', headers: {})
50
50
 
51
- stub_request(:get, "https://api.digitalocean.com/v2/droplets/6918990?per_page=200").
52
- with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization'=>'Bearer foo', 'Content-Type'=>'application/json', 'User-Agent'=>'Faraday v0.9.2'}).
53
- to_return(
54
- {:status => 200, :body => fixture('show_droplet_inactive'), :headers => {}},
55
- {:status => 200, :body => fixture('show_droplet'), :headers => {}}
56
- )
51
+ stub_request(:get, 'https://api.digitalocean.com/v2/droplets/6918990?per_page=200').
52
+ with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.11.0' }).
53
+ to_return(
54
+ { status: 200, body: fixture('show_droplet_inactive'), headers: {} },
55
+ status: 200, body: fixture('show_droplet'), headers: {}
56
+ )
57
57
 
58
- stub_request(:get, "https://api.digitalocean.com/v2/droplets?page=1&per_page=200").
59
- to_return(:headers => {'Content-Type' => 'application/json'}, :status => 200, :body => fixture("show_droplets"))
60
- allow(Kernel).to receive(:exec).with('ssh', anything(), anything(),anything(), anything(),anything(), anything(),anything(), anything(),anything(), anything(),anything(), anything(),anything())
58
+ stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=200').
59
+ to_return(headers: { 'Content-Type' => 'application/json' }, status: 200, body: fixture('show_droplets'))
60
+ allow(Kernel).to receive(:exec).with('ssh', anything, anything, anything, anything, anything, anything, anything, anything, anything, anything, anything, anything, anything)
61
61
 
62
- @cli.options = @cli.options.merge(:wait => true)
62
+ cli.options = cli.options.merge(wait: true)
63
63
 
64
- @cli.ssh("example.com")
64
+ cli.ssh('example.com')
65
65
 
66
66
  expect($stdout.string).to eq <<-eos
67
67
  Droplet fuzzy name provided. Finding droplet ID...done\e[0m, 6918990 (example.com)
@@ -73,22 +73,21 @@ SShing with options: -o LogLevel=ERROR -o StrictHostKeyChecking=no -o UserKnownH
73
73
  eos
74
74
  end
75
75
 
76
- it "does not allow ssh into a droplet that is inactive" do
77
- stub_request(:get, "https://api.digitalocean.com/v2/droplets?page=1&per_page=1").
78
- with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization'=>'Bearer foo', 'Content-Type'=>'application/json', 'User-Agent'=>'Faraday v0.9.2'}).
79
- to_return(:status => 200, :body => fixture('show_droplets'), :headers => {})
76
+ it 'does not allow ssh into a droplet that is inactive' do
77
+ stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=1').
78
+ with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.11.0' }).
79
+ to_return(status: 200, body: fixture('show_droplets'), headers: {})
80
80
 
81
- stub_request(:get, "https://api.digitalocean.com/v2/droplets?page=1&per_page=200").
82
- to_return(:headers => {'Content-Type' => 'application/json'}, :status => 200, :body => fixture("show_droplets"))
81
+ stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=200').
82
+ to_return(headers: { 'Content-Type' => 'application/json' }, status: 200, body: fixture('show_droplets'))
83
83
  allow(Kernel).to receive(:exec)
84
84
 
85
- expect {@cli.ssh("example3.com")}.to raise_error(SystemExit)
85
+ expect { cli.ssh('example3.com') }.to raise_error(SystemExit)
86
86
 
87
87
  expect($stdout.string).to eq <<-eos
88
88
  Droplet fuzzy name provided. Finding droplet ID...done\e[0m, 3164444 (example3.com)
89
89
  Droplet must be on for this operation to be successful.
90
90
  eos
91
91
  end
92
-
93
92
  end
94
93
  end
@@ -1,24 +1,24 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Tugboat::CLI do
4
- include_context "spec"
4
+ include_context 'spec'
5
5
 
6
- describe "start" do
7
- it "starts the droplet with a fuzzy name" do
8
- stub_request(:get, "https://api.digitalocean.com/v2/droplets?page=1&per_page=1").
9
- with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization'=>'Bearer foo', 'Content-Type'=>'application/json', 'User-Agent'=>'Faraday v0.9.2'}).
10
- to_return(:status => 200, :body => fixture('show_droplets'), :headers => {})
6
+ describe 'start' do
7
+ it 'starts the droplet with a fuzzy name' do
8
+ stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=1').
9
+ with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.11.0' }).
10
+ to_return(status: 200, body: fixture('show_droplets'), headers: {})
11
11
 
12
- stub_request(:get, "https://api.digitalocean.com/v2/droplets?page=1&per_page=200").
13
- with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization'=>'Bearer foo', 'Content-Type'=>'application/json', 'User-Agent'=>'Faraday v0.9.2'}).
14
- to_return(:status => 200, :body => fixture('show_droplets'), :headers => {})
12
+ stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=200').
13
+ with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.11.0' }).
14
+ to_return(status: 200, body: fixture('show_droplets'), headers: {})
15
15
 
16
- stub_request(:post, "https://api.digitalocean.com/v2/droplets/3164444/actions").
17
- with(:body => "{\"type\":\"power_on\"}",
18
- :headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization'=>'Bearer foo', 'Content-Type'=>'application/json', 'User-Agent'=>'Faraday v0.9.2'}).
19
- to_return(:status => 200, :body => fixture('droplet_start_response'), :headers => {})
16
+ stub_request(:post, 'https://api.digitalocean.com/v2/droplets/3164444/actions').
17
+ with(body: '{"type":"power_on"}',
18
+ headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.11.0' }).
19
+ to_return(status: 200, body: fixture('droplet_start_response'), headers: {})
20
20
 
21
- @cli.start("example3.com")
21
+ cli.start('example3.com')
22
22
 
23
23
  expect($stdout.string).to eq <<-eos
24
24
  Droplet fuzzy name provided. Finding droplet ID...done\e[0m, 3164444 (example3.com)
@@ -26,22 +26,21 @@ Queuing start for 3164444 (example3.com)...Start complete!
26
26
  eos
27
27
  end
28
28
 
29
- it "starts the droplet with an id" do
30
- stub_request(:get, "https://api.digitalocean.com/v2/droplets?page=1&per_page=1").
31
- with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization'=>'Bearer foo', 'Content-Type'=>'application/json', 'User-Agent'=>'Faraday v0.9.2'}).
32
- to_return(:status => 200, :body => fixture('show_droplets'), :headers => {})
29
+ it 'starts the droplet with an id' do
30
+ stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=1').
31
+ with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.11.0' }).
32
+ to_return(status: 200, body: fixture('show_droplets'), headers: {})
33
33
 
34
- stub_request(:get, "https://api.digitalocean.com/v2/droplets/3164494?per_page=200").
35
- with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization'=>'Bearer foo', 'Content-Type'=>'application/json', 'User-Agent'=>'Faraday v0.9.2'}).
36
- to_return(:headers => {'Content-Type' => 'application/json'}, :status => 200, :body => fixture("show_droplet_inactive"))
34
+ stub_request(:get, 'https://api.digitalocean.com/v2/droplets/3164494?per_page=200').
35
+ with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.11.0' }).
36
+ to_return(headers: { 'Content-Type' => 'application/json' }, status: 200, body: fixture('show_droplet_inactive'))
37
37
 
38
- stub_request(:post, "https://api.digitalocean.com/v2/droplets/3164494/actions").
39
- with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization'=>'Bearer foo', 'Content-Type'=>'application/json', 'User-Agent'=>'Faraday v0.9.2'}).
40
- to_return(:headers => {'Content-Type' => 'application/json'}, :status => 200, :body => fixture("show_droplet_inactive"))
38
+ stub_request(:post, 'https://api.digitalocean.com/v2/droplets/3164494/actions').
39
+ with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.11.0' }).
40
+ to_return(headers: { 'Content-Type' => 'application/json' }, status: 200, body: fixture('show_droplet_inactive'))
41
41
 
42
-
43
- @cli.options = @cli.options.merge(:id => '3164494')
44
- @cli.start
42
+ cli.options = cli.options.merge(id: '3164494')
43
+ cli.start
45
44
 
46
45
  expect($stdout.string).to eq <<-eos
47
46
  Droplet id provided. Finding Droplet...done\e[0m, 3164494 (example.com)
@@ -49,23 +48,22 @@ Queuing start for 3164494 (example.com)...Start complete!
49
48
  eos
50
49
  end
51
50
 
51
+ it 'starts the droplet with a name' do
52
+ stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=1').
53
+ with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.11.0' }).
54
+ to_return(status: 200, body: fixture('show_droplets'), headers: {})
52
55
 
53
- it "starts the droplet with a name" do
54
- stub_request(:get, "https://api.digitalocean.com/v2/droplets?page=1&per_page=1").
55
- with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization'=>'Bearer foo', 'Content-Type'=>'application/json', 'User-Agent'=>'Faraday v0.9.2'}).
56
- to_return(:status => 200, :body => fixture('show_droplets'), :headers => {})
57
-
58
- stub_request(:get, "https://api.digitalocean.com/v2/droplets?page=1&per_page=200").
59
- with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization'=>'Bearer foo', 'Content-Type'=>'application/json', 'User-Agent'=>'Faraday v0.9.2'}).
60
- to_return(:status => 200, :body => fixture('show_droplets'), :headers => {})
56
+ stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=200').
57
+ with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.11.0' }).
58
+ to_return(status: 200, body: fixture('show_droplets'), headers: {})
61
59
 
62
- stub_request(:post, "https://api.digitalocean.com/v2/droplets/3164444/actions").
63
- with(:body => "{\"type\":\"power_on\"}",
64
- :headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization'=>'Bearer foo', 'Content-Type'=>'application/json', 'User-Agent'=>'Faraday v0.9.2'}).
65
- to_return(:status => 200, :body => fixture('droplet_start_response'), :headers => {})
60
+ stub_request(:post, 'https://api.digitalocean.com/v2/droplets/3164444/actions').
61
+ with(body: '{"type":"power_on"}',
62
+ headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.11.0' }).
63
+ to_return(status: 200, body: fixture('droplet_start_response'), headers: {})
66
64
 
67
- @cli.options = @cli.options.merge(:name => 'example3.com')
68
- @cli.start
65
+ cli.options = cli.options.merge(name: 'example3.com')
66
+ cli.start
69
67
 
70
68
  expect($stdout.string).to eq <<-eos
71
69
  Droplet name provided. Finding droplet ID...done\e[0m, 3164444 (example3.com)
@@ -73,24 +71,22 @@ Queuing start for 3164444 (example3.com)...Start complete!
73
71
  eos
74
72
  end
75
73
 
76
- it "does not start a droplet that is inactive" do
77
- stub_request(:get, "https://api.digitalocean.com/v2/droplets?page=1&per_page=1").
78
- with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization'=>'Bearer foo', 'Content-Type'=>'application/json', 'User-Agent'=>'Faraday v0.9.2'}).
79
- to_return(:status => 200, :body => fixture('show_droplets'), :headers => {})
74
+ it 'does not start a droplet that is inactive' do
75
+ stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=1').
76
+ with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.11.0' }).
77
+ to_return(status: 200, body: fixture('show_droplets'), headers: {})
80
78
 
81
- stub_request(:get, "https://api.digitalocean.com/v2/droplets?page=1&per_page=200").
82
- with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization'=>'Bearer foo', 'Content-Type'=>'application/json', 'User-Agent'=>'Faraday v0.9.2'}).
83
- to_return(:status => 200, :body => fixture('show_droplets'), :headers => {})
79
+ stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=200').
80
+ with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.11.0' }).
81
+ to_return(status: 200, body: fixture('show_droplets'), headers: {})
84
82
 
85
- @cli.options = @cli.options.merge(:name => 'example.com')
86
- expect {@cli.start}.to raise_error(SystemExit)
83
+ cli.options = cli.options.merge(name: 'example.com')
84
+ expect { cli.start }.to raise_error(SystemExit)
87
85
 
88
86
  expect($stdout.string).to eq <<-eos
89
87
  Droplet name provided. Finding droplet ID...done\e[0m, 6918990 (example.com)
90
88
  Droplet must be off for this operation to be successful.
91
89
  eos
92
-
93
-
94
90
  end
95
91
  end
96
92
  end
@@ -1,42 +1,39 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Tugboat::CLI do
4
- include_context "spec"
4
+ include_context 'spec'
5
5
 
6
- describe "verify" do
7
- it "returns confirmation text when verify passes" do
8
- stub_request(:get, "https://api.digitalocean.com/v2/droplets?page=1&per_page=1").
9
- with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization'=>'Bearer foo', 'Content-Type'=>'application/json', 'User-Agent'=>'Faraday v0.9.2'}).
10
- to_return(:status => 200, :body => fixture('show_droplets'), :headers => {})
6
+ describe 'verify' do
7
+ it 'returns confirmation text when verify passes' do
8
+ stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=1').
9
+ with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.11.0' }).
10
+ to_return(status: 200, body: fixture('show_droplets'), headers: {})
11
11
 
12
- @cli.verify
12
+ cli.verify
13
13
  expect($stdout.string).to eq "Authentication with DigitalOcean was successful.\n"
14
- expect(a_request(:get, "https://api.digitalocean.com/v2/droplets?page=1&per_page=1")).to have_been_made
14
+ expect(a_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=1')).to have_been_made
15
15
  end
16
16
 
17
- it "returns error when verify fails" do
18
- stub_request(:get, "https://api.digitalocean.com/v2/droplets?page=1&per_page=1").
19
- with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization'=>'Bearer foo', 'Content-Type'=>'application/json', 'User-Agent'=>'Faraday v0.9.2'}).
20
- to_return(:headers => {'Content-Type' => 'text/html'}, :status => 401, :body => fixture('401'))
17
+ it 'returns error when verify fails' do
18
+ stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=1').
19
+ with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.11.0' }).
20
+ to_return(headers: { 'Content-Type' => 'text/html' }, status: 401, body: fixture('401'))
21
21
 
22
- expect { @cli.verify }.to raise_error(SystemExit)
23
- expect($stdout.string).to include "Failed to connect to DigitalOcean. Reason given from API: unauthorized - Unable to authenticate you."
24
- expect(a_request(:get, "https://api.digitalocean.com/v2/droplets?page=1&per_page=1")).to have_been_made
22
+ expect { cli.verify }.to raise_error(SystemExit)
23
+ expect($stdout.string).to include 'Failed to connect to DigitalOcean. Reason given from API: unauthorized - Unable to authenticate you.'
24
+ expect(a_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=1')).to have_been_made
25
25
  end
26
26
 
27
- it "returns error string when verify fails and a non-json reponse is given" do
28
- stub_request(:get, "https://api.digitalocean.com/v2/droplets?page=1&per_page=1").
29
- with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization'=>'Bearer foo', 'Content-Type'=>'application/json', 'User-Agent'=>'Faraday v0.9.2'}).
30
- to_return(:headers => {'Content-Type' => 'text/html'}, :status => 500, :body => fixture('500','html'))
27
+ it 'returns error string when verify fails and a non-json reponse is given' do
28
+ stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=1').
29
+ with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.11.0' }).
30
+ to_return(headers: { 'Content-Type' => 'text/html' }, status: 500, body: fixture('500', 'html'))
31
31
 
32
- expect { @cli.verify }.to raise_error(SystemExit)
33
- expect($stdout.string).to include "Authentication with DigitalOcean failed at an early stage"
32
+ expect { cli.verify }.to raise_error(SystemExit)
33
+ expect($stdout.string).to include 'Authentication with DigitalOcean failed at an early stage'
34
34
  expect($stdout.string).to include "<title>DigitalOcean - Seems we've encountered a problem!</title>"
35
35
  # TODO: Make it so this doesnt barf up a huge HTML file...
36
- expect(a_request(:get, "https://api.digitalocean.com/v2/droplets?page=1&per_page=1")).to have_been_made
36
+ expect(a_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=1')).to have_been_made
37
37
  end
38
-
39
38
  end
40
-
41
39
  end
42
-
@@ -1,16 +1,14 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Tugboat::CLI do
4
- include_context "spec"
4
+ include_context 'spec'
5
5
 
6
- describe "version" do
7
- it "shows the correct version" do
6
+ describe 'version' do
7
+ it 'shows the correct version' do
8
+ cli.options = cli.options.merge(version: true)
9
+ cli.version
8
10
 
9
- @cli.options = @cli.options.merge(:version => true)
10
- @cli.version
11
-
12
- expect($stdout.string.chomp).to eq("Tugboat #{Tugboat::VERSION.to_s}")
11
+ expect($stdout.string.chomp).to eq("Tugboat #{Tugboat::VERSION}")
13
12
  end
14
13
  end
15
14
  end
16
-
@@ -1,24 +1,24 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Tugboat::CLI do
4
- include_context "spec"
4
+ include_context 'spec'
5
5
 
6
- describe "wait" do
7
- it "waits for a droplet with a fuzzy name" do
8
- stub_request(:get, "https://api.digitalocean.com/v2/droplets?page=1&per_page=1").
9
- with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization'=>'Bearer foo', 'Content-Type'=>'application/json', 'User-Agent'=>'Faraday v0.9.2'}).
10
- to_return(:status => 200, :body => fixture('show_droplets'), :headers => {})
6
+ describe 'wait' do
7
+ it 'waits for a droplet with a fuzzy name' do
8
+ stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=1').
9
+ with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.11.0' }).
10
+ to_return(status: 200, body: fixture('show_droplets'), headers: {})
11
11
 
12
- stub_request(:get, "https://api.digitalocean.com/v2/droplets?page=1&per_page=200").
13
- with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization'=>'Bearer foo', 'Content-Type'=>'application/json', 'User-Agent'=>'Faraday v0.9.2'}).
14
- to_return(:status => 200, :body => fixture('show_droplets'), :headers => {})
12
+ stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=200').
13
+ with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.11.0' }).
14
+ to_return(status: 200, body: fixture('show_droplets'), headers: {})
15
15
 
16
- stub_request(:get, "https://api.digitalocean.com/v2/droplets/6918990?per_page=200").
17
- with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization'=>'Bearer foo', 'Content-Type'=>'application/json', 'User-Agent'=>'Faraday v0.9.2'}).
18
- to_return(:status => 200, :body => fixture('show_droplet'), :headers => {})
16
+ stub_request(:get, 'https://api.digitalocean.com/v2/droplets/6918990?per_page=200').
17
+ with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.11.0' }).
18
+ to_return(status: 200, body: fixture('show_droplet'), headers: {})
19
19
 
20
- @cli.options = @cli.options.merge(:state => "active")
21
- @cli.wait("example.com")
20
+ cli.options = cli.options.merge(state: 'active')
21
+ cli.wait('example.com')
22
22
 
23
23
  expect($stdout.string).to eq <<-eos
24
24
  Droplet fuzzy name provided. Finding droplet ID...done\e[0m, 6918990 (example.com)
@@ -26,24 +26,24 @@ Waiting for droplet to become active..done\e[0m (0s)
26
26
  eos
27
27
  end
28
28
 
29
- it "loops whilst it waits for state" do
30
- stub_request(:get, "https://api.digitalocean.com/v2/droplets?page=1&per_page=1").
31
- with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization'=>'Bearer foo', 'Content-Type'=>'application/json', 'User-Agent'=>'Faraday v0.9.2'}).
32
- to_return(:status => 200, :body => fixture('show_droplets'), :headers => {})
29
+ it 'loops whilst it waits for state' do
30
+ stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=1').
31
+ with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.11.0' }).
32
+ to_return(status: 200, body: fixture('show_droplets'), headers: {})
33
33
 
34
- stub_request(:get, "https://api.digitalocean.com/v2/droplets?page=1&per_page=200").
35
- with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization'=>'Bearer foo', 'Content-Type'=>'application/json', 'User-Agent'=>'Faraday v0.9.2'}).
36
- to_return(:status => 200, :body => fixture('show_droplets'), :headers => {})
34
+ stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=200').
35
+ with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.11.0' }).
36
+ to_return(status: 200, body: fixture('show_droplets'), headers: {})
37
37
 
38
- stub_request(:get, "https://api.digitalocean.com/v2/droplets/6918990?per_page=200").
39
- with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization'=>'Bearer foo', 'Content-Type'=>'application/json', 'User-Agent'=>'Faraday v0.9.2'}).
40
- to_return(
41
- {:status => 200, :body => fixture('show_droplet_inactive'), :headers => {}},
42
- {:status => 200, :body => fixture('show_droplet'), :headers => {}}
43
- )
38
+ stub_request(:get, 'https://api.digitalocean.com/v2/droplets/6918990?per_page=200').
39
+ with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.11.0' }).
40
+ to_return(
41
+ { status: 200, body: fixture('show_droplet_inactive'), headers: {} },
42
+ status: 200, body: fixture('show_droplet'), headers: {}
43
+ )
44
44
 
45
- @cli.options = @cli.options.merge(:state => "active")
46
- @cli.wait("example.com")
45
+ cli.options = cli.options.merge(state: 'active')
46
+ cli.wait('example.com')
47
47
 
48
48
  expect($stdout.string).to eq <<-eos
49
49
  Droplet fuzzy name provided. Finding droplet ID...done\e[0m, 6918990 (example.com)
@@ -51,17 +51,17 @@ Waiting for droplet to become active...done\e[0m (2s)
51
51
  eos
52
52
  end
53
53
 
54
- it "waits for a droplet with an id" do
55
- stub_request(:get, "https://api.digitalocean.com/v2/droplets?page=1&per_page=1").
56
- with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization'=>'Bearer foo', 'Content-Type'=>'application/json', 'User-Agent'=>'Faraday v0.9.2'}).
57
- to_return(:status => 200, :body => fixture('show_droplets'), :headers => {})
54
+ it 'waits for a droplet with an id' do
55
+ stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=1').
56
+ with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.11.0' }).
57
+ to_return(status: 200, body: fixture('show_droplets'), headers: {})
58
58
 
59
- stub_request(:get, "https://api.digitalocean.com/v2/droplets/6918990?per_page=200").
60
- with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization'=>'Bearer foo', 'Content-Type'=>'application/json', 'User-Agent'=>'Faraday v0.9.2'}).
61
- to_return(:status => 200, :body => fixture('show_droplet'), :headers => {})
59
+ stub_request(:get, 'https://api.digitalocean.com/v2/droplets/6918990?per_page=200').
60
+ with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.11.0' }).
61
+ to_return(status: 200, body: fixture('show_droplet'), headers: {})
62
62
 
63
- @cli.options = @cli.options.merge(:id => '6918990', :state => "active")
64
- @cli.wait
63
+ cli.options = cli.options.merge(id: '6918990', state: 'active')
64
+ cli.wait
65
65
 
66
66
  expect($stdout.string).to eq <<-eos
67
67
  Droplet id provided. Finding Droplet...done\e[0m, 6918990 (example.com)
@@ -69,28 +69,26 @@ Waiting for droplet to become active..done\e[0m (0s)
69
69
  eos
70
70
  end
71
71
 
72
- it "waits for a droplet with a name" do
73
- stub_request(:get, "https://api.digitalocean.com/v2/droplets?page=1&per_page=1").
74
- with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization'=>'Bearer foo', 'Content-Type'=>'application/json', 'User-Agent'=>'Faraday v0.9.2'}).
75
- to_return(:status => 200, :body => fixture('show_droplets'), :headers => {})
72
+ it 'waits for a droplet with a name' do
73
+ stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=1').
74
+ with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.11.0' }).
75
+ to_return(status: 200, body: fixture('show_droplets'), headers: {})
76
76
 
77
- stub_request(:get, "https://api.digitalocean.com/v2/droplets?page=1&per_page=200").
78
- with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization'=>'Bearer foo', 'Content-Type'=>'application/json', 'User-Agent'=>'Faraday v0.9.2'}).
79
- to_return(:status => 200, :body => fixture('show_droplets'), :headers => {})
77
+ stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=200').
78
+ with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.11.0' }).
79
+ to_return(status: 200, body: fixture('show_droplets'), headers: {})
80
80
 
81
- stub_request(:get, "https://api.digitalocean.com/v2/droplets/6918990?per_page=200").
82
- with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization'=>'Bearer foo', 'Content-Type'=>'application/json', 'User-Agent'=>'Faraday v0.9.2'}).
83
- to_return(:status => 200, :body => fixture('show_droplet'), :headers => {})
81
+ stub_request(:get, 'https://api.digitalocean.com/v2/droplets/6918990?per_page=200').
82
+ with(headers: { 'Accept' => '*/*', 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Authorization' => 'Bearer foo', 'Content-Type' => 'application/json', 'User-Agent' => 'Faraday v0.11.0' }).
83
+ to_return(status: 200, body: fixture('show_droplet'), headers: {})
84
84
 
85
- @cli.options = @cli.options.merge(:name => 'example.com', :state => "active")
86
- @cli.wait
85
+ cli.options = cli.options.merge(name: 'example.com', state: 'active')
86
+ cli.wait
87
87
 
88
88
  expect($stdout.string).to eq <<-eos
89
89
  Droplet name provided. Finding droplet ID...done\e[0m, 6918990 (example.com)
90
90
  Waiting for droplet to become active..done\e[0m (0s)
91
91
  eos
92
92
  end
93
-
94
93
  end
95
-
96
94
  end