hammer_cli 3.7.0 → 3.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/bin/hammer +1 -6
  3. data/doc/release_notes.md +15 -0
  4. data/lib/hammer_cli/help/builder.rb +1 -2
  5. data/lib/hammer_cli/i18n/find_task.rb +88 -0
  6. data/lib/hammer_cli/i18n.rb +4 -0
  7. data/lib/hammer_cli/options/normalizers.rb +2 -5
  8. data/lib/hammer_cli/settings.rb +7 -0
  9. data/lib/hammer_cli/task_helper.rb +84 -0
  10. data/lib/hammer_cli/testing/output_matchers.rb +1 -1
  11. data/lib/hammer_cli/utils.rb +1 -1
  12. data/lib/hammer_cli/version.rb +1 -1
  13. data/locale/Makefile.def +29 -7
  14. data/locale/ca/LC_MESSAGES/hammer-cli.mo +0 -0
  15. data/locale/cs_CZ/LC_MESSAGES/hammer-cli.mo +0 -0
  16. data/locale/de/LC_MESSAGES/hammer-cli.mo +0 -0
  17. data/locale/en/LC_MESSAGES/hammer-cli.mo +0 -0
  18. data/locale/en_GB/LC_MESSAGES/hammer-cli.mo +0 -0
  19. data/locale/es/LC_MESSAGES/hammer-cli.mo +0 -0
  20. data/locale/fr/LC_MESSAGES/hammer-cli.mo +0 -0
  21. data/locale/it/LC_MESSAGES/hammer-cli.mo +0 -0
  22. data/locale/ja/LC_MESSAGES/hammer-cli.mo +0 -0
  23. data/locale/ka/LC_MESSAGES/hammer-cli.mo +0 -0
  24. data/locale/ko/LC_MESSAGES/hammer-cli.mo +0 -0
  25. data/locale/pt_BR/LC_MESSAGES/hammer-cli.mo +0 -0
  26. data/locale/ru/LC_MESSAGES/hammer-cli.mo +0 -0
  27. data/locale/zh_CN/LC_MESSAGES/hammer-cli.mo +0 -0
  28. data/locale/zh_TW/LC_MESSAGES/hammer-cli.mo +0 -0
  29. data/man/hammer.1.gz +0 -0
  30. data/test/functional/help_test.rb +1 -1
  31. data/test/test_helper.rb +1 -1
  32. data/test/unit/abstract_test.rb +54 -54
  33. data/test/unit/apipie/command_test.rb +26 -27
  34. data/test/unit/apipie/option_builder_test.rb +28 -28
  35. data/test/unit/apipie/option_definition_test.rb +5 -5
  36. data/test/unit/apipie/test_helper.rb +3 -0
  37. data/test/unit/bash_test.rb +21 -21
  38. data/test/unit/command_extensions_test.rb +68 -68
  39. data/test/unit/completer_test.rb +57 -57
  40. data/test/unit/csv_parser_test.rb +12 -12
  41. data/test/unit/defaults_test.rb +3 -3
  42. data/test/unit/help/builder_test.rb +7 -7
  43. data/test/unit/help/definition/abstract_item_test.rb +2 -2
  44. data/test/unit/help/definition/list_test.rb +2 -2
  45. data/test/unit/help/definition/note_test.rb +2 -2
  46. data/test/unit/help/definition/section_test.rb +2 -2
  47. data/test/unit/help/definition/text_test.rb +2 -2
  48. data/test/unit/help/definition_test.rb +36 -36
  49. data/test/unit/help/text_builder_test.rb +39 -39
  50. data/test/unit/history_test.rb +6 -6
  51. data/test/unit/i18n_test.rb +2 -2
  52. data/test/unit/logger_test.rb +1 -1
  53. data/test/unit/main_test.rb +7 -7
  54. data/test/unit/modules_test.rb +24 -25
  55. data/test/unit/option_builder_test.rb +1 -1
  56. data/test/unit/options/matcher_test.rb +15 -15
  57. data/test/unit/options/normalizers_test.rb +92 -88
  58. data/test/unit/options/option_definition_test.rb +11 -11
  59. data/test/unit/options/option_family_test.rb +7 -7
  60. data/test/unit/options/validators/dsl_test.rb +35 -35
  61. data/test/unit/output/adapter/abstract_test.rb +10 -10
  62. data/test/unit/output/adapter/base_test.rb +36 -36
  63. data/test/unit/output/adapter/csv_test.rb +38 -38
  64. data/test/unit/output/adapter/json_test.rb +38 -38
  65. data/test/unit/output/adapter/table_test.rb +42 -50
  66. data/test/unit/output/adapter/yaml_test.rb +38 -38
  67. data/test/unit/output/definition_test.rb +43 -43
  68. data/test/unit/output/dsl_test.rb +19 -19
  69. data/test/unit/output/field_filter_test.rb +10 -10
  70. data/test/unit/output/fields_test.rb +27 -27
  71. data/test/unit/output/formatters_test.rb +39 -39
  72. data/test/unit/output/output_test.rb +14 -14
  73. data/test/unit/output/record_collection_test.rb +18 -18
  74. data/test/unit/settings_test.rb +35 -35
  75. data/test/unit/utils_test.rb +30 -27
  76. metadata +33 -44
@@ -15,19 +15,19 @@ describe HammerCLI::Output::Definition do
15
15
  describe "empty?" do
16
16
 
17
17
  it "returns true for empty definition" do
18
- definition.empty?.must_equal true
18
+ _(definition.empty?).must_equal true
19
19
  end
20
20
 
21
21
  it "returns false for definition with fields" do
22
22
  definition.fields << Fields::Field.new
23
- definition.empty?.must_equal false
23
+ _(definition.empty?).must_equal false
24
24
  end
25
25
 
26
26
  end
27
27
 
28
28
  it "should be able to add field" do
29
29
  definition.fields << Fields::Field.new
30
- field_count.must_equal 1
30
+ _(field_count).must_equal 1
31
31
  end
32
32
 
33
33
  it "append should allow to add data from another definition" do
@@ -36,14 +36,14 @@ describe HammerCLI::Output::Definition do
36
36
  another_def.fields << Fields::Field.new
37
37
 
38
38
  definition.append another_def.fields
39
- field_count.must_equal another_def.fields.length
40
- definition.fields.must_equal another_def.fields
39
+ _(field_count).must_equal another_def.fields.length
40
+ _(definition.fields).must_equal another_def.fields
41
41
  end
42
42
 
43
43
  it 'clear should delete all fields' do
44
44
  definition.fields << Fields::Field.new
45
45
  definition.clear
46
- definition.empty?.must_equal true
46
+ _(definition.empty?).must_equal true
47
47
  end
48
48
 
49
49
  describe 'insert' do
@@ -56,23 +56,23 @@ describe HammerCLI::Output::Definition do
56
56
  definition.insert(:before, :id1, new_field)
57
57
  end
58
58
 
59
- field_count.must_equal 0
59
+ _(field_count).must_equal 0
60
60
  end
61
61
 
62
62
  it 'should insert new specified field before the old one' do
63
63
  definition.fields << Fields::Field.new(id: :id1, label: 'oldfield')
64
64
  definition.insert(:before, :id1, new_field)
65
65
 
66
- definition.fields.first.label.must_equal new_field.label
67
- field_count.must_equal 2
66
+ _(definition.fields.first.label).must_equal new_field.label
67
+ _(field_count).must_equal 2
68
68
  end
69
69
 
70
70
  it 'should insert before field with few new specified' do
71
71
  definition.fields << Fields::Field.new(id: :id1, label: 'oldfield')
72
72
  definition.insert(:before, :id1, new_fields)
73
73
 
74
- definition.fields.first.label.must_equal new_field.label
75
- field_count.must_equal 3
74
+ _(definition.fields.first.label).must_equal new_field.label
75
+ _(field_count).must_equal 3
76
76
  end
77
77
 
78
78
  it 'should accept block with new fields' do
@@ -82,8 +82,8 @@ describe HammerCLI::Output::Definition do
82
82
  field nil, 'newfield2'
83
83
  end
84
84
 
85
- definition.fields.first.label.must_equal new_field.label
86
- field_count.must_equal 3
85
+ _(definition.fields.first.label).must_equal new_field.label
86
+ _(field_count).must_equal 3
87
87
  end
88
88
 
89
89
  it 'should accept both block and new fields' do
@@ -93,8 +93,8 @@ describe HammerCLI::Output::Definition do
93
93
  field nil, 'newfield4'
94
94
  end
95
95
 
96
- definition.fields.first.label.must_equal new_field.label
97
- field_count.must_equal 5
96
+ _(definition.fields.first.label).must_equal new_field.label
97
+ _(field_count).must_equal 5
98
98
  end
99
99
 
100
100
  it 'should work with labels' do
@@ -102,8 +102,8 @@ describe HammerCLI::Output::Definition do
102
102
  definition.fields << label_field
103
103
  definition.insert(:before, label_field.label, new_fields)
104
104
 
105
- definition.fields.first.label.must_equal new_field.label
106
- field_count.must_equal 3
105
+ _(definition.fields.first.label).must_equal new_field.label
106
+ _(field_count).must_equal 3
107
107
  end
108
108
  end
109
109
 
@@ -114,23 +114,23 @@ describe HammerCLI::Output::Definition do
114
114
  definition.insert(:after, :id1, new_field)
115
115
  end
116
116
 
117
- field_count.must_equal 0
117
+ _(field_count).must_equal 0
118
118
  end
119
119
 
120
120
  it 'should insert new specified field after the old one' do
121
121
  definition.fields << Fields::Field.new(id: :id1, label: 'oldfield')
122
122
  definition.insert(:after, :id1, new_field)
123
123
 
124
- definition.fields.first.label.must_equal 'oldfield'
125
- field_count.must_equal 2
124
+ _(definition.fields.first.label).must_equal 'oldfield'
125
+ _(field_count).must_equal 2
126
126
  end
127
127
 
128
128
  it 'should insert after field with few new specified' do
129
129
  definition.fields << Fields::Field.new(id: :id1, label: 'oldfield')
130
130
  definition.insert(:after, :id1, new_fields)
131
131
 
132
- definition.fields.first.label.must_equal 'oldfield'
133
- field_count.must_equal 3
132
+ _(definition.fields.first.label).must_equal 'oldfield'
133
+ _(field_count).must_equal 3
134
134
  end
135
135
 
136
136
  it 'should accept block with new fields' do
@@ -140,8 +140,8 @@ describe HammerCLI::Output::Definition do
140
140
  field nil, 'newfield2'
141
141
  end
142
142
 
143
- definition.fields.first.label.must_equal 'oldfield'
144
- field_count.must_equal 3
143
+ _(definition.fields.first.label).must_equal 'oldfield'
144
+ _(field_count).must_equal 3
145
145
  end
146
146
 
147
147
  it 'should accept both block and new fields' do
@@ -151,8 +151,8 @@ describe HammerCLI::Output::Definition do
151
151
  field nil, 'newfield4'
152
152
  end
153
153
 
154
- definition.fields.first.label.must_equal 'oldfield'
155
- field_count.must_equal 5
154
+ _(definition.fields.first.label).must_equal 'oldfield'
155
+ _(field_count).must_equal 5
156
156
  end
157
157
 
158
158
  it 'should work with labels' do
@@ -160,8 +160,8 @@ describe HammerCLI::Output::Definition do
160
160
  definition.fields << label_field
161
161
  definition.insert(:after, label_field.label, new_fields)
162
162
 
163
- definition.fields.first.label.must_equal label_field.label
164
- field_count.must_equal 3
163
+ _(definition.fields.first.label).must_equal label_field.label
164
+ _(field_count).must_equal 3
165
165
  end
166
166
  end
167
167
 
@@ -172,23 +172,23 @@ describe HammerCLI::Output::Definition do
172
172
  definition.insert(:replace, :id1, new_field)
173
173
  end
174
174
 
175
- field_count.must_equal 0
175
+ _(field_count).must_equal 0
176
176
  end
177
177
 
178
178
  it 'should replace field with new specified' do
179
179
  definition.fields << Fields::Field.new(id: :id1, label: 'oldfield')
180
180
  definition.insert(:replace, :id1, new_field)
181
181
 
182
- definition.fields.first.label.must_equal new_field.label
183
- field_count.must_equal 1
182
+ _(definition.fields.first.label).must_equal new_field.label
183
+ _(field_count).must_equal 1
184
184
  end
185
185
 
186
186
  it 'should replace field with few new specified' do
187
187
  definition.fields << Fields::Field.new(id: :id1, label: 'oldfield')
188
188
  definition.insert(:replace, :id1, new_fields)
189
189
 
190
- definition.fields.first.label.must_equal new_field.label
191
- field_count.must_equal 2
190
+ _(definition.fields.first.label).must_equal new_field.label
191
+ _(field_count).must_equal 2
192
192
  end
193
193
 
194
194
  it 'should accept block with new fields' do
@@ -198,7 +198,7 @@ describe HammerCLI::Output::Definition do
198
198
  field nil, 'newfield2'
199
199
  end
200
200
 
201
- definition.fields.first.label.must_equal new_field.label
201
+ _(definition.fields.first.label).must_equal new_field.label
202
202
  end
203
203
 
204
204
  it 'should accept both block and new fields' do
@@ -208,7 +208,7 @@ describe HammerCLI::Output::Definition do
208
208
  field nil, 'newfield4'
209
209
  end
210
210
 
211
- field_count.must_equal 4
211
+ _(field_count).must_equal 4
212
212
  end
213
213
 
214
214
  it 'should work with labels' do
@@ -216,7 +216,7 @@ describe HammerCLI::Output::Definition do
216
216
  definition.fields << label_field
217
217
  definition.insert(:replace, label_field.label, new_fields)
218
218
 
219
- field_count.must_equal 2
219
+ _(field_count).must_equal 2
220
220
  end
221
221
  end
222
222
  end
@@ -224,21 +224,21 @@ describe HammerCLI::Output::Definition do
224
224
  describe 'find_field' do
225
225
  it 'should find a field' do
226
226
  definition.fields += [new_field, label_field]
227
- definition.find_field(:new_id).must_equal new_field
227
+ _(definition.find_field(:new_id)).must_equal new_field
228
228
  end
229
229
 
230
230
  it 'should find a field in field output definition' do
231
231
  definition.fields += [label_field, cont_field]
232
232
  nested_definition = definition.find_field(:id1).output_definition
233
233
  nested_definition.fields << new_field
234
- nested_definition.find_field(:new_id).must_equal new_field
234
+ _(nested_definition.find_field(:new_id)).must_equal new_field
235
235
  end
236
236
  end
237
237
 
238
238
  describe 'at' do
239
239
  it 'should return self if no specified path or empty' do
240
- definition.at.must_equal definition
241
- definition.at([]).must_equal definition
240
+ _(definition.at).must_equal definition
241
+ _(definition.at([])).must_equal definition
242
242
  end
243
243
 
244
244
  it 'should return output definition of specified field with path' do
@@ -246,7 +246,7 @@ describe HammerCLI::Output::Definition do
246
246
  definition.fields << cont_field
247
247
  path = [cont_field.id]
248
248
 
249
- definition.at(path).must_equal cont_field.output_definition
249
+ _(definition.at(path)).must_equal cont_field.output_definition
250
250
  end
251
251
 
252
252
  it 'should work with labels' do
@@ -254,7 +254,7 @@ describe HammerCLI::Output::Definition do
254
254
  definition.fields << label_field
255
255
  path = ['labelfield']
256
256
 
257
- definition.at(path).must_equal label_field.output_definition
257
+ _(definition.at(path)).must_equal label_field.output_definition
258
258
  end
259
259
  end
260
260
 
@@ -274,7 +274,7 @@ describe HammerCLI::Output::Definition do
274
274
  "Cf/bca | | | x \n" \
275
275
  "---------|-----|---------|----\n"
276
276
 
277
- definition.sets_table.must_equal sets_table
277
+ _(definition.sets_table).must_equal sets_table
278
278
  end
279
279
  end
280
280
  end
@@ -17,7 +17,7 @@ describe HammerCLI::Output::Dsl do
17
17
  let(:last_field) { dsl.fields[-1] }
18
18
 
19
19
  it "should be empty after initialization" do
20
- dsl.fields.length.must_equal 0
20
+ _(dsl.fields.length).must_equal 0
21
21
  end
22
22
 
23
23
  describe "fields" do
@@ -25,14 +25,14 @@ describe HammerCLI::Output::Dsl do
25
25
  dsl.build do
26
26
  field :f, "F"
27
27
  end
28
- first_field.class.must_equal Fields::Field
28
+ _(first_field.class).must_equal Fields::Field
29
29
  end
30
30
 
31
31
  it "should create field of desired type" do
32
32
  dsl.build do
33
33
  field :f, "F", CustomFieldType
34
34
  end
35
- first_field.class.must_equal CustomFieldType
35
+ _(first_field.class).must_equal CustomFieldType
36
36
  end
37
37
 
38
38
  it "should store all field details" do
@@ -40,9 +40,9 @@ describe HammerCLI::Output::Dsl do
40
40
  field :f, "F"
41
41
  end
42
42
 
43
- first_field.must_equal last_field
44
- first_field.path.must_equal [:f]
45
- first_field.label.must_equal "F"
43
+ _(first_field).must_equal last_field
44
+ _(first_field.path).must_equal [:f]
45
+ _(first_field.label).must_equal "F"
46
46
  end
47
47
 
48
48
  it "can define multiple fields" do
@@ -52,7 +52,7 @@ describe HammerCLI::Output::Dsl do
52
52
  field :email, "Email"
53
53
  end
54
54
 
55
- dsl.fields.length.must_equal 3
55
+ _(dsl.fields.length).must_equal 3
56
56
  end
57
57
  end
58
58
 
@@ -64,14 +64,14 @@ describe HammerCLI::Output::Dsl do
64
64
  dsl.build do
65
65
  custom_field CustomFieldType, :a => 1, :b => 2
66
66
  end
67
- first_field.class.must_equal CustomFieldType
67
+ _(first_field.class).must_equal CustomFieldType
68
68
  end
69
69
 
70
70
  it "passes all options to the field instance" do
71
71
  dsl.build do
72
72
  custom_field CustomFieldType, :a => 1, :b => 2
73
73
  end
74
- first_field.options.must_equal options
74
+ _(first_field.options).must_equal options
75
75
  end
76
76
 
77
77
  end
@@ -84,7 +84,7 @@ describe HammerCLI::Output::Dsl do
84
84
  field :email, "Email"
85
85
  end
86
86
  end
87
- last_field.path.must_equal [:key1, :email]
87
+ _(last_field.path).must_equal [:key1, :email]
88
88
  end
89
89
 
90
90
  it "path can be nil to handle the parent structure" do
@@ -93,7 +93,7 @@ describe HammerCLI::Output::Dsl do
93
93
  field nil, "Email"
94
94
  end
95
95
  end
96
- last_field.path.must_equal [:key1]
96
+ _(last_field.path).must_equal [:key1]
97
97
  end
98
98
 
99
99
  it "from can be nested" do
@@ -107,8 +107,8 @@ describe HammerCLI::Output::Dsl do
107
107
  end
108
108
  end
109
109
  end
110
- first_field.path.must_equal [:key1, :key2, :key3, :name]
111
- last_field.path.must_equal [:key1, :key2, :email]
110
+ _(first_field.path).must_equal [:key1, :key2, :key3, :name]
111
+ _(last_field.path).must_equal [:key1, :key2, :email]
112
112
  end
113
113
 
114
114
  end
@@ -120,7 +120,7 @@ describe HammerCLI::Output::Dsl do
120
120
  dsl.build do
121
121
  label "Label"
122
122
  end
123
- first_field.class.must_equal Fields::Label
123
+ _(first_field.class).must_equal Fields::Label
124
124
  end
125
125
 
126
126
  it "allows to define subfields with dsl" do
@@ -131,7 +131,7 @@ describe HammerCLI::Output::Dsl do
131
131
  end
132
132
  end
133
133
 
134
- first_field.fields.map(&:label).must_equal ["A", "B"]
134
+ _(first_field.fields.map(&:label)).must_equal ["A", "B"]
135
135
  end
136
136
 
137
137
  it "sets correct path to subfields" do
@@ -144,7 +144,7 @@ describe HammerCLI::Output::Dsl do
144
144
  end
145
145
  end
146
146
 
147
- first_field.fields.map(&:path).must_equal [[:a], [:b]]
147
+ _(first_field.fields.map(&:path)).must_equal [[:a], [:b]]
148
148
  end
149
149
 
150
150
  end
@@ -156,7 +156,7 @@ describe HammerCLI::Output::Dsl do
156
156
  dsl.build do
157
157
  collection :f, "F"
158
158
  end
159
- first_field.class.must_equal Fields::Collection
159
+ _(first_field.class).must_equal Fields::Collection
160
160
  end
161
161
 
162
162
  it "allows to define subfields with dsl" do
@@ -167,7 +167,7 @@ describe HammerCLI::Output::Dsl do
167
167
  end
168
168
  end
169
169
 
170
- first_field.fields.map(&:label).must_equal ["A", "B"]
170
+ _(first_field.fields.map(&:label)).must_equal ["A", "B"]
171
171
  end
172
172
 
173
173
  it "sets correct path to subfields" do
@@ -178,7 +178,7 @@ describe HammerCLI::Output::Dsl do
178
178
  end
179
179
  end
180
180
 
181
- first_field.fields.map(&:path).must_equal [[:a], [:b]]
181
+ _(first_field.fields.map(&:path)).must_equal [[:a], [:b]]
182
182
  end
183
183
 
184
184
  end
@@ -22,51 +22,51 @@ describe HammerCLI::Output::FieldFilter do
22
22
 
23
23
  it 'lets all fields go by default' do
24
24
  f = HammerCLI::Output::FieldFilter.new(fields)
25
- f.filtered_fields.map(&:label).sort.must_equal ['field', 'collection', 'id'].sort
25
+ _(f.filtered_fields.map(&:label).sort).must_equal ['field', 'collection', 'id'].sort
26
26
  end
27
27
 
28
28
  it 'filters fields by class' do
29
29
  f = HammerCLI::Output::FieldFilter.new(fields, classes_filter: [Fields::Id])
30
- f.filter_by_classes.filtered_fields.map(&:label).sort.must_equal ['field', 'collection'].sort
30
+ _(f.filter_by_classes.filtered_fields.map(&:label).sort).must_equal ['field', 'collection'].sort
31
31
  end
32
32
 
33
33
  it 'filters fields by superclass' do
34
34
  f = HammerCLI::Output::FieldFilter.new(fields, classes_filter: [Fields::ContainerField])
35
- f.filter_by_classes.filtered_fields.map(&:label).sort.must_equal ['field', 'id'].sort
35
+ _(f.filter_by_classes.filtered_fields.map(&:label).sort).must_equal ['field', 'id'].sort
36
36
  end
37
37
 
38
38
  it 'filters fields by sets' do
39
39
  f = HammerCLI::Output::FieldFilter.new(fields, sets_filter: ['THIN'])
40
- f.filter_by_sets.filtered_fields.map(&:label).must_equal ['id']
40
+ _(f.filter_by_sets.filtered_fields.map(&:label)).must_equal ['id']
41
41
  end
42
42
 
43
43
  it 'filters fields by sets with labels' do
44
44
  f = HammerCLI::Output::FieldFilter.new(fields, sets_filter: ['THIN', 'field'])
45
- f.filter_by_sets.filtered_fields.map(&:label).sort.must_equal ['field', 'id'].sort
45
+ _(f.filter_by_sets.filtered_fields.map(&:label).sort).must_equal ['field', 'id'].sort
46
46
  end
47
47
 
48
48
  it 'filters by full labels' do
49
49
  f = HammerCLI::Output::FieldFilter.new(container_fields, sets_filter: ['container/first'])
50
- f.filter_by_sets.filtered_fields.first.fields.map(&:label).must_equal ['first']
50
+ _(f.filter_by_sets.filtered_fields.first.fields.map(&:label)).must_equal ['first']
51
51
  end
52
52
 
53
53
  it 'filters by superclass labels' do
54
54
  f = HammerCLI::Output::FieldFilter.new(container_fields, sets_filter: ['container'])
55
- f.filter_by_sets.filtered_fields.first.fields.map(&:label).must_equal ['first', 'second']
55
+ _(f.filter_by_sets.filtered_fields.first.fields.map(&:label)).must_equal ['first', 'second']
56
56
  end
57
57
 
58
58
  it 'filters by labels with wildcards' do
59
59
  f = HammerCLI::Output::FieldFilter.new(container_fields, sets_filter: ['container/f*'])
60
- f.filter_by_sets.filtered_fields.first.fields.map(&:label).must_equal ['first']
60
+ _(f.filter_by_sets.filtered_fields.first.fields.map(&:label)).must_equal ['first']
61
61
  end
62
62
 
63
63
  it 'allows chained filtering' do
64
64
  f = HammerCLI::Output::FieldFilter.new(fields, sets_filter: ['THIN'], classes_filter: [Fields::Id])
65
- f.filter_by_classes.filter_by_sets.filtered_fields.map(&:label).must_equal []
65
+ _(f.filter_by_classes.filter_by_sets.filtered_fields.map(&:label)).must_equal []
66
66
  end
67
67
 
68
68
  it 'filters fields by data' do
69
69
  f = HammerCLI::Output::FieldFilter.new(fields)
70
- f.filter_by_data(nil).filtered_fields.map(&:label).sort.must_equal ['id', 'collection'].sort
70
+ _(f.filter_by_data(nil).filtered_fields.map(&:label).sort).must_equal ['id', 'collection'].sort
71
71
  end
72
72
  end
@@ -11,15 +11,15 @@ describe Fields::Field do
11
11
 
12
12
 
13
13
  it "stores label from constructor" do
14
- field.label.must_equal label
14
+ _(field.label).must_equal label
15
15
  end
16
16
 
17
17
  it "stores path from constructor" do
18
- field.path.must_equal path
18
+ _(field.path).must_equal path
19
19
  end
20
20
 
21
21
  it "default path should be empty array" do
22
- Fields::Field.new.path.must_equal []
22
+ _(Fields::Field.new.path).must_equal []
23
23
  end
24
24
 
25
25
  describe "parameters" do
@@ -30,7 +30,7 @@ describe Fields::Field do
30
30
  :path => path,
31
31
  :some => :parameter
32
32
  }
33
- field.parameters.must_equal expected_params
33
+ _(field.parameters).must_equal expected_params
34
34
  end
35
35
 
36
36
  end
@@ -40,11 +40,11 @@ describe Fields::Field do
40
40
  context "blank is allowed" do
41
41
 
42
42
  it "returns false the value is nil" do
43
- field.display?(nil).must_equal true
43
+ _(field.display?(nil)).must_equal true
44
44
  end
45
45
 
46
46
  it "returns true when there is some data under the path" do
47
- field.display?("some value").must_equal true
47
+ _(field.display?("some value")).must_equal true
48
48
  end
49
49
  end
50
50
 
@@ -52,11 +52,11 @@ describe Fields::Field do
52
52
  context "blank is not allowed" do
53
53
 
54
54
  it "returns false the value is nil" do
55
- blank_field.display?(nil).must_equal false
55
+ _(blank_field.display?(nil)).must_equal false
56
56
  end
57
57
 
58
58
  it "returns true when there is some data under the path" do
59
- blank_field.display?("some value").must_equal true
59
+ _(blank_field.display?("some value")).must_equal true
60
60
  end
61
61
  end
62
62
 
@@ -65,11 +65,11 @@ describe Fields::Field do
65
65
  describe "hide_blank?" do
66
66
 
67
67
  it "defaults to false" do
68
- Fields::Field.new.hide_blank?.must_equal false
68
+ _(Fields::Field.new.hide_blank?).must_equal false
69
69
  end
70
70
 
71
71
  it "can be set to true in the constructor" do
72
- blank_field.hide_blank?.must_equal true
72
+ _(blank_field.hide_blank?).must_equal true
73
73
  end
74
74
 
75
75
  end
@@ -85,19 +85,19 @@ describe Fields::ContainerField do
85
85
  let(:field) { Fields::ContainerField.new :label => "Label" }
86
86
 
87
87
  it "returns false the value is nil" do
88
- field.display?(nil).must_equal true
88
+ _(field.display?(nil)).must_equal true
89
89
  end
90
90
 
91
91
  it "returns false the value is empty array" do
92
- field.display?([]).must_equal true
92
+ _(field.display?([])).must_equal true
93
93
  end
94
94
 
95
95
  it "returns false the value is empty hash" do
96
- field.display?({}).must_equal true
96
+ _(field.display?({})).must_equal true
97
97
  end
98
98
 
99
99
  it "returns true when there is some data under the path" do
100
- field.display?(["some value"]).must_equal true
100
+ _(field.display?(["some value"])).must_equal true
101
101
  end
102
102
 
103
103
  end
@@ -106,19 +106,19 @@ describe Fields::ContainerField do
106
106
  let(:field) { Fields::ContainerField.new :label => "Label", :hide_blank => true }
107
107
 
108
108
  it "returns false the value is nil" do
109
- field.display?(nil).must_equal false
109
+ _(field.display?(nil)).must_equal false
110
110
  end
111
111
 
112
112
  it "returns false the value is empty array" do
113
- field.display?([]).must_equal false
113
+ _(field.display?([])).must_equal false
114
114
  end
115
115
 
116
116
  it "returns false the value is empty hash" do
117
- field.display?({}).must_equal false
117
+ _(field.display?({})).must_equal false
118
118
  end
119
119
 
120
120
  it "returns true when there is some data under the path" do
121
- field.display?(["some value"]).must_equal true
121
+ _(field.display?(["some value"])).must_equal true
122
122
  end
123
123
 
124
124
  end
@@ -141,19 +141,19 @@ describe Fields::Label do
141
141
  end
142
142
 
143
143
  it "returns true when all the keys are present" do
144
- field.display?({:a => 1, :b => 2}).must_equal true
144
+ _(field.display?({:a => 1, :b => 2})).must_equal true
145
145
  end
146
146
 
147
147
  it "returns true when some of the keys are present" do
148
- field.display?({:a => 1}).must_equal true
148
+ _(field.display?({:a => 1})).must_equal true
149
149
  end
150
150
 
151
151
  it "returns true the hash is empty" do
152
- field.display?({}).must_equal true
152
+ _(field.display?({})).must_equal true
153
153
  end
154
154
 
155
155
  it "returns true the hash does not contain the required keys" do
156
- field.display?({:c => 3}).must_equal true
156
+ _(field.display?({:c => 3})).must_equal true
157
157
  end
158
158
 
159
159
  end
@@ -167,23 +167,23 @@ describe Fields::Label do
167
167
  end
168
168
 
169
169
  it "returns true when all subfields are displayed" do
170
- field.display?({:a => 1, :b => 2}).must_equal true
170
+ _(field.display?({:a => 1, :b => 2})).must_equal true
171
171
  end
172
172
 
173
173
  it "returns true when at least one or the subfields is displayed" do
174
- field.display?({:a => 1}).must_equal true
174
+ _(field.display?({:a => 1})).must_equal true
175
175
  end
176
176
 
177
177
  it "returns false when none of the subfieldsis displayed" do
178
- field.display?({:c => 3}).must_equal false
178
+ _(field.display?({:c => 3})).must_equal false
179
179
  end
180
180
 
181
181
  it "returns false when the value is empty hash" do
182
- field.display?({}).must_equal false
182
+ _(field.display?({})).must_equal false
183
183
  end
184
184
 
185
185
  it "returns false when the value is nil" do
186
- field.display?(nil).must_equal false
186
+ _(field.display?(nil)).must_equal false
187
187
  end
188
188
  end
189
189