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,19 +1,19 @@
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 "images" do
7
- it "shows all images by default" do
8
- stub_request(:get, "https://api.digitalocean.com/v2/images?per_page=200").
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_images'), :headers => {})
6
+ describe 'images' do
7
+ it 'shows all images by default' do
8
+ stub_request(:get, 'https://api.digitalocean.com/v2/images?per_page=200').
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_images'), headers: {})
11
11
 
12
- stub_request(:get, "https://api.digitalocean.com/v2/images?per_page=200&private=true").
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_images_global'), :headers => {})
12
+ stub_request(:get, 'https://api.digitalocean.com/v2/images?per_page=200&private=true').
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_images_global'), headers: {})
15
15
 
16
- @cli.images
16
+ cli.images
17
17
 
18
18
  expect($stdout.string).to eq <<-eos
19
19
  Showing both private and public images
@@ -73,17 +73,17 @@ Redmine on 14.04 (slug: redmine, id: 12438838, distro: Ubuntu)
73
73
  eos
74
74
  end
75
75
 
76
- it "acknowledges when personal images are empty when showing default full list" do
77
- stub_request(:get, "https://api.digitalocean.com/v2/images?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_images'), :headers => {})
76
+ it 'acknowledges when personal images are empty when showing default full list' do
77
+ stub_request(:get, 'https://api.digitalocean.com/v2/images?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_images'), headers: {})
80
80
 
81
- stub_request(:get, "https://api.digitalocean.com/v2/images?per_page=200&private=true").
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_images_empty'), :headers => {})
81
+ stub_request(:get, 'https://api.digitalocean.com/v2/images?per_page=200&private=true').
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_images_empty'), headers: {})
84
84
 
85
- @cli.options = @cli.options.merge(:show_private_images => true)
86
- @cli.images
85
+ cli.options = cli.options.merge(show_private_images: true)
86
+ cli.images
87
87
 
88
88
  expect($stdout.string).to eq <<-eos
89
89
  Showing both private and public images
@@ -143,17 +143,17 @@ Redmine on 14.04 (slug: redmine, id: 12438838, distro: Ubuntu)
143
143
  eos
144
144
  end
145
145
 
146
- it "acknowledges when personal images are empty when just show private images flag given" do
147
- stub_request(:get, "https://api.digitalocean.com/v2/images?per_page=200").
148
- 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'}).
149
- to_return(:status => 200, :body => fixture('show_images'), :headers => {})
146
+ it 'acknowledges when personal images are empty when just show private images flag given' do
147
+ stub_request(:get, 'https://api.digitalocean.com/v2/images?per_page=200').
148
+ 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' }).
149
+ to_return(status: 200, body: fixture('show_images'), headers: {})
150
150
 
151
- stub_request(:get, "https://api.digitalocean.com/v2/images?per_page=200&private=true").
152
- 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'}).
153
- to_return(:status => 200, :body => fixture('show_images_empty'), :headers => {})
151
+ stub_request(:get, 'https://api.digitalocean.com/v2/images?per_page=200&private=true').
152
+ 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' }).
153
+ to_return(status: 200, body: fixture('show_images_empty'), headers: {})
154
154
 
155
- @cli.options = @cli.options.merge(:show_just_private_images => true)
156
- @cli.images
155
+ cli.options = cli.options.merge(show_just_private_images: true)
156
+ cli.images
157
157
 
158
158
  expect($stdout.string).to eq <<-eos
159
159
  Showing just private images
@@ -162,6 +162,4 @@ No private images found
162
162
  eos
163
163
  end
164
164
  end
165
-
166
165
  end
167
-
@@ -1,43 +1,43 @@
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 "info" do
7
- it "shows an error if response is not successful" 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 'info' do
7
+ it 'shows an error if response is not successful' 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/6918990?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 => 404, :body => fixture('not_found'), :headers => {})
12
+ stub_request(:get, 'https://api.digitalocean.com/v2/droplets/6918990?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: 404, body: fixture('not_found'), headers: {})
15
15
 
16
- @cli.options = @cli.options.merge(:id => 6918990)
16
+ cli.options = cli.options.merge(id: 6_918_990)
17
17
 
18
- expect {@cli.info}.to raise_error(SystemExit)
18
+ expect { cli.info }.to raise_error(SystemExit)
19
19
 
20
20
  expect($stdout.string).to eq <<-eos
21
21
  Droplet id provided. Finding Droplet...Failed to find Droplet: The resource you were accessing could not be found.
22
22
  eos
23
23
 
24
- expect(a_request(:get, "https://api.digitalocean.com/v2/droplets/6918990?per_page=200")).to have_been_made
24
+ expect(a_request(:get, 'https://api.digitalocean.com/v2/droplets/6918990?per_page=200')).to have_been_made
25
25
  end
26
26
 
27
- it "shows a droplet with a fuzzy name" 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(:status => 200, :body => fixture('show_droplets'), :headers => {})
27
+ it 'shows a droplet with a fuzzy name' 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(status: 200, body: fixture('show_droplets'), headers: {})
31
31
 
32
- stub_request(:get, "https://api.digitalocean.com/v2/droplets?page=1&per_page=200").
33
- 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'}).
34
- to_return(:status => 200, :body => fixture('show_droplets'), :headers => {})
32
+ stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=200').
33
+ 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' }).
34
+ to_return(status: 200, body: fixture('show_droplets'), headers: {})
35
35
 
36
- stub_request(:get, "https://api.digitalocean.com/v2/droplets/6918990?per_page=200").
37
- 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'}).
38
- to_return(:status => 200, :body => fixture('show_droplet'), :headers => {})
36
+ stub_request(:get, 'https://api.digitalocean.com/v2/droplets/6918990?per_page=200').
37
+ 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' }).
38
+ to_return(status: 200, body: fixture('show_droplet'), headers: {})
39
39
 
40
- @cli.info("example.com")
40
+ cli.info('example.com')
41
41
 
42
42
  expect($stdout.string).to eq <<-eos
43
43
  Droplet fuzzy name provided. Finding droplet ID...done\e[0m, 6918990 (example.com)
@@ -52,20 +52,19 @@ Image: 6918990 - ubuntu-14-04-x64
52
52
  Size: 512MB
53
53
  Backups Active: false
54
54
  eos
55
-
56
55
  end
57
56
 
58
- it "shows a droplet made from a user image" do
59
- stub_request(:get, "https://api.digitalocean.com/v2/droplets?page=1&per_page=1").
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_droplets'), :headers => {})
57
+ it 'shows a droplet made from a user image' do
58
+ stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=1').
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.11.0' }).
60
+ to_return(status: 200, body: fixture('show_droplets'), headers: {})
62
61
 
63
- stub_request(:get, "https://api.digitalocean.com/v2/droplets/6918990?per_page=200").
64
- 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'}).
65
- to_return(:status => 200, :body => fixture('show_droplet_user_image'), :headers => {})
62
+ stub_request(:get, 'https://api.digitalocean.com/v2/droplets/6918990?per_page=200').
63
+ 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' }).
64
+ to_return(status: 200, body: fixture('show_droplet_user_image'), headers: {})
66
65
 
67
- @cli.options = @cli.options.merge(:id => 6918990)
68
- @cli.info
66
+ cli.options = cli.options.merge(id: 6_918_990)
67
+ cli.info
69
68
 
70
69
  expect($stdout.string).to eq <<-eos
71
70
  Droplet id provided. Finding Droplet...done\e[0m, 6918990 (example.com)
@@ -82,17 +81,17 @@ Backups Active: false
82
81
  eos
83
82
  end
84
83
 
85
- it "shows a droplet with an id" do
86
- stub_request(:get, "https://api.digitalocean.com/v2/droplets?page=1&per_page=1").
87
- 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'}).
88
- to_return(:status => 200, :body => fixture('show_droplets'), :headers => {})
84
+ it 'shows a droplet with an id' do
85
+ stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=1').
86
+ 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' }).
87
+ to_return(status: 200, body: fixture('show_droplets'), headers: {})
89
88
 
90
- stub_request(:get, "https://api.digitalocean.com/v2/droplets/6918990?per_page=200").
91
- 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'}).
92
- to_return(:status => 200, :body => fixture('show_droplet'), :headers => {})
89
+ stub_request(:get, 'https://api.digitalocean.com/v2/droplets/6918990?per_page=200').
90
+ 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' }).
91
+ to_return(status: 200, body: fixture('show_droplet'), headers: {})
93
92
 
94
- @cli.options = @cli.options.merge(:id => 6918990)
95
- @cli.info
93
+ cli.options = cli.options.merge(id: 6_918_990)
94
+ cli.info
96
95
 
97
96
  expect($stdout.string).to eq <<-eos
98
97
  Droplet id provided. Finding Droplet...done\e[0m, 6918990 (example.com)
@@ -109,21 +108,21 @@ Backups Active: false
109
108
  eos
110
109
  end
111
110
 
112
- it "shows a droplet with a name" do
113
- stub_request(:get, "https://api.digitalocean.com/v2/droplets?page=1&per_page=1").
114
- 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'}).
115
- to_return(:status => 200, :body => fixture('show_droplets'), :headers => {})
111
+ it 'shows a droplet with a name' do
112
+ stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=1').
113
+ 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' }).
114
+ to_return(status: 200, body: fixture('show_droplets'), headers: {})
116
115
 
117
- stub_request(:get, "https://api.digitalocean.com/v2/droplets?page=1&per_page=200").
118
- 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'}).
119
- to_return(:status => 200, :body => fixture('show_droplets'), :headers => {})
116
+ stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=200').
117
+ 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' }).
118
+ to_return(status: 200, body: fixture('show_droplets'), headers: {})
120
119
 
121
- stub_request(:get, "https://api.digitalocean.com/v2/droplets/6918990?per_page=200").
122
- 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'}).
123
- to_return(:status => 200, :body => fixture('show_droplet'), :headers => {})
120
+ stub_request(:get, 'https://api.digitalocean.com/v2/droplets/6918990?per_page=200').
121
+ 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' }).
122
+ to_return(status: 200, body: fixture('show_droplet'), headers: {})
124
123
 
125
- @cli.options = @cli.options.merge(:name => "example.com")
126
- @cli.info
124
+ cli.options = cli.options.merge(name: 'example.com')
125
+ cli.info
127
126
 
128
127
  expect($stdout.string).to eq <<-eos
129
128
  Droplet name provided. Finding droplet ID...done\e[0m, 6918990 (example.com)
@@ -140,22 +139,22 @@ Backups Active: false
140
139
  eos
141
140
  end
142
141
 
143
- it "allows choice of multiple droplets" do
144
- stub_request(:get, "https://api.digitalocean.com/v2/droplets?page=1&per_page=1").
145
- 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'}).
146
- to_return(:status => 200, :body => fixture('show_droplets'), :headers => {})
142
+ it 'allows choice of multiple droplets' do
143
+ stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=1').
144
+ 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' }).
145
+ to_return(status: 200, body: fixture('show_droplets'), headers: {})
147
146
 
148
- stub_request(:get, "https://api.digitalocean.com/v2/droplets?page=1&per_page=200").
149
- 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'}).
150
- to_return(:status => 200, :body => fixture('show_droplets'), :headers => {})
147
+ stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=200').
148
+ 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' }).
149
+ to_return(status: 200, body: fixture('show_droplets'), headers: {})
151
150
 
152
- stub_request(:get, "https://api.digitalocean.com/v2/droplets/6918990?per_page=200").
153
- 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'}).
154
- to_return(:status => 200, :body => fixture('show_droplet'), :headers => {})
151
+ stub_request(:get, 'https://api.digitalocean.com/v2/droplets/6918990?per_page=200').
152
+ 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' }).
153
+ to_return(status: 200, body: fixture('show_droplet'), headers: {})
155
154
 
156
155
  $stdin.should_receive(:gets).and_return('0')
157
156
 
158
- @cli.info("examp")
157
+ cli.info('examp')
159
158
 
160
159
  expect($stdout.string).to eq <<-eos
161
160
  Droplet fuzzy name provided. Finding droplet ID...Multiple droplets found.
@@ -176,22 +175,21 @@ Size: 512MB
176
175
  Backups Active: false
177
176
  eos
178
177
  end
179
-
180
178
  end
181
179
 
182
- it "shows a droplet with an id under porcelain mode" do
183
- stub_request(:get, "https://api.digitalocean.com/v2/droplets?page=1&per_page=1").
184
- 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'}).
185
- to_return(:status => 200, :body => fixture('show_droplets'), :headers => {})
180
+ it 'shows a droplet with an id under porcelain mode' do
181
+ stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=1').
182
+ 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' }).
183
+ to_return(status: 200, body: fixture('show_droplets'), headers: {})
186
184
 
187
- stub_request(:get, "https://api.digitalocean.com/v2/droplets/6918990?per_page=200").
188
- 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'}).
189
- to_return(:status => 200, :body => fixture('show_droplet'), :headers => {})
185
+ stub_request(:get, 'https://api.digitalocean.com/v2/droplets/6918990?per_page=200').
186
+ 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' }).
187
+ to_return(status: 200, body: fixture('show_droplet'), headers: {})
190
188
 
191
- @cli.options = @cli.options.merge(:id => '6918990', :porcelain => true)
192
- @cli.info
189
+ cli.options = cli.options.merge(id: '6918990', porcelain: true)
190
+ cli.info
193
191
 
194
- expect($stdout.string).to eq <<-eos
192
+ expect($stdout.string).to eq <<-eos
195
193
  name example.com
196
194
  id 6918990
197
195
  status active
@@ -202,25 +200,25 @@ image 6918990
202
200
  size 512mb
203
201
  backups_active false
204
202
  eos
205
- end
203
+ end
206
204
 
207
- it "shows a droplet with a name under porcelain mode" do
208
- stub_request(:get, "https://api.digitalocean.com/v2/droplets?page=1&per_page=1").
209
- 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'}).
210
- to_return(:status => 200, :body => fixture('show_droplets'), :headers => {})
205
+ it 'shows a droplet with a name under porcelain mode' do
206
+ stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=1').
207
+ 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' }).
208
+ to_return(status: 200, body: fixture('show_droplets'), headers: {})
211
209
 
212
- stub_request(:get, "https://api.digitalocean.com/v2/droplets?page=1&per_page=200").
213
- 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'}).
214
- to_return(:status => 200, :body => fixture('show_droplets'), :headers => {})
210
+ stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=200').
211
+ 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' }).
212
+ to_return(status: 200, body: fixture('show_droplets'), headers: {})
215
213
 
216
- stub_request(:get, "https://api.digitalocean.com/v2/droplets/6918990?per_page=200").
217
- 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'}).
218
- to_return(:status => 200, :body => fixture('show_droplet'), :headers => {})
214
+ stub_request(:get, 'https://api.digitalocean.com/v2/droplets/6918990?per_page=200').
215
+ 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' }).
216
+ to_return(status: 200, body: fixture('show_droplet'), headers: {})
219
217
 
220
- @cli.options = @cli.options.merge(:name => 'example.com', :porcelain => true)
221
- @cli.info
218
+ cli.options = cli.options.merge(name: 'example.com', porcelain: true)
219
+ cli.info
222
220
 
223
- expect($stdout.string).to eq <<-eos
221
+ expect($stdout.string).to eq <<-eos
224
222
  name example.com
225
223
  id 6918990
226
224
  status active
@@ -231,19 +229,19 @@ image 6918990
231
229
  size 512mb
232
230
  backups_active false
233
231
  eos
234
- end
232
+ end
235
233
 
236
- it "shows a droplet attribute with an id" do
237
- stub_request(:get, "https://api.digitalocean.com/v2/droplets?page=1&per_page=1").
238
- 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'}).
239
- to_return(:status => 200, :body => fixture('show_droplets'), :headers => {})
234
+ it 'shows a droplet attribute with an id' do
235
+ stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=1').
236
+ 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' }).
237
+ to_return(status: 200, body: fixture('show_droplets'), headers: {})
240
238
 
241
- stub_request(:get, "https://api.digitalocean.com/v2/droplets/6918990?per_page=200").
242
- 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'}).
243
- to_return(:status => 200, :body => fixture('show_droplet'), :headers => {})
239
+ stub_request(:get, 'https://api.digitalocean.com/v2/droplets/6918990?per_page=200').
240
+ 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' }).
241
+ to_return(status: 200, body: fixture('show_droplet'), headers: {})
244
242
 
245
- @cli.options = @cli.options.merge(:id => '6918990', :attribute => "ip4")
246
- @cli.info
243
+ cli.options = cli.options.merge(id: '6918990', attribute: 'ip4')
244
+ cli.info
247
245
 
248
246
  expect($stdout.string).to eq <<-eos
249
247
  Droplet id provided. Finding Droplet...done\e[0m, 6918990 (example.com)
@@ -251,21 +249,21 @@ Droplet id provided. Finding Droplet...done\e[0m, 6918990 (example.com)
251
249
  eos
252
250
  end
253
251
 
254
- it "shows a droplet attribute with a name" do
255
- stub_request(:get, "https://api.digitalocean.com/v2/droplets?page=1&per_page=1").
256
- 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'}).
257
- to_return(:status => 200, :body => fixture('show_droplets'), :headers => {})
252
+ it 'shows a droplet attribute with a name' do
253
+ stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=1').
254
+ 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' }).
255
+ to_return(status: 200, body: fixture('show_droplets'), headers: {})
258
256
 
259
- stub_request(:get, "https://api.digitalocean.com/v2/droplets?page=1&per_page=200").
260
- 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'}).
261
- to_return(:status => 200, :body => fixture('show_droplets'), :headers => {})
257
+ stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=200').
258
+ 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' }).
259
+ to_return(status: 200, body: fixture('show_droplets'), headers: {})
262
260
 
263
- stub_request(:get, "https://api.digitalocean.com/v2/droplets/6918990?per_page=200").
264
- 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'}).
265
- to_return(:status => 200, :body => fixture('show_droplet'), :headers => {})
261
+ stub_request(:get, 'https://api.digitalocean.com/v2/droplets/6918990?per_page=200').
262
+ 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' }).
263
+ to_return(status: 200, body: fixture('show_droplet'), headers: {})
266
264
 
267
- @cli.options = @cli.options.merge(:name => 'example.com', :attribute => "ip4")
268
- @cli.info
265
+ cli.options = cli.options.merge(name: 'example.com', attribute: 'ip4')
266
+ cli.info
269
267
 
270
268
  expect($stdout.string).to eq <<-eos
271
269
  Droplet name provided. Finding droplet ID...done\e[0m, 6918990 (example.com)
@@ -273,19 +271,19 @@ Droplet name provided. Finding droplet ID...done\e[0m, 6918990 (example.com)
273
271
  eos
274
272
  end
275
273
 
276
- it "gives error if invalid attribute given" do
277
- stub_request(:get, "https://api.digitalocean.com/v2/droplets?page=1&per_page=1").
278
- 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'}).
279
- to_return(:status => 200, :body => fixture('show_droplets'), :headers => {})
274
+ it 'gives error if invalid attribute given' do
275
+ stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=1').
276
+ 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' }).
277
+ to_return(status: 200, body: fixture('show_droplets'), headers: {})
280
278
 
281
- stub_request(:get, "https://api.digitalocean.com/v2/droplets/6918990?per_page=200").
282
- 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'}).
283
- to_return(:status => 200, :body => fixture('show_droplet'), :headers => {})
279
+ stub_request(:get, 'https://api.digitalocean.com/v2/droplets/6918990?per_page=200').
280
+ 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' }).
281
+ to_return(status: 200, body: fixture('show_droplet'), headers: {})
284
282
 
285
- @cli.options = @cli.options.merge(:id => 6918990, :porcelain => true, :attribute => "foo")
286
- expect {@cli.info}.to raise_error(SystemExit)
283
+ cli.options = cli.options.merge(id: 6_918_990, porcelain: true, attribute: 'foo')
284
+ expect { cli.info }.to raise_error(SystemExit)
287
285
 
288
- expect($stdout.string).to eq <<-eos
286
+ expect($stdout.string).to eq <<-eos
289
287
  Invalid attribute "foo"
290
288
  Provide one of the following:
291
289
  name
@@ -299,40 +297,39 @@ Provide one of the following:
299
297
  size
300
298
  backups_active
301
299
  eos
302
- end
300
+ end
303
301
 
304
- it "shows a droplet attribute with an id under porcelain mode" do
305
- stub_request(:get, "https://api.digitalocean.com/v2/droplets/6918990?per_page=200").
306
- 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'}).
307
- to_return(:status => 200, :body => fixture('show_droplet'), :headers => {})
302
+ it 'shows a droplet attribute with an id under porcelain mode' do
303
+ stub_request(:get, 'https://api.digitalocean.com/v2/droplets/6918990?per_page=200').
304
+ 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' }).
305
+ to_return(status: 200, body: fixture('show_droplet'), headers: {})
308
306
 
309
- @cli.options = @cli.options.merge(:id => '6918990', :porcelain => true, :attribute => "ip4")
310
- @cli.info
307
+ cli.options = cli.options.merge(id: '6918990', porcelain: true, attribute: 'ip4')
308
+ cli.info
311
309
 
312
- expect($stdout.string).to eq <<-eos
310
+ expect($stdout.string).to eq <<-eos
313
311
  104.131.186.241
314
312
  eos
315
- end
313
+ end
316
314
 
317
- it "shows a droplet attribute with a name under porcelain mode" do
318
- stub_request(:get, "https://api.digitalocean.com/v2/droplets?page=1&per_page=1").
319
- 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'}).
320
- to_return(:status => 200, :body => fixture('show_droplets'), :headers => {})
315
+ it 'shows a droplet attribute with a name under porcelain mode' do
316
+ stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=1').
317
+ 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' }).
318
+ to_return(status: 200, body: fixture('show_droplets'), headers: {})
321
319
 
322
- stub_request(:get, "https://api.digitalocean.com/v2/droplets?page=1&per_page=200").
323
- 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'}).
324
- to_return(:status => 200, :body => fixture('show_droplets'), :headers => {})
320
+ stub_request(:get, 'https://api.digitalocean.com/v2/droplets?page=1&per_page=200').
321
+ 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' }).
322
+ to_return(status: 200, body: fixture('show_droplets'), headers: {})
325
323
 
326
- stub_request(:get, "https://api.digitalocean.com/v2/droplets/6918990?per_page=200").
327
- 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'}).
328
- to_return(:status => 200, :body => fixture('show_droplet'), :headers => {})
324
+ stub_request(:get, 'https://api.digitalocean.com/v2/droplets/6918990?per_page=200').
325
+ 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' }).
326
+ to_return(status: 200, body: fixture('show_droplet'), headers: {})
329
327
 
330
- @cli.options = @cli.options.merge(:name => 'example.com', :porcelain => true, :attribute => "ip4")
331
- @cli.info
328
+ cli.options = cli.options.merge(name: 'example.com', porcelain: true, attribute: 'ip4')
329
+ cli.info
332
330
 
333
- expect($stdout.string).to eq <<-eos
331
+ expect($stdout.string).to eq <<-eos
334
332
  104.131.186.241
335
- eos
336
- end
337
-
333
+ eos
334
+ end
338
335
  end