pvdgm-svc-client 0.3.3 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 5bc6e47c121f6b041701b43fa71008552d64f603
4
- data.tar.gz: 527fdbe1c3da482624f3ce8b1f9baef104204589
2
+ SHA256:
3
+ metadata.gz: 811ab6d04fdde553b8a47f7fe783c4cf39605180b44efda852d07023c05680a3
4
+ data.tar.gz: d7da541e5285ff635622f606e122f9eb687785936f990d9cf12a4c606e3b15b9
5
5
  SHA512:
6
- metadata.gz: 4da37b832dd0282ad0978fff755ceef9340487eaa7c355433c048b652ce857473c129e75835c230fa21f25e869fd6b0750a4541180d1b1ad724993895f25ecb5
7
- data.tar.gz: f8a80615429313c512632c5dded208be4f32fd5cd7286c95a8f50f5dfaa2ebc930cf53302a005d0fb0260d49011ebd1e285a0972f603ac602dd888357fc3e7c5
6
+ metadata.gz: 4c07c60e677c88c63fe88b3d50160c65f15b6c2e81d01354601dde3356cd2b33bfe8099b16547a00bf5307f3404ac915add4c7ca279494d1c4a91f9b28122eed
7
+ data.tar.gz: 00a82c698446aa44e68797b7f2d599d148f5e0e0f53debd6d172d71bf067f8322759660c5ab241d87a62841a02ebb5646b6c0664cf1aa73da27252a5bc180cc4
data/Gemfile CHANGED
@@ -3,7 +3,7 @@ source "http://rubygems.org"
3
3
  # Example:
4
4
  # gem "activesupport", ">= 2.3.5"
5
5
  gem "activesupport", ">= 4.2.7", :require => 'active_support'
6
- gem "rest-client", '~> 1.8.0'
6
+ gem "rest-client", '~> 2.0'
7
7
  gem 'terminal-table'
8
8
  gem 'highline'
9
9
 
@@ -14,4 +14,5 @@ group :development do
14
14
  gem "rdoc"
15
15
  gem "bundler"
16
16
  gem "jeweler"
17
+ gem "pry"
17
18
  end
@@ -9,11 +9,12 @@ GEM
9
9
  addressable (2.5.0)
10
10
  public_suffix (~> 2.0, >= 2.0.2)
11
11
  builder (3.2.3)
12
+ coderay (1.1.2)
12
13
  concurrent-ruby (1.0.4)
13
14
  descendants_tracker (0.0.4)
14
15
  thread_safe (~> 0.3, >= 0.3.1)
15
16
  diff-lcs (1.3)
16
- domain_name (0.5.20161129)
17
+ domain_name (0.5.20180417)
17
18
  unf (>= 0.0.5, < 1.0.0)
18
19
  faraday (0.9.2)
19
20
  multipart-post (>= 1.2, < 3)
@@ -43,7 +44,10 @@ GEM
43
44
  rdoc
44
45
  semver2
45
46
  jwt (1.5.6)
46
- mime-types (2.99.3)
47
+ method_source (0.9.2)
48
+ mime-types (3.2.2)
49
+ mime-types-data (~> 3.2015)
50
+ mime-types-data (3.2018.0812)
47
51
  mini_portile2 (2.1.0)
48
52
  minitest (5.10.1)
49
53
  multi_json (1.12.1)
@@ -58,15 +62,18 @@ GEM
58
62
  multi_json (~> 1.3)
59
63
  multi_xml (~> 0.5)
60
64
  rack (>= 1.2, < 3)
65
+ pry (0.12.2)
66
+ coderay (~> 1.1.0)
67
+ method_source (~> 0.9.0)
61
68
  psych (2.2.2)
62
69
  public_suffix (2.0.5)
63
70
  rack (2.0.1)
64
71
  rake (12.0.0)
65
72
  rdoc (5.0.0)
66
- rest-client (1.8.0)
73
+ rest-client (2.0.2)
67
74
  http-cookie (>= 1.0.2, < 2.0)
68
- mime-types (>= 1.16, < 3.0)
69
- netrc (~> 0.7)
75
+ mime-types (>= 1.16, < 4.0)
76
+ netrc (~> 0.8)
70
77
  rspec (3.5.0)
71
78
  rspec-core (~> 3.5.0)
72
79
  rspec-expectations (~> 3.5.0)
@@ -88,7 +95,7 @@ GEM
88
95
  thread_safe (~> 0.1)
89
96
  unf (0.1.4)
90
97
  unf_ext
91
- unf_ext (0.0.7.2)
98
+ unf_ext (0.0.7.5)
92
99
  unicode-display_width (1.1.3)
93
100
 
94
101
  PLATFORMS
@@ -99,10 +106,11 @@ DEPENDENCIES
99
106
  bundler
100
107
  highline
101
108
  jeweler
109
+ pry
102
110
  rdoc
103
- rest-client (~> 1.8.0)
111
+ rest-client (~> 2.0)
104
112
  rspec (>= 3.5)
105
113
  terminal-table
106
114
 
107
115
  BUNDLED WITH
108
- 1.14.2
116
+ 1.17.3
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.3
1
+ 0.3.4
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: pvdgm-svc-client 0.3.3 ruby lib
5
+ # stub: pvdgm-svc-client 0.3.4 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "pvdgm-svc-client".freeze
9
- s.version = "0.3.3"
9
+ s.version = "0.3.4"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib".freeze]
13
13
  s.authors = ["Dave Sieh".freeze]
14
- s.date = "2017-05-22"
14
+ s.date = "2019-03-20"
15
15
  s.description = "This gem provides command line and other types of tools to support the Service Engine.".freeze
16
16
  s.email = "dave.sieh@providigm.com".freeze
17
17
  s.executables = ["service_mgr".freeze, "service_mgr_completion".freeze, "valid_commands".freeze, "valid_resources".freeze]
@@ -68,7 +68,7 @@ Gem::Specification.new do |s|
68
68
  ]
69
69
  s.homepage = "http://github.com/GitHubAdmin/pvdgm-svc-client".freeze
70
70
  s.licenses = ["MIT".freeze]
71
- s.rubygems_version = "2.5.2".freeze
71
+ s.rubygems_version = "2.7.6.2".freeze
72
72
  s.summary = "Command-line client tools to support the Service Engine".freeze
73
73
 
74
74
  if s.respond_to? :specification_version then
@@ -76,32 +76,35 @@ Gem::Specification.new do |s|
76
76
 
77
77
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
78
78
  s.add_runtime_dependency(%q<activesupport>.freeze, [">= 4.2.7"])
79
- s.add_runtime_dependency(%q<rest-client>.freeze, ["~> 1.8.0"])
79
+ s.add_runtime_dependency(%q<rest-client>.freeze, ["~> 2.0"])
80
80
  s.add_runtime_dependency(%q<terminal-table>.freeze, [">= 0"])
81
81
  s.add_runtime_dependency(%q<highline>.freeze, [">= 0"])
82
82
  s.add_development_dependency(%q<rspec>.freeze, [">= 3.5"])
83
83
  s.add_development_dependency(%q<rdoc>.freeze, [">= 0"])
84
84
  s.add_development_dependency(%q<bundler>.freeze, [">= 0"])
85
85
  s.add_development_dependency(%q<jeweler>.freeze, [">= 0"])
86
+ s.add_development_dependency(%q<pry>.freeze, [">= 0"])
86
87
  else
87
88
  s.add_dependency(%q<activesupport>.freeze, [">= 4.2.7"])
88
- s.add_dependency(%q<rest-client>.freeze, ["~> 1.8.0"])
89
+ s.add_dependency(%q<rest-client>.freeze, ["~> 2.0"])
89
90
  s.add_dependency(%q<terminal-table>.freeze, [">= 0"])
90
91
  s.add_dependency(%q<highline>.freeze, [">= 0"])
91
92
  s.add_dependency(%q<rspec>.freeze, [">= 3.5"])
92
93
  s.add_dependency(%q<rdoc>.freeze, [">= 0"])
93
94
  s.add_dependency(%q<bundler>.freeze, [">= 0"])
94
95
  s.add_dependency(%q<jeweler>.freeze, [">= 0"])
96
+ s.add_dependency(%q<pry>.freeze, [">= 0"])
95
97
  end
96
98
  else
97
99
  s.add_dependency(%q<activesupport>.freeze, [">= 4.2.7"])
98
- s.add_dependency(%q<rest-client>.freeze, ["~> 1.8.0"])
100
+ s.add_dependency(%q<rest-client>.freeze, ["~> 2.0"])
99
101
  s.add_dependency(%q<terminal-table>.freeze, [">= 0"])
100
102
  s.add_dependency(%q<highline>.freeze, [">= 0"])
101
103
  s.add_dependency(%q<rspec>.freeze, [">= 3.5"])
102
104
  s.add_dependency(%q<rdoc>.freeze, [">= 0"])
103
105
  s.add_dependency(%q<bundler>.freeze, [">= 0"])
104
106
  s.add_dependency(%q<jeweler>.freeze, [">= 0"])
107
+ s.add_dependency(%q<pry>.freeze, [">= 0"])
105
108
  end
106
109
  end
107
110
 
@@ -4,14 +4,14 @@ describe BaseResource do
4
4
 
5
5
  context 'Private Methods' do
6
6
 
7
- before(:each) do
7
+ before(:each) do
8
8
  @cut = BaseResource.new({ use_ssl: false, server: 'localhost:3000', api_token: 'sltc_api_token'})
9
9
  end
10
10
 
11
11
  context '#invoke_rest' do
12
12
 
13
13
  it "should return a raw string if a non-JSON response is made from the block" do
14
- result = @cut.send(:invoke_rest, false) do
14
+ result = @cut.send(:invoke_rest, false) do
15
15
  "abc123"
16
16
  end
17
17
  expect(result).to eq("abc123")
@@ -34,8 +34,8 @@ describe BaseResource do
34
34
 
35
35
  it "should output an error message and exit if there is a non-403,404 exception" do
36
36
  mock_response = double("Response")
37
- mock_response.should_receive(:code).any_number_of_times.and_return(500)
38
- mock_response.should_receive(:description).and_return("System error")
37
+ expect(mock_response).to receive(:code).at_least(1).and_return(500)
38
+ expect(mock_response).to receive(:description).and_return("System error")
39
39
 
40
40
  expect {
41
41
  @cut.send(:invoke_rest) do
@@ -46,8 +46,8 @@ describe BaseResource do
46
46
 
47
47
  it "should output an error message and exit if there is a 403 exception with no json" do
48
48
  mock_response = double("Response")
49
- mock_response.should_receive(:code).any_number_of_times.and_return(403)
50
- mock_response.should_receive(:description).and_return("Some other error")
49
+ expect(mock_response).to receive(:code).at_least(1).and_return(403)
50
+ expect(mock_response).to receive(:description).and_return("Some other error")
51
51
 
52
52
  expect {
53
53
  @cut.send(:invoke_rest, false) do
@@ -58,9 +58,9 @@ describe BaseResource do
58
58
 
59
59
  it "should output an error message and exit if there is a 404 exception with error json" do
60
60
  mock_response = double("Response")
61
- mock_response.stub(:code).and_return(404)
62
- mock_response.should_receive(:description).and_return("Some other error")
63
- mock_response.should_receive(:http_body).and_return('{ "error" : "Error message" }')
61
+ expect(mock_response).to receive(:code).at_least(1).and_return(404)
62
+ expect(mock_response).to receive(:description).and_return("Some other error")
63
+ expect(mock_response).to receive(:http_body).at_least(:once).and_return('{ "error" : "Error message" }')
64
64
 
65
65
  expect {
66
66
  @cut.send(:invoke_rest) do
@@ -71,9 +71,9 @@ describe BaseResource do
71
71
 
72
72
  it "should output an error message and exit if there is a 403 exception with validation error json" do
73
73
  mock_response = double("Response")
74
- mock_response.should_receive(:code).any_number_of_times.and_return(403)
75
- mock_response.should_receive(:description).and_return("Some other error")
76
- mock_response.should_receive(:http_body).and_return('{ "validation_error" : { "name" : [ "Error 1", "Error 2" ] } }')
74
+ expect(mock_response).to receive(:code).at_least(1).times.and_return(403)
75
+ expect(mock_response).to receive(:description).and_return("Some other error")
76
+ expect(mock_response).to receive(:http_body).at_least(:once).and_return('{ "validation_error" : { "name" : [ "Error 1", "Error 2" ] } }')
77
77
 
78
78
  expect {
79
79
  @cut.send(:invoke_rest) do
@@ -84,9 +84,9 @@ describe BaseResource do
84
84
 
85
85
  it "should output an error message and exit if there is a 403 exception with some other error json" do
86
86
  mock_response = double("Response")
87
- mock_response.should_receive(:code).any_number_of_times.and_return(403)
88
- mock_response.should_receive(:description).and_return("Some other error")
89
- mock_response.should_receive(:http_body).and_return('{ "other_error" : { "name" : [ "Error 1", "Error 2" ] } }')
87
+ expect(mock_response).to receive(:code).at_least(1).times.and_return(403)
88
+ expect(mock_response).to receive(:description).and_return("Some other error")
89
+ expect(mock_response).to receive(:http_body).at_least(:once).and_return('{ "other_error" : { "name" : [ "Error 1", "Error 2" ] } }')
90
90
 
91
91
  expect {
92
92
  @cut.send(:invoke_rest) do
@@ -97,9 +97,9 @@ describe BaseResource do
97
97
 
98
98
  it "should output an error message and exit if there is a 403 exception with invalid validation error json" do
99
99
  mock_response = double("Response")
100
- mock_response.should_receive(:code).any_number_of_times.and_return(403)
101
- mock_response.should_receive(:description).and_return("Some other error")
102
- mock_response.should_receive(:http_body).any_number_of_times.and_return('{ "validation_error" : { "name" : "Error 1", "Error 2" ] } }')
100
+ expect(mock_response).to receive(:code).at_least(1).times.and_return(403)
101
+ expect(mock_response).to receive(:description).and_return("Some other error")
102
+ expect(mock_response).to receive(:http_body).at_least(:once).and_return('{ "validation_error" : { "name" : "Error 1", "Error 2" ] } }')
103
103
 
104
104
  expect {
105
105
  @cut.send(:invoke_rest) do
@@ -121,9 +121,9 @@ describe BaseResource do
121
121
  context '#get' do
122
122
 
123
123
  it "should return the response from the GET call" do
124
- @cut.should_receive(:invoke_rest).with(true).and_yield
125
-
126
- RestClient.should_receive(:get).
124
+ expect(@cut).to receive(:invoke_rest).with(true).and_yield
125
+
126
+ expect(RestClient).to receive(:get).
127
127
  with('http://localhost:3000/tubes', {"Authorization"=>"Token token=\"sltc_api_token\"" }).
128
128
  and_return({ hey: 'guy' })
129
129
 
@@ -135,9 +135,9 @@ describe BaseResource do
135
135
  context '#delete' do
136
136
 
137
137
  it "should return the response from the DELETE call" do
138
- @cut.should_receive(:invoke_rest).with(true).and_yield
139
-
140
- RestClient.should_receive(:delete).
138
+ expect(@cut).to receive(:invoke_rest).with(true).and_yield
139
+
140
+ expect(RestClient).to receive(:delete).
141
141
  with('http://localhost:3000/tubes', {"Authorization"=>"Token token=\"sltc_api_token\"" }).
142
142
  and_return({ hey: 'guy' })
143
143
 
@@ -149,10 +149,10 @@ describe BaseResource do
149
149
  context '#post' do
150
150
 
151
151
  it "should return the response from the POST call" do
152
- @cut.should_receive(:invoke_rest).with(true).and_yield
153
-
154
- RestClient.should_receive(:post).
155
- with('http://localhost:3000/tubes',
152
+ expect(@cut).to receive(:invoke_rest).with(true).and_yield
153
+
154
+ expect(RestClient).to receive(:post).
155
+ with('http://localhost:3000/tubes',
156
156
  {"param1"=>"pvalue"},
157
157
  {"Authorization"=>"Token token=\"sltc_api_token\"" }).
158
158
  and_return({ hey: 'guy' })
@@ -165,10 +165,10 @@ describe BaseResource do
165
165
  context '#put' do
166
166
 
167
167
  it "should return the response from the PUT call" do
168
- @cut.should_receive(:invoke_rest).with(true).and_yield
169
-
170
- RestClient.should_receive(:put).
171
- with('http://localhost:3000/tubes',
168
+ expect(@cut).to receive(:invoke_rest).with(true).and_yield
169
+
170
+ expect(RestClient).to receive(:put).
171
+ with('http://localhost:3000/tubes',
172
172
  {"param1"=>"pvalue"},
173
173
  {"Authorization"=>"Token token=\"sltc_api_token\"" }).
174
174
  and_return({ hey: 'guy' })
@@ -187,7 +187,7 @@ describe BaseResource do
187
187
  expect(@cut.send(:build_url, 'the_uri')).to eq('http://www.bob.com/the_uri')
188
188
 
189
189
  @cut.options[:use_ssl] = true
190
-
190
+
191
191
  expect(@cut.send(:build_url, 'the_uri')).to eq('https://www.bob.com/the_uri')
192
192
  end
193
193
 
@@ -20,7 +20,7 @@ describe ServiceMgrOptions do
20
20
  context '#parse_options!' do
21
21
 
22
22
  context 'without an api token' do
23
-
23
+
24
24
  it "should raise an exception if no API token has been specified" do
25
25
  argv = []
26
26
  expect { @cut.parse_options!(argv) }.
@@ -64,8 +64,8 @@ describe ServiceMgrOptions do
64
64
  it "should set the server option" do
65
65
  argv = ['--token', 'the_token', '--server', 'test.abaqis.int' ]
66
66
  expect(@cut.parse_options!(argv)).
67
- to eq([ { server: 'test.abaqis.int',
68
- use_ssl: true,
67
+ to eq([ { server: 'test.abaqis.int',
68
+ use_ssl: true,
69
69
  api_token: 'the_token',
70
70
  trace: false }, # Default options
71
71
  'service', # Default resource
@@ -75,8 +75,8 @@ describe ServiceMgrOptions do
75
75
  it "should set the server/ssl option for local testing" do
76
76
  argv = ['--token', 'the_token', '--local']
77
77
  expect(@cut.parse_options!(argv)).
78
- to eq([ { server: 'localhost:3000',
79
- use_ssl: false,
78
+ to eq([ { server: 'localhost:3000',
79
+ use_ssl: false,
80
80
  api_token: 'the_token',
81
81
  trace: false }, # Default options
82
82
  'service', # Default resource
@@ -86,8 +86,8 @@ describe ServiceMgrOptions do
86
86
  it "should set the server/ssl option for uat testing" do
87
87
  argv = ['--token', 'the_token', '--uat']
88
88
  expect(@cut.parse_options!(argv)).
89
- to eq([ { server: 'uat.abaqis.com',
90
- use_ssl: true,
89
+ to eq([ { server: 'uat.abaqis.com',
90
+ use_ssl: true,
91
91
  api_token: 'the_token',
92
92
  trace: false }, # Default options
93
93
  'service', # Default resource
@@ -103,8 +103,8 @@ describe ServiceMgrOptions do
103
103
  it "should set the trace option" do
104
104
  argv = ['--token', 'the_token', '--trace']
105
105
  expect(@cut.parse_options!(argv)).
106
- to eq([ { server: 'www.abaqis.com',
107
- use_ssl: true,
106
+ to eq([ { server: 'www.abaqis.com',
107
+ use_ssl: true,
108
108
  api_token: 'the_token',
109
109
  trace: true }, # Default options
110
110
  'service', # Default resource
@@ -114,10 +114,10 @@ describe ServiceMgrOptions do
114
114
  it "should the set the account mapping id" do
115
115
  argv = ['--token', 'the_token', '--account-mapping-id', "234"]
116
116
  expect(@cut.parse_options!(argv)).
117
- to eq([ { server: 'www.abaqis.com',
118
- use_ssl: true,
117
+ to eq([ { server: 'www.abaqis.com',
118
+ use_ssl: true,
119
119
  api_token: 'the_token',
120
- trace: false,
120
+ trace: false,
121
121
  account_mapping_id: "234" }, # Default options
122
122
  'service', # Default resource
123
123
  'list' ]) # Default command
@@ -126,10 +126,10 @@ describe ServiceMgrOptions do
126
126
  it "should the set the configured account id" do
127
127
  argv = ['--token', 'the_token', '--configured-account-id', "234"]
128
128
  expect(@cut.parse_options!(argv)).
129
- to eq([ { server: 'www.abaqis.com',
130
- use_ssl: true,
129
+ to eq([ { server: 'www.abaqis.com',
130
+ use_ssl: true,
131
131
  api_token: 'the_token',
132
- trace: false,
132
+ trace: false,
133
133
  configured_account_id: "234" }, # Default options
134
134
  'service', # Default resource
135
135
  'list' ]) # Default command
@@ -138,10 +138,10 @@ describe ServiceMgrOptions do
138
138
  it "should the set the facility mapping id" do
139
139
  argv = ['--token', 'the_token', '--facility-mapping-id', "234"]
140
140
  expect(@cut.parse_options!(argv)).
141
- to eq([ { server: 'www.abaqis.com',
142
- use_ssl: true,
141
+ to eq([ { server: 'www.abaqis.com',
142
+ use_ssl: true,
143
143
  api_token: 'the_token',
144
- trace: false,
144
+ trace: false,
145
145
  facility_mapping_id: "234" }, # Default options
146
146
  'service', # Default resource
147
147
  'list' ]) # Default command
@@ -150,10 +150,10 @@ describe ServiceMgrOptions do
150
150
  it "should the set the service definition id" do
151
151
  argv = ['--token', 'the_token', '--service-definition-id', "234"]
152
152
  expect(@cut.parse_options!(argv)).
153
- to eq([ { server: 'www.abaqis.com',
154
- use_ssl: true,
153
+ to eq([ { server: 'www.abaqis.com',
154
+ use_ssl: true,
155
155
  api_token: 'the_token',
156
- trace: false,
156
+ trace: false,
157
157
  service_definition_id: "234" }, # Default options
158
158
  'service', # Default resource
159
159
  'list' ]) # Default command
@@ -162,10 +162,10 @@ describe ServiceMgrOptions do
162
162
  it "should the set the service id" do
163
163
  argv = ['--token', 'the_token', '--service-id', "234"]
164
164
  expect(@cut.parse_options!(argv)).
165
- to eq([ { server: 'www.abaqis.com',
166
- use_ssl: true,
165
+ to eq([ { server: 'www.abaqis.com',
166
+ use_ssl: true,
167
167
  api_token: 'the_token',
168
- trace: false,
168
+ trace: false,
169
169
  service_id: "234" }, # Default options
170
170
  'service', # Default resource
171
171
  'list' ]) # Default command
@@ -174,10 +174,10 @@ describe ServiceMgrOptions do
174
174
  it "should the set the third party id" do
175
175
  argv = ['--token', 'the_token', '--third-party-id', "234"]
176
176
  expect(@cut.parse_options!(argv)).
177
- to eq([ { server: 'www.abaqis.com',
178
- use_ssl: true,
177
+ to eq([ { server: 'www.abaqis.com',
178
+ use_ssl: true,
179
179
  api_token: 'the_token',
180
- trace: false,
180
+ trace: false,
181
181
  third_party_id: "234" }, # Default options
182
182
  'service', # Default resource
183
183
  'list' ]) # Default command
@@ -190,16 +190,12 @@ describe ServiceMgrOptions do
190
190
  context '#invoke_command' do
191
191
 
192
192
  it "should construct the resource with the options and invoke the command on the resource" do
193
- @cut.should_receive(:parse_options!).
194
- and_return( [ { }, 'service', 'list' ] )
193
+ expect(@cut).to receive(:parse_options!).and_return( [ { }, 'service', 'list' ] )
195
194
 
196
195
  mock_service = double("Service")
197
- mock_service.should_receive(:send).
198
- with(:list)
199
-
200
- Resources::Service.should_receive(:new).
201
- with({}).
202
- and_return(mock_service)
196
+ expect(mock_service).to receive(:send).with(:list)
197
+
198
+ expect(Resources::Service).to receive(:new).with({}).and_return(mock_service)
203
199
 
204
200
  @cut.invoke_command
205
201
  end
@@ -212,27 +208,27 @@ describe ServiceMgrOptions do
212
208
  context '#valid_command?' do
213
209
 
214
210
  it "should return true if the specified resource has the specified command" do
211
+ # binding.pry
215
212
  COMMANDS.each_pair do | resource, commands |
216
213
  commands.each do | command |
217
- expect(@cut.send(:valid_command?, resource, command.to_s)).
218
- to be_true, "'#{command}' should be a valid command for resource '#{resource}'"
214
+ expect(@cut.send(:valid_command?, resource, command.to_s)).to be_truthy, "'#{command}' should be a valid command for resource '#{resource}'"
219
215
  end
220
216
  end
221
217
  end
222
218
 
223
219
  it "should return false if the specified resource doesn't have the specified command" do
224
220
  expect(@cut.send(:valid_command?, 'service', 'invalid_command')).
225
- to be_false
221
+ to be_falsey
226
222
  end
227
223
 
228
224
  it "should return false if the specified resource is nil" do
229
225
  expect(@cut.send(:valid_command?, nil, 'list')).
230
- to be_false
226
+ to be_falsey
231
227
  end
232
228
 
233
229
  it "should return false if the specified command is nil" do
234
230
  expect(@cut.send(:valid_command?, 'service', nil)).
235
- to be_false
231
+ to be_falsey
236
232
  end
237
233
 
238
234
  it "should do something horrible if the resource name is bogus" do
@@ -246,17 +242,17 @@ describe ServiceMgrOptions do
246
242
 
247
243
  it "should return true if the specified resource is valid" do
248
244
  expect(@cut.send(:valid_resource?, 'service')).
249
- to be_true
245
+ to be_truthy
250
246
  end
251
247
 
252
248
  it "should return false if the specified resource is not valid" do
253
249
  expect(@cut.send(:valid_resource?, 'servicer')).
254
- to be_false
250
+ to be_falsey
255
251
  end
256
252
 
257
253
  it "should return false if the specified resource is nil" do
258
254
  expect(@cut.send(:valid_resource?, nil)).
259
- to be_false
255
+ to be_falsey
260
256
  end
261
257
 
262
258
  end
@@ -3,7 +3,7 @@ $LOAD_PATH.unshift(File.dirname(__FILE__))
3
3
 
4
4
  # Here's the deal. We need to make sure that the API_TOKEN is not set
5
5
  # environment before the tests are run. In fact, the ENV['API_TOKEN']
6
- # must be cleared before the ServiceMgrOptions class is loaded. That's
6
+ # must be cleared before the ServiceMgrOptions class is loaded. That's
7
7
  # why we do it before the requires.
8
8
  #
9
9
  # I'm just sayin'
@@ -12,11 +12,12 @@ ENV.delete('API_TOKEN')
12
12
 
13
13
  require 'rspec'
14
14
  require 'pvdgm-svc-client'
15
+ require 'pry'
15
16
 
16
17
  # Requires supporting files with custom matchers and macros, etc,
17
18
  # in ./support/ and its subdirectories.
18
19
  Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
19
20
 
20
21
  RSpec.configure do |config|
21
-
22
+
22
23
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pvdgm-svc-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dave Sieh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-22 00:00:00.000000000 Z
11
+ date: 2019-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.8.0
33
+ version: '2.0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 1.8.0
40
+ version: '2.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: terminal-table
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -122,6 +122,20 @@ dependencies:
122
122
  - - ">="
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: pry
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
125
139
  description: This gem provides command line and other types of tools to support the
126
140
  Service Engine.
127
141
  email: dave.sieh@providigm.com
@@ -200,7 +214,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
200
214
  version: '0'
201
215
  requirements: []
202
216
  rubyforge_project:
203
- rubygems_version: 2.5.2
217
+ rubygems_version: 2.7.6.2
204
218
  signing_key:
205
219
  specification_version: 4
206
220
  summary: Command-line client tools to support the Service Engine