hammer_cli_foreman 2.1.3 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/doc/release_notes.md +8 -7
  3. data/doc/testing.md +13 -0
  4. data/lib/hammer_cli_foreman/associating_commands.rb +2 -3
  5. data/lib/hammer_cli_foreman/auth.rb +4 -4
  6. data/lib/hammer_cli_foreman/output/fields.rb +1 -1
  7. data/lib/hammer_cli_foreman/output/formatters.rb +1 -1
  8. data/lib/hammer_cli_foreman/testing/api_expectations.rb +10 -0
  9. data/lib/hammer_cli_foreman/version.rb +1 -1
  10. data/lib/minitest/coverage_reporter.rb +94 -0
  11. data/lib/minitest/hammer_coverage_plugin.rb +19 -0
  12. data/locale/ca/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  13. data/locale/de/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  14. data/locale/en/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  15. data/locale/en_GB/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  16. data/locale/es/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  17. data/locale/fr/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  18. data/locale/it/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  19. data/locale/ja/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  20. data/locale/ko/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  21. data/locale/pt_BR/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  22. data/locale/ru/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  23. data/locale/zh_CN/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  24. data/locale/zh_TW/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  25. data/test/functional/commands/list_test.rb +11 -11
  26. data/test/functional/host_test.rb +3 -3
  27. data/test/functional/realm_test.rb +104 -0
  28. data/test/functional/trend_test.rb +63 -2
  29. data/test/reports/TEST-Minitest-Result.xml +4344 -0
  30. data/test/test_helper.rb +5 -2
  31. data/test/unit/api/interactive_basic_auth_test.rb +3 -1
  32. data/test/unit/api/oauth/oauth_authentication_code_grant_test.rb +2 -2
  33. data/test/unit/api/oauth/oauth_password_grant_test.rb +2 -2
  34. data/test/unit/api_test.rb +3 -4
  35. data/test/unit/apipie_resource_mock.rb +4 -4
  36. data/test/unit/commands_test.rb +19 -19
  37. data/test/unit/common_parameter_test.rb +1 -1
  38. data/test/unit/dependency_resolver_test.rb +4 -4
  39. data/test/unit/exception_handler_test.rb +13 -13
  40. data/test/unit/helpers/command.rb +5 -5
  41. data/test/unit/helpers/resource_disabled.rb +2 -2
  42. data/test/unit/host_test.rb +2 -2
  43. data/test/unit/id_resolver_test.rb +23 -23
  44. data/test/unit/option_builders_test.rb +49 -49
  45. data/test/unit/option_sources/id_params_test.rb +2 -2
  46. data/test/unit/option_sources/ids_params_test.rb +2 -2
  47. data/test/unit/output/formatters_test.rb +21 -21
  48. data/test/unit/param_filters_test.rb +17 -17
  49. data/test/unit/sessions_test.rb +24 -24
  50. data/test/unit/template_test.rb +1 -1
  51. metadata +105 -99
@@ -76,7 +76,7 @@ describe HammerCLIForeman::Host do
76
76
 
77
77
  it "should output status" do
78
78
  cmd.stubs(:context).returns(ctx.update(:adapter => :test))
79
- proc { cmd.run(with_params) }.must_output "#Status#Power#\n#No reports#running#\n"
79
+ _(proc { cmd.run(with_params) }).must_output "#Status#Power#\n#No reports#running#\n"
80
80
  end
81
81
  end
82
82
  end
@@ -148,7 +148,7 @@ describe HammerCLIForeman::Host do
148
148
  with_params ["--id=1"] do
149
149
  it "should inform that puppet was triggered" do
150
150
  cmd.stubs(:context).returns(ctx.update(:adapter => :test))
151
- proc { cmd.run(with_params) }.must_output "Puppet run triggered\n"
151
+ _(proc { cmd.run(with_params) }).must_output "Puppet run triggered\n"
152
152
  end
153
153
  end
154
154
  end
@@ -14,7 +14,7 @@ describe HammerCLIForeman::IdResolver do
14
14
 
15
15
  describe "scoped options" do
16
16
  it "returns empty hash when there are no options" do
17
- resolver.scoped_options("scope", {}).must_equal({})
17
+ _(resolver.scoped_options("scope", {})).must_equal({})
18
18
  end
19
19
 
20
20
  it "unscopes options" do
@@ -29,7 +29,7 @@ describe HammerCLIForeman::IdResolver do
29
29
  "option_name" => "ACME",
30
30
  "option_a" => :value
31
31
  }
32
- resolver.scoped_options("organization", scoped).must_equal(unscoped)
32
+ _(resolver.scoped_options("organization", scoped)).must_equal(unscoped)
33
33
  end
34
34
 
35
35
  it "clears old values" do
@@ -43,7 +43,7 @@ describe HammerCLIForeman::IdResolver do
43
43
  "option_id" => 2,
44
44
  "option_a" => :value
45
45
  }
46
- resolver.scoped_options("organization", scoped).must_equal(unscoped)
46
+ _(resolver.scoped_options("organization", scoped)).must_equal(unscoped)
47
47
  end
48
48
 
49
49
  let(:scoped_multi) {{
@@ -63,7 +63,7 @@ describe HammerCLIForeman::IdResolver do
63
63
  "option_name" => "ACME",
64
64
  "option_a" => :value
65
65
  }
66
- resolver.scoped_options("organization", scoped_multi, :single).must_equal(unscoped)
66
+ _(resolver.scoped_options("organization", scoped_multi, :single)).must_equal(unscoped)
67
67
  end
68
68
 
69
69
  it "unscopes the right options in multi mode" do
@@ -75,7 +75,7 @@ describe HammerCLIForeman::IdResolver do
75
75
  "option_names" => "Corp",
76
76
  "option_a" => :value
77
77
  }
78
- resolver.scoped_options("organization", scoped_multi, :multi).must_equal(unscoped)
78
+ _(resolver.scoped_options("organization", scoped_multi, :multi)).must_equal(unscoped)
79
79
  end
80
80
 
81
81
  it "does not change the original options" do
@@ -87,7 +87,7 @@ describe HammerCLIForeman::IdResolver do
87
87
  }
88
88
  scoped_original = scoped.dup
89
89
  resolver.scoped_options("organization", scoped)
90
- scoped.must_equal(scoped_original)
90
+ _(scoped).must_equal(scoped_original)
91
91
  end
92
92
 
93
93
  end
@@ -102,19 +102,19 @@ describe HammerCLIForeman::IdResolver do
102
102
  it "must define methods for all resources" do
103
103
  expected_method_names = api.resources.map(&:singular_name).collect{|r| "#{r}_id"}
104
104
  missing_methods = expected_method_names - resolver.methods.map(&:to_s)
105
- missing_methods.must_equal []
105
+ _(missing_methods).must_equal []
106
106
  end
107
107
 
108
108
  describe "when no search options are found" do
109
109
  let(:resolver_run) { proc { resolver.comment_id({"option_unknown" => "value"}) } }
110
110
 
111
111
  it "raises exception" do
112
- err = resolver_run.must_raise HammerCLIForeman::MissingSearchOptions
112
+ err = _(resolver_run).must_raise HammerCLIForeman::MissingSearchOptions
113
113
  end
114
114
 
115
115
  it "builds correct error message" do
116
- err = resolver_run.must_raise HammerCLIForeman::MissingSearchOptions
117
- err.message.must_equal "Missing options to search comment."
116
+ err = _(resolver_run).must_raise HammerCLIForeman::MissingSearchOptions
117
+ _(err.message).must_equal "Missing options to search comment."
118
118
  end
119
119
  end
120
120
 
@@ -124,15 +124,15 @@ describe HammerCLIForeman::IdResolver do
124
124
  it "raises exception when no resource is found" do
125
125
  ResourceMocks.mock_action_call(:users, :index, index_response([]))
126
126
 
127
- err = resolver_run.must_raise HammerCLIForeman::ResolverError
128
- err.message.must_equal "user not found."
127
+ err = _(resolver_run).must_raise HammerCLIForeman::ResolverError
128
+ _(err.message).must_equal "user not found."
129
129
  end
130
130
 
131
131
  it "raises exception when multiple resources are found" do
132
132
  ResourceMocks.mock_action_call(:users, :index, index_response([john, jane]))
133
133
 
134
- err = resolver_run.must_raise HammerCLIForeman::ResolverError
135
- err.message.must_equal "Found more than one user."
134
+ err = _(resolver_run).must_raise HammerCLIForeman::ResolverError
135
+ _(err.message).must_equal "Found more than one user."
136
136
  end
137
137
 
138
138
  it "calls index action with appropriate search params" do
@@ -148,17 +148,17 @@ describe HammerCLIForeman::IdResolver do
148
148
  it "uses option id when it's available" do
149
149
  ResourceMocks.mock_action_call(:users, :index, [])
150
150
 
151
- resolver.user_id({"option_id" => 83, "option_name" => "John Doe"}).must_equal 83
151
+ _(resolver.user_id({"option_id" => 83, "option_name" => "John Doe"})).must_equal 83
152
152
  end
153
153
 
154
154
  it "returns NIL when the search name is NIL" do
155
- resolver.user_id({"option_name" => HammerCLI::NilValue}).must_equal HammerCLI::NilValue
155
+ _(resolver.user_id({"option_name" => HammerCLI::NilValue})).must_equal HammerCLI::NilValue
156
156
  end
157
157
 
158
158
  it "returns id of the resource" do
159
159
  ResourceMocks.mock_action_call(:users, :index, index_response([john]))
160
160
 
161
- resolver_run.call.must_equal john_id
161
+ _(resolver_run.call).must_equal john_id
162
162
  end
163
163
 
164
164
  end
@@ -170,16 +170,16 @@ describe HammerCLIForeman::IdResolver do
170
170
  ResourceMocks.mock_action_call(:posts, :index, index_response([]))
171
171
  ResourceMocks.mock_action_call(:users, :index, index_response([]))
172
172
 
173
- err = resolver_run.must_raise HammerCLIForeman::ResolverError
174
- err.message.must_equal "user not found."
173
+ err = _(resolver_run).must_raise HammerCLIForeman::ResolverError
174
+ _(err.message).must_equal "user not found."
175
175
  end
176
176
 
177
177
  it "raises exception when multiple resources are found" do
178
178
  ResourceMocks.mock_action_call(:posts, :index, index_response([]))
179
179
  ResourceMocks.mock_action_call(:users, :index, index_response([john, jane]))
180
180
 
181
- err = resolver_run.must_raise HammerCLIForeman::ResolverError
182
- err.message.must_equal "Found more than one user."
181
+ err = _(resolver_run).must_raise HammerCLIForeman::ResolverError
182
+ _(err.message).must_equal "Found more than one user."
183
183
  end
184
184
 
185
185
  it "calls index action with appropriate search params" do
@@ -209,7 +209,7 @@ describe HammerCLIForeman::IdResolver do
209
209
  {"id" => 22, "name" => "User 22"}
210
210
  ]
211
211
  ))
212
- resolver_run.call.must_equal 11
212
+ _(resolver_run.call).must_equal 11
213
213
  end
214
214
  end
215
215
 
@@ -288,7 +288,7 @@ describe HammerCLIForeman::IdResolver do
288
288
  end
289
289
 
290
290
  it "returns NilValue when the search name is NilValue" do
291
- resolver.user_ids({"option_names" => HammerCLI::NilValue}).must_equal HammerCLI::NilValue
291
+ _(resolver.user_ids({"option_names" => HammerCLI::NilValue})).must_equal HammerCLI::NilValue
292
292
  end
293
293
  end
294
294
  end
@@ -6,20 +6,20 @@ describe HammerCLIForeman::BuildParams do
6
6
  let(:params) { HammerCLIForeman::BuildParams.new }
7
7
 
8
8
  it "creates empty hash by default" do
9
- params.to_hash.must_equal( {} )
9
+ _(params.to_hash).must_equal( {} )
10
10
  end
11
11
 
12
12
  it "can be prefonfigured" do
13
13
  preconfigured_params = HammerCLIForeman::BuildParams.new(:expand => {:only => [:a, :b]}, :without => [:c, :d])
14
14
  preconfigured_params.expand.including(:c, :d)
15
- preconfigured_params.to_hash.must_equal( {:expand => {:only => [:a, :b], :including => [:c, :d]}, :without => [:c, :d]} )
15
+ _(preconfigured_params.to_hash).must_equal( {:expand => {:only => [:a, :b], :including => [:c, :d]}, :without => [:c, :d]} )
16
16
  end
17
17
 
18
18
  describe "without" do
19
19
 
20
20
  it "sets :without" do
21
21
  params.without(:organization_id, :location_id)
22
- params.to_hash.must_equal( {:without => [:organization_id, :location_id]} )
22
+ _(params.to_hash).must_equal( {:without => [:organization_id, :location_id]} )
23
23
  end
24
24
 
25
25
  end
@@ -28,44 +28,44 @@ describe HammerCLIForeman::BuildParams do
28
28
 
29
29
  it "can set expand all" do
30
30
  params.expand(:all)
31
- params.to_hash.must_equal( {:expand => {}} )
31
+ _(params.to_hash).must_equal( {:expand => {}} )
32
32
  end
33
33
 
34
34
  it "expands all by default" do
35
35
  params.expand
36
- params.to_hash.must_equal( {:expand => {}} )
36
+ _(params.to_hash).must_equal( {:expand => {}} )
37
37
  end
38
38
 
39
39
  it "can disable expansion" do
40
40
  params.expand(:none)
41
- params.to_hash.must_equal( {:expand => {:only => []}} )
41
+ _(params.to_hash).must_equal( {:expand => {:only => []}} )
42
42
  end
43
43
 
44
44
  describe "except" do
45
45
  it "sets except field" do
46
46
  params.expand.except(:organizations)
47
- params.to_hash.must_equal( {:expand => {:except => [:organizations]}} )
47
+ _(params.to_hash).must_equal( {:expand => {:except => [:organizations]}} )
48
48
  end
49
49
  end
50
50
 
51
51
  describe "including" do
52
52
  it "sets including field" do
53
53
  params.expand.including(:organizations)
54
- params.to_hash.must_equal( {:expand => {:including => [:organizations]}} )
54
+ _(params.to_hash).must_equal( {:expand => {:including => [:organizations]}} )
55
55
  end
56
56
  end
57
57
 
58
58
  describe "only" do
59
59
  it "sets only field" do
60
60
  params.expand.only(:organizations)
61
- params.to_hash.must_equal( {:expand => {:only => [:organizations]}} )
61
+ _(params.to_hash).must_equal( {:expand => {:only => [:organizations]}} )
62
62
  end
63
63
  end
64
64
 
65
65
  describe "primary" do
66
66
  it "sets primary field" do
67
67
  params.expand.primary(:organizations)
68
- params.to_hash.must_equal( {:expand => {:primary => :organizations}} )
68
+ _(params.to_hash).must_equal( {:expand => {:primary => :organizations}} )
69
69
  end
70
70
  end
71
71
 
@@ -103,7 +103,7 @@ describe HammerCLIForeman::BuilderConfigurator do
103
103
  let(:action) { resource.action(:index)}
104
104
 
105
105
  it "adds no option builder" do
106
- result_classes.must_equal []
106
+ _(result_classes).must_equal []
107
107
  end
108
108
  end
109
109
 
@@ -112,7 +112,7 @@ describe HammerCLIForeman::BuilderConfigurator do
112
112
  let(:action) { resource.action(:show)}
113
113
 
114
114
  it "adds searchable options builder" do
115
- resource_names(builders_by_class(HammerCLIForeman::SearchablesOptionBuilder)).must_equal [:users]
115
+ _(resource_names(builders_by_class(HammerCLIForeman::SearchablesOptionBuilder))).must_equal [:users]
116
116
  end
117
117
  end
118
118
 
@@ -122,13 +122,13 @@ describe HammerCLIForeman::BuilderConfigurator do
122
122
  let(:action) { resource.action(:show)}
123
123
 
124
124
  it "adds searchable options builder" do
125
- resource_names(builders_by_class(HammerCLIForeman::SearchablesOptionBuilder)).must_equal [:posts]
125
+ _(resource_names(builders_by_class(HammerCLIForeman::SearchablesOptionBuilder))).must_equal [:posts]
126
126
  end
127
127
 
128
128
  it "adds dependent searchable option builders" do
129
129
  resources = resource_names(builders_by_class(HammerCLIForeman::DependentSearchablesOptionBuilder)).sort
130
130
  expected = [:users]
131
- resources.must_equal expected.sort
131
+ _(resources).must_equal expected.sort
132
132
  end
133
133
 
134
134
  end
@@ -162,7 +162,7 @@ describe HammerCLIForeman::ForemanOptionBuilder do
162
162
  builder.stubs(:build).returns(options)
163
163
 
164
164
  container.builders = [builder, builder]
165
- container.build.must_equal options+options
165
+ _(container.build).must_equal options+options
166
166
  end
167
167
 
168
168
  it "passes build parameters to contained builders" do
@@ -183,13 +183,13 @@ describe HammerCLIForeman::ForemanOptionBuilder do
183
183
  HammerCLIForeman::SearchablesOptionBuilder.new(api.resource(:users), FakeSearchables.new(["aaa", "bbb"]))
184
184
  ]
185
185
  @build_options = {:expand => {:primary => false}}
186
- option_switches.must_equal []
186
+ _(option_switches).must_equal []
187
187
  end
188
188
 
189
189
  it "can add custom searchable builder" do
190
190
  container.builders = []
191
191
  @build_options = {:expand => {:primary => :users}}
192
- option_switches.must_equal [
192
+ _(option_switches).must_equal [
193
193
  ["--name"],
194
194
  ["--label"]
195
195
  ]
@@ -200,7 +200,7 @@ describe HammerCLIForeman::ForemanOptionBuilder do
200
200
  HammerCLIForeman::SearchablesOptionBuilder.new(api.resource(:posts), FakeSearchables.new(["aaa", "bbb"]))
201
201
  ]
202
202
  @build_options = {:expand => {:primary => :users}}
203
- option_switches.must_equal [
203
+ _(option_switches).must_equal [
204
204
  ["--name"],
205
205
  ["--label"]
206
206
  ]
@@ -220,7 +220,7 @@ describe HammerCLIForeman::ForemanOptionBuilder do
220
220
 
221
221
  it "does not filter searchable builders by default" do
222
222
  @build_options = {:expand => {}}
223
- option_switches.must_equal [
223
+ _(option_switches).must_equal [
224
224
  ["--user"],
225
225
  ["--user-label"],
226
226
  ["--user-id"],
@@ -232,7 +232,7 @@ describe HammerCLIForeman::ForemanOptionBuilder do
232
232
 
233
233
  it "adds dependent searchable builders on explicit requirement" do
234
234
  @build_options = {:expand => {:including => [:posts, :comments]}}
235
- option_switches.must_equal [
235
+ _(option_switches).must_equal [
236
236
  ["--user"],
237
237
  ["--user-label"],
238
238
  ["--user-id"],
@@ -247,7 +247,7 @@ describe HammerCLIForeman::ForemanOptionBuilder do
247
247
 
248
248
  it "filters dependent searchable builders on explicit requirement" do
249
249
  @build_options = {:expand => {:except => [:users]}}
250
- option_switches.must_equal [
250
+ _(option_switches).must_equal [
251
251
  ["--post"],
252
252
  ["--post-label"],
253
253
  ["--post-id"]
@@ -256,7 +256,7 @@ describe HammerCLIForeman::ForemanOptionBuilder do
256
256
 
257
257
  it "specifies custom set of dependent searchable builders on explicit requirement" do
258
258
  @build_options = {:expand => {:only => [:comments, :users]}}
259
- option_switches.must_equal [
259
+ _(option_switches).must_equal [
260
260
  ["--user"],
261
261
  ["--user-label"],
262
262
  ["--user-id"],
@@ -285,33 +285,33 @@ describe HammerCLIForeman::SearchablesOptionBuilder do
285
285
  let(:searchables) { FakeSearchables.new([]) }
286
286
 
287
287
  it "builds no options for empty searchables" do
288
- options.must_equal []
288
+ _(options).must_equal []
289
289
  end
290
290
  end
291
291
 
292
292
  describe "multiple searchables" do
293
293
 
294
294
  it "builds correct switches" do
295
- options.map(&:switches).must_equal [["--name"], ["--label"]]
295
+ _(options.map(&:switches)).must_equal [["--name"], ["--label"]]
296
296
  end
297
297
 
298
298
  it "builds correct descriptions" do
299
- options.map(&:description).must_equal ["Search by name", "Search by label"]
299
+ _(options.map(&:description)).must_equal ["Search by name", "Search by label"]
300
300
  end
301
301
 
302
302
  it "builds correct types" do
303
- options.map(&:type).must_equal ["NAME", "LABEL"]
303
+ _(options.map(&:type)).must_equal ["NAME", "LABEL"]
304
304
  end
305
305
 
306
306
  it "builds correct attribute readers" do
307
- options.map(&:read_method).must_equal [
307
+ _(options.map(&:read_method)).must_equal [
308
308
  "option_name",
309
309
  "option_label"
310
310
  ]
311
311
  end
312
312
 
313
313
  it "none of the options is required" do
314
- options.any?{|opt| opt.required? }.must_equal false
314
+ _(options.any?{|opt| opt.required? }).must_equal false
315
315
  end
316
316
  end
317
317
  end
@@ -335,14 +335,14 @@ describe HammerCLIForeman::DependentSearchablesOptionBuilder do
335
335
  let(:searchables) { FakeSearchables.new([]) }
336
336
 
337
337
  it "builds only id options" do
338
- options.map(&:switches).must_equal [["--user-id"]]
338
+ _(options.map(&:switches)).must_equal [["--user-id"]]
339
339
  end
340
340
  end
341
341
 
342
342
  describe "multiple searchables" do
343
343
 
344
344
  it "creates correct switches" do
345
- options.map(&:switches).must_equal [
345
+ _(options.map(&:switches)).must_equal [
346
346
  ["--user"], # first option does not have the suffix
347
347
  ["--user-label"], # other options with suffixes
348
348
  ["--user-uuid"],
@@ -351,7 +351,7 @@ describe HammerCLIForeman::DependentSearchablesOptionBuilder do
351
351
  end
352
352
 
353
353
  it "creates correct option types" do
354
- options.map(&:type).must_equal [
354
+ _(options.map(&:type)).must_equal [
355
355
  "USER_NAME",
356
356
  "USER_LABEL",
357
357
  "USER_UUID",
@@ -360,7 +360,7 @@ describe HammerCLIForeman::DependentSearchablesOptionBuilder do
360
360
  end
361
361
 
362
362
  it "creates correct descriptions" do
363
- options.map(&:description).must_equal [
363
+ _(options.map(&:description)).must_equal [
364
364
  "Search by name",
365
365
  "Search by label",
366
366
  "Search by uuid",
@@ -369,7 +369,7 @@ describe HammerCLIForeman::DependentSearchablesOptionBuilder do
369
369
  end
370
370
 
371
371
  it "creates correct attribute readers" do
372
- options.map(&:read_method).must_equal [
372
+ _(options.map(&:read_method)).must_equal [
373
373
  "option_user_name",
374
374
  "option_user_label",
375
375
  "option_user_uuid",
@@ -378,7 +378,7 @@ describe HammerCLIForeman::DependentSearchablesOptionBuilder do
378
378
  end
379
379
 
380
380
  it "none of the options is required" do
381
- options.any?{|opt| opt.required? }.must_equal false
381
+ _(options.any?{|opt| opt.required? }).must_equal false
382
382
  end
383
383
  end
384
384
 
@@ -388,7 +388,7 @@ describe HammerCLIForeman::DependentSearchablesOptionBuilder do
388
388
  let(:builder_params) { {:resource_mapping => {:user => :usr}} }
389
389
 
390
390
  it "renames options" do
391
- options.map(&:switches).must_equal [
391
+ _(options.map(&:switches)).must_equal [
392
392
  ["--usr"], # first option does not have the suffix
393
393
  ["--usr-label"], # other options with suffixes
394
394
  ["--usr-uuid"],
@@ -397,7 +397,7 @@ describe HammerCLIForeman::DependentSearchablesOptionBuilder do
397
397
  end
398
398
 
399
399
  it "renames option types" do
400
- options.map(&:type).must_equal [
400
+ _(options.map(&:type)).must_equal [
401
401
  "USR_NAME",
402
402
  "USR_LABEL",
403
403
  "USR_UUID",
@@ -406,7 +406,7 @@ describe HammerCLIForeman::DependentSearchablesOptionBuilder do
406
406
  end
407
407
 
408
408
  it "keeps option accessor the same" do
409
- options.map(&:attribute_name).must_equal [
409
+ _(options.map(&:attribute_name)).must_equal [
410
410
  "option_user_name",
411
411
  "option_user_label",
412
412
  "option_user_uuid",
@@ -418,7 +418,7 @@ describe HammerCLIForeman::DependentSearchablesOptionBuilder do
418
418
  describe "resources with id parameter in show action" do
419
419
 
420
420
  it "uses descriptions from the action" do
421
- options.map(&:description).must_equal [
421
+ _(options.map(&:description)).must_equal [
422
422
  "Search by name",
423
423
  "Search by label",
424
424
  "Search by uuid",
@@ -443,32 +443,32 @@ describe HammerCLIForeman::SearchablesUpdateOptionBuilder do
443
443
  let(:searchables) { FakeSearchables.new([]) }
444
444
 
445
445
  it "builds no options for empty searchables" do
446
- options.must_equal []
446
+ _(options).must_equal []
447
447
  end
448
448
  end
449
449
 
450
450
  describe "multiple searchables" do
451
451
 
452
452
  it "builds correct switches" do
453
- options.map(&:switches).must_equal [["--new-label"]]
453
+ _(options.map(&:switches)).must_equal [["--new-label"]]
454
454
  end
455
455
 
456
456
  it "builds correct descriptions" do
457
- options.map(&:description).must_equal [" "]
457
+ _(options.map(&:description)).must_equal [" "]
458
458
  end
459
459
 
460
460
  it "builds correct types" do
461
- options.map(&:type).must_equal ["NEW_LABEL"]
461
+ _(options.map(&:type)).must_equal ["NEW_LABEL"]
462
462
  end
463
463
 
464
464
  it "builds correct attribute readers" do
465
- options.map(&:read_method).must_equal [
465
+ _(options.map(&:read_method)).must_equal [
466
466
  "option_new_label"
467
467
  ]
468
468
  end
469
469
 
470
470
  it "none of the options is required" do
471
- options.any?{|opt| opt.required? }.must_equal false
471
+ _(options.any?{|opt| opt.required? }).must_equal false
472
472
  end
473
473
  end
474
474
 
@@ -487,7 +487,7 @@ describe HammerCLIForeman::SearchablesUpdateOptionBuilder do
487
487
  end
488
488
 
489
489
  it "uses descriptions from the action" do
490
- options.map(&:description).must_equal ["DESC"]
490
+ _(options.map(&:description)).must_equal ["DESC"]
491
491
  end
492
492
  end
493
493
  end
@@ -504,11 +504,11 @@ describe HammerCLIForeman::IdOptionBuilder do
504
504
 
505
505
  describe "resources with parameter :id in show action" do
506
506
  it "creates options --id" do
507
- options.map(&:switches).must_equal [["--id"]]
507
+ _(options.map(&:switches)).must_equal [["--id"]]
508
508
  end
509
509
 
510
510
  it "uses description from the :id param" do
511
- options.map(&:description).must_equal ["DESC"]
511
+ _(options.map(&:description)).must_equal ["DESC"]
512
512
  end
513
513
  end
514
514
 
@@ -522,11 +522,11 @@ describe HammerCLIForeman::IdOptionBuilder do
522
522
  end
523
523
 
524
524
  it "creates options --id" do
525
- options.map(&:switches).must_equal [["--id"]]
525
+ _(options.map(&:switches)).must_equal [["--id"]]
526
526
  end
527
527
 
528
528
  it "uses empty description" do
529
- options.map(&:description).must_equal [" "]
529
+ _(options.map(&:description)).must_equal [" "]
530
530
  end
531
531
  end
532
532