hammer_cli 3.7.0 → 3.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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
@@ -22,7 +22,7 @@ describe "constraints" do
22
22
  describe "exist?" do
23
23
  it "throws not implemented error" do
24
24
  constraint = cls.new(options, option_values, [:option_a, :option_b, :option_c])
25
- proc{ constraint.exist? }.must_raise NotImplementedError
25
+ _{ constraint.exist? }.must_raise NotImplementedError
26
26
  end
27
27
  end
28
28
 
@@ -30,7 +30,7 @@ describe "constraints" do
30
30
  it "should raise exception when exist? returns true" do
31
31
  constraint = cls.new(options, option_values, [])
32
32
  constraint.stubs(:exist?).returns(true)
33
- proc{ constraint.rejected }.must_raise HammerCLI::Options::Validators::ValidationError
33
+ _{ constraint.rejected }.must_raise HammerCLI::Options::Validators::ValidationError
34
34
  end
35
35
 
36
36
  it "should raise exception with a message" do
@@ -39,14 +39,14 @@ describe "constraints" do
39
39
  begin
40
40
  constraint.rejected :msg => "CUSTOM MESSAGE"
41
41
  rescue HammerCLI::Options::Validators::ValidationError => e
42
- e.message.must_equal "CUSTOM MESSAGE"
42
+ _(e.message).must_equal "CUSTOM MESSAGE"
43
43
  end
44
44
  end
45
45
 
46
46
  it "should return nil when exist? returns true" do
47
47
  constraint = cls.new(options, option_values, [])
48
48
  constraint.stubs(:exist?).returns(false)
49
- constraint.rejected.must_equal nil
49
+ assert_nil constraint.rejected
50
50
  end
51
51
  end
52
52
 
@@ -54,7 +54,7 @@ describe "constraints" do
54
54
  it "should raise exception when exist? returns true" do
55
55
  constraint = cls.new(options, option_values, [])
56
56
  constraint.stubs(:exist?).returns(false)
57
- proc{ constraint.required }.must_raise HammerCLI::Options::Validators::ValidationError
57
+ _{ constraint.required }.must_raise HammerCLI::Options::Validators::ValidationError
58
58
  end
59
59
 
60
60
  it "should raise exception with a message" do
@@ -63,14 +63,14 @@ describe "constraints" do
63
63
  begin
64
64
  constraint.rejected :msg => "CUSTOM MESSAGE"
65
65
  rescue HammerCLI::Options::Validators::ValidationError => e
66
- e.message.must_equal "CUSTOM MESSAGE"
66
+ _(e.message).must_equal "CUSTOM MESSAGE"
67
67
  end
68
68
  end
69
69
 
70
70
  it "should return nil when exist? returns true" do
71
71
  constraint = cls.new(options, option_values, [])
72
72
  constraint.stubs(:exist?).returns(true)
73
- constraint.required.must_equal nil
73
+ assert_nil constraint.required
74
74
  end
75
75
  end
76
76
 
@@ -84,17 +84,17 @@ describe "constraints" do
84
84
 
85
85
  it "should return true when no options are passed" do
86
86
  constraint = cls.new(options, option_values, [])
87
- constraint.exist?.must_equal true
87
+ _(constraint.exist?).must_equal true
88
88
  end
89
89
 
90
90
  it "should return true when all the options exist" do
91
91
  constraint = cls.new(options, option_values, [:option_a, :option_b, :option_c])
92
- constraint.exist?.must_equal true
92
+ _(constraint.exist?).must_equal true
93
93
  end
94
94
 
95
95
  it "should return false when one of the options is missing" do
96
96
  constraint = cls.new(options, option_values, [:option_a, :option_b, :option_c, :option_unset_d])
97
- constraint.exist?.must_equal false
97
+ _(constraint.exist?).must_equal false
98
98
  end
99
99
  end
100
100
 
@@ -106,50 +106,50 @@ describe "constraints" do
106
106
  describe "exist?" do
107
107
  it "should return true when the option exist" do
108
108
  constraint = cls.new(options, option_values, :option_a)
109
- constraint.exist?.must_equal true
109
+ _(constraint.exist?).must_equal true
110
110
  end
111
111
 
112
112
  it "should return false when the option is missing" do
113
113
  constraint = cls.new(options, option_values, :option_unset_d)
114
- constraint.exist?.must_equal false
114
+ _(constraint.exist?).must_equal false
115
115
  end
116
116
  end
117
117
 
118
118
  describe "#rejected" do
119
119
  it "returns nil when the option is missing" do
120
120
  constraint = cls.new(options, option_values, :option_unset_d)
121
- constraint.rejected.must_equal nil
121
+ assert_nil constraint.rejected
122
122
  end
123
123
 
124
124
  it "raises exception when the option is present" do
125
125
  constraint = cls.new(options, option_values, :option_a)
126
- e = proc{ constraint.rejected }.must_raise HammerCLI::Options::Validators::ValidationError
127
- e.message.must_equal "You can't set option --option-a."
126
+ e = _{ constraint.rejected }.must_raise HammerCLI::Options::Validators::ValidationError
127
+ _(e.message).must_equal "You can't set option --option-a."
128
128
  end
129
129
  end
130
130
 
131
131
  describe "#required" do
132
132
  it "returns nil when the option exist" do
133
133
  constraint = cls.new(options, option_values, :option_a)
134
- constraint.required.must_equal nil
134
+ assert_nil constraint.required
135
135
  end
136
136
 
137
137
  it "raises exception when the option is present" do
138
138
  constraint = cls.new(options, option_values, :option_unset_d)
139
- e = proc{ constraint.required }.must_raise HammerCLI::Options::Validators::ValidationError
140
- e.message.must_equal 'Option --option-unset-d is required.'
139
+ e = _{ constraint.required }.must_raise HammerCLI::Options::Validators::ValidationError
140
+ _(e.message).must_equal 'Option --option-unset-d is required.'
141
141
  end
142
142
  end
143
143
 
144
144
  describe "#value" do
145
145
  it "returns value of the option" do
146
146
  constraint = cls.new(options, option_values, :option_a)
147
- constraint.value.must_equal 1
147
+ _(constraint.value).must_equal 1
148
148
  end
149
149
 
150
150
  it "returns nil when the option is missing" do
151
151
  constraint = cls.new(options, option_values, :option_unset_d)
152
- constraint.value.must_equal nil
152
+ assert_nil constraint.value
153
153
  end
154
154
  end
155
155
  end
@@ -162,17 +162,17 @@ describe "constraints" do
162
162
 
163
163
  it "should return true when no options are passed" do
164
164
  constraint = cls.new(options, option_values, [])
165
- constraint.exist?.must_equal true
165
+ _(constraint.exist?).must_equal true
166
166
  end
167
167
 
168
168
  it "should return true when one of the options exist" do
169
169
  constraint = cls.new(options, option_values, [:option_a, :option_unset_d, :option_unset_e])
170
- constraint.exist?.must_equal true
170
+ _(constraint.exist?).must_equal true
171
171
  end
172
172
 
173
173
  it "should return false when all the options are missing" do
174
174
  constraint = cls.new(options, option_values, [:option_unset_d, :option_unset_e])
175
- constraint.exist?.must_equal false
175
+ _(constraint.exist?).must_equal false
176
176
  end
177
177
  end
178
178
 
@@ -183,51 +183,51 @@ describe "constraints" do
183
183
  let(:cls) { HammerCLI::Options::Validators::DSL::OneOfConstraint }
184
184
 
185
185
  it "raises exception when nothing to check is set" do
186
- e = proc{ cls.new(options, option_values, []) }.must_raise RuntimeError
187
- e.message.must_equal 'Set at least one expected option'
186
+ e = _{ cls.new(options, option_values, []) }.must_raise RuntimeError
187
+ _(e.message).must_equal 'Set at least one expected option'
188
188
  end
189
189
 
190
190
  describe "#exist?" do
191
191
  it "should return true when one of the options exist" do
192
192
  constraint = cls.new(options, option_values, [:option_a, :option_unset_d, :option_unset_e])
193
- constraint.exist?.must_equal true
193
+ _(constraint.exist?).must_equal true
194
194
  end
195
195
 
196
196
  it "should return false when the option isn't present" do
197
197
  constraint = cls.new(options, option_values, [:option_unset_d, :option_unset_e])
198
- constraint.exist?.must_equal false
198
+ _(constraint.exist?).must_equal false
199
199
  end
200
200
 
201
201
  it "should return false when more than one of the options is present" do
202
202
  constraint = cls.new(options, option_values, [:option_a, :option_b])
203
- constraint.exist?.must_equal false
203
+ _(constraint.exist?).must_equal false
204
204
  end
205
205
  end
206
206
 
207
207
  describe "#rejected" do
208
208
  it "raises not implemented exception" do
209
209
  constraint = cls.new(options, option_values, [:option_a, :option_unset_d])
210
- e = proc{ constraint.rejected }.must_raise NotImplementedError
211
- e.message.must_equal '#rejected is unsupported for OneOfConstraint'
210
+ e = _{ constraint.rejected }.must_raise NotImplementedError
211
+ _(e.message).must_equal '#rejected is unsupported for OneOfConstraint'
212
212
  end
213
213
  end
214
214
 
215
215
  describe "#required" do
216
216
  it "returns nil when one of the options exist" do
217
217
  constraint = cls.new(options, option_values, [:option_a, :option_unset_d, :option_unset_e])
218
- constraint.required.must_equal nil
218
+ assert_nil constraint.required
219
219
  end
220
220
 
221
221
  it "raises exception when none of the options is present" do
222
222
  constraint = cls.new(options, option_values, [:option_unset_d, :option_unset_e])
223
- e = proc{ constraint.required }.must_raise HammerCLI::Options::Validators::ValidationError
224
- e.message.must_equal 'One of options --option-unset-d, --option-unset-e is required.'
223
+ e = _{ constraint.required }.must_raise HammerCLI::Options::Validators::ValidationError
224
+ _(e.message).must_equal 'One of options --option-unset-d, --option-unset-e is required.'
225
225
  end
226
226
 
227
227
  it "raises exception when more than one of the options is present" do
228
228
  constraint = cls.new(options, option_values, [:option_a, :option_b])
229
- e = proc{ constraint.required }.must_raise HammerCLI::Options::Validators::ValidationError
230
- e.message.must_equal 'Only one of options --option-a, --option-b can be set.'
229
+ e = _{ constraint.required }.must_raise HammerCLI::Options::Validators::ValidationError
230
+ _(e.message).must_equal 'Only one of options --option-a, --option-b can be set.'
231
231
  end
232
232
  end
233
233
  end
@@ -7,7 +7,7 @@ describe HammerCLI::Output::Adapter::Abstract do
7
7
 
8
8
 
9
9
  it "should have features" do
10
- adapter.features.must_be_kind_of Array
10
+ _(adapter.features).must_be_kind_of Array
11
11
  end
12
12
 
13
13
  class UnknownTestFormatter < HammerCLI::Output::Formatters::FieldFormatter
@@ -21,7 +21,7 @@ describe HammerCLI::Output::Adapter::Abstract do
21
21
  end
22
22
 
23
23
  it "allows default pagination" do
24
- adapter.paginate_by_default?.must_equal true
24
+ _(adapter.paginate_by_default?).must_equal true
25
25
  end
26
26
 
27
27
  it "should filter formatters with incompatible features" do
@@ -52,25 +52,25 @@ describe HammerCLI::Output::Adapter::Abstract do
52
52
 
53
53
  context "messages" do
54
54
  it "should print message to stdout" do
55
- proc { adapter.print_message("MESSAGE") }.must_output(/.*MESSAGE.*/, "")
55
+ _{ adapter.print_message("MESSAGE") }.must_output(/.*MESSAGE.*/, "")
56
56
  end
57
57
 
58
58
  it "should print formatted message with parameters" do
59
- proc { adapter.print_message("MESSAGE %{a}, %{b}", :a => 'A', :b => 'B') }.must_output(/.*MESSAGE A, B.*/, "")
59
+ _{ adapter.print_message("MESSAGE %{a}, %{b}", :a => 'A', :b => 'B') }.must_output(/.*MESSAGE A, B.*/, "")
60
60
  end
61
61
 
62
62
  it 'should print message with nil params' do
63
- proc { adapter.print_message('MESSAGE', nil) }.must_output(/.*MESSAGE.*/, '')
63
+ _{ adapter.print_message('MESSAGE', nil) }.must_output(/.*MESSAGE.*/, '')
64
64
  end
65
65
  end
66
66
 
67
67
  it "should raise not implemented on print_collection" do
68
- proc { adapter.print_collection([], HammerCLI::Output::RecordCollection.new([])) }.must_raise NotImplementedError
68
+ _{ adapter.print_collection([], HammerCLI::Output::RecordCollection.new([])) }.must_raise NotImplementedError
69
69
  end
70
70
 
71
71
  context "error messages" do
72
72
  it "should print error message to stderr" do
73
- proc { adapter.print_error("MESSAGE") }.must_output("", /.*MESSAGE.*/)
73
+ _{ adapter.print_error("MESSAGE") }.must_output("", /.*MESSAGE.*/)
74
74
  end
75
75
 
76
76
  let(:expected_output) { "MESSAGE:\n"+
@@ -85,15 +85,15 @@ describe HammerCLI::Output::Adapter::Abstract do
85
85
  }
86
86
 
87
87
  it "should print list details of error to stderr" do
88
- proc { adapter.print_error("MESSAGE", ["error", "message", "details"]) }.must_output("", expected_output)
88
+ _{ adapter.print_error("MESSAGE", ["error", "message", "details"]) }.must_output("", expected_output)
89
89
  end
90
90
 
91
91
  it "should print string details of error to stderr" do
92
- proc { adapter.print_error("MESSAGE", "error\nmessage\ndetails") }.must_output("", expected_output)
92
+ _{ adapter.print_error("MESSAGE", "error\nmessage\ndetails") }.must_output("", expected_output)
93
93
  end
94
94
 
95
95
  it "should print formatted message with parameters" do
96
- proc {
96
+ _{
97
97
  adapter.print_error("MESSAGE %{a}, %{b}", ["error %{a}", "error %{b}"], :a => 'A', :b => 'B')
98
98
  }.must_output("", expected_formatted_output)
99
99
  end
@@ -6,13 +6,13 @@ describe HammerCLI::Output::Adapter::Base do
6
6
  let(:adapter) { HammerCLI::Output::Adapter::Base.new(context, HammerCLI::Output::Output.formatters) }
7
7
 
8
8
  it "allows default pagination" do
9
- adapter.paginate_by_default?.must_equal true
9
+ _(adapter.paginate_by_default?).must_equal true
10
10
  end
11
11
 
12
12
  context "print_collection" do
13
13
 
14
14
  let(:id) { Fields::Id.new(:path => [:id], :label => "Id") }
15
- let(:name) { Fields::Field.new(:path => [:name], :label => "Name") }
15
+ let(:firstname) { Fields::Field.new(:path => [:name], :label => "Name") }
16
16
  let(:unlabeled) { Fields::Field.new(:path => [:name]) }
17
17
  let(:surname) { Fields::Field.new(:path => [:surname], :label => "Surname") }
18
18
  let(:address_city) { Fields::Field.new(:path => [:address, :city], :label => "City") }
@@ -59,13 +59,13 @@ describe HammerCLI::Output::Adapter::Base do
59
59
  }]}
60
60
 
61
61
  it "should print one field" do
62
- fields = [name]
62
+ fields = [firstname]
63
63
  expected_output = [
64
64
  "Name: John",
65
65
  "\n"
66
66
  ].join("\n")
67
67
 
68
- proc { adapter.print_collection(fields, data) }.must_output(expected_output)
68
+ _{ adapter.print_collection(fields, data) }.must_output(expected_output)
69
69
  end
70
70
 
71
71
  it "doesn't print label when it's nil" do
@@ -75,11 +75,11 @@ describe HammerCLI::Output::Adapter::Base do
75
75
  "\n"
76
76
  ].join("\n")
77
77
 
78
- proc { adapter.print_collection(fields, data) }.must_output(expected_output)
78
+ _{ adapter.print_collection(fields, data) }.must_output(expected_output)
79
79
  end
80
80
 
81
81
  it "aligns multiple fields" do
82
- fields = [name, surname, unlabeled]
82
+ fields = [firstname, surname, unlabeled]
83
83
  expected_output = [
84
84
  "Name: John",
85
85
  "Surname: Doe",
@@ -87,7 +87,7 @@ describe HammerCLI::Output::Adapter::Base do
87
87
  "\n"
88
88
  ].join("\n")
89
89
 
90
- proc { adapter.print_collection(fields, data) }.must_output(expected_output)
90
+ _{ adapter.print_collection(fields, data) }.must_output(expected_output)
91
91
  end
92
92
 
93
93
  it "should field with nested data" do
@@ -97,7 +97,7 @@ describe HammerCLI::Output::Adapter::Base do
97
97
  "\n"
98
98
  ].join("\n")
99
99
 
100
- proc { adapter.print_collection(fields, data) }.must_output(expected_output)
100
+ _{ adapter.print_collection(fields, data) }.must_output(expected_output)
101
101
  end
102
102
 
103
103
  it "should print labeled fields" do
@@ -110,7 +110,7 @@ describe HammerCLI::Output::Adapter::Base do
110
110
  "\n"
111
111
  ].join("\n")
112
112
 
113
- proc { adapter.print_collection(fields, data) }.must_output(expected_output)
113
+ _{ adapter.print_collection(fields, data) }.must_output(expected_output)
114
114
  end
115
115
 
116
116
 
@@ -127,7 +127,7 @@ describe HammerCLI::Output::Adapter::Base do
127
127
  "\n"
128
128
  ].join("\n")
129
129
 
130
- proc { adapter.print_collection(fields, data) }.must_output(expected_output)
130
+ _{ adapter.print_collection(fields, data) }.must_output(expected_output)
131
131
  end
132
132
 
133
133
  it "should print unnumbered collection" do
@@ -143,46 +143,46 @@ describe HammerCLI::Output::Adapter::Base do
143
143
  "\n"
144
144
  ].join("\n")
145
145
 
146
- proc { adapter.print_collection(fields, data) }.must_output(expected_output)
146
+ _{ adapter.print_collection(fields, data) }.must_output(expected_output)
147
147
  end
148
148
 
149
149
  it "hides ids by default" do
150
- fields = [id, name]
150
+ fields = [id, firstname]
151
151
  expected_output = [
152
152
  "Name: John",
153
153
  "\n"
154
154
  ].join("\n")
155
155
 
156
- proc { adapter.print_collection(fields, data) }.must_output(expected_output)
156
+ _{ adapter.print_collection(fields, data) }.must_output(expected_output)
157
157
  end
158
158
 
159
159
  it "skips blank values" do
160
- fields = [name, blank]
160
+ fields = [firstname, blank]
161
161
  expected_output = [
162
162
  "Name: John",
163
163
  "\n"
164
164
  ].join("\n")
165
165
 
166
- proc { adapter.print_collection(fields, data) }.must_output(expected_output)
166
+ _{ adapter.print_collection(fields, data) }.must_output(expected_output)
167
167
  end
168
168
 
169
169
  it "does not print fields which data are missing from api by default" do
170
- fields = [name, login]
170
+ fields = [firstname, login]
171
171
  expected_output = [
172
172
  "Name: John",
173
173
  "\n"
174
174
  ].join("\n")
175
- proc { adapter.print_collection(fields, data) }.must_output(expected_output)
175
+ _{ adapter.print_collection(fields, data) }.must_output(expected_output)
176
176
  end
177
177
 
178
178
  it "prints fields which data are missing from api when field has hide_missing flag set to false" do
179
- fields = [name, missing]
179
+ fields = [firstname, missing]
180
180
  expected_output = [
181
181
  "Name: John",
182
182
  "Missing:",
183
183
  "\n"
184
184
  ].join("\n")
185
- proc { adapter.print_collection(fields, data) }.must_output(expected_output)
185
+ _{ adapter.print_collection(fields, data) }.must_output(expected_output)
186
186
  end
187
187
 
188
188
  it "should print key -> value" do
@@ -196,7 +196,7 @@ describe HammerCLI::Output::Adapter::Base do
196
196
  "\n"
197
197
  ].join("\n")
198
198
 
199
- proc { adapter.print_collection(fields, data) }.must_output(expected_output)
199
+ _{ adapter.print_collection(fields, data) }.must_output(expected_output)
200
200
  end
201
201
 
202
202
  context 'printing by chunks' do
@@ -208,16 +208,16 @@ describe HammerCLI::Output::Adapter::Base do
208
208
  end
209
209
  HammerCLI::Output::RecordCollection.new(collection)
210
210
  end
211
- let(:fields) { [id, name] }
211
+ let(:fields) { [id, firstname] }
212
212
 
213
213
  it 'prints single chunk' do
214
214
  expected_output = collection_count.times.each_with_object([]) do |t, r|
215
215
  r << ["Id: #{t}", "Name: John #{t}", "\n"].join("\n")
216
216
  end.flatten(1).join
217
217
 
218
- proc do
218
+ _{
219
219
  adapter.print_collection(fields, collection_data)
220
- end.must_output(expected_output)
220
+ }.must_output(expected_output)
221
221
  end
222
222
 
223
223
  it 'prints first chunk' do
@@ -225,11 +225,11 @@ describe HammerCLI::Output::Adapter::Base do
225
225
  r << ["Id: #{t}", "Name: John #{t}", "\n"].join("\n")
226
226
  end.flatten(1).join
227
227
 
228
- proc do
228
+ _{
229
229
  adapter.print_collection(
230
230
  fields, collection_data[0...10], current_chunk: :first
231
231
  )
232
- end.must_output(expected_output)
232
+ }.must_output(expected_output)
233
233
  end
234
234
 
235
235
  it 'prints another chunk' do
@@ -237,11 +237,11 @@ describe HammerCLI::Output::Adapter::Base do
237
237
  r << ["Id: #{t}", "Name: John #{t}", "\n"].join("\n")
238
238
  end.flatten(1).join
239
239
 
240
- proc do
240
+ _{
241
241
  adapter.print_collection(
242
242
  fields, collection_data[10...20], current_chunk: :another
243
243
  )
244
- end.must_output(expected_output)
244
+ }.must_output(expected_output)
245
245
  end
246
246
 
247
247
  it 'prints last chunk' do
@@ -249,11 +249,11 @@ describe HammerCLI::Output::Adapter::Base do
249
249
  r << ["Id: #{t}", "Name: John #{t}", "\n"].join("\n")
250
250
  end.flatten(1).join
251
251
 
252
- proc do
252
+ _{
253
253
  adapter.print_collection(
254
254
  fields, collection_data[20...30], current_chunk: :last
255
255
  )
256
- end.must_output(expected_output)
256
+ }.must_output(expected_output)
257
257
  end
258
258
  end
259
259
 
@@ -262,14 +262,14 @@ describe HammerCLI::Output::Adapter::Base do
262
262
  let(:context) { {:show_ids => true} }
263
263
 
264
264
  it "shows ids if it's required in the context" do
265
- fields = [id, name]
265
+ fields = [id, firstname]
266
266
  expected_output = [
267
267
  "Id: 112",
268
268
  "Name: John",
269
269
  "\n"
270
270
  ].join("\n")
271
271
 
272
- proc { adapter.print_collection(fields, data) }.must_output(expected_output)
272
+ _{ adapter.print_collection(fields, data) }.must_output(expected_output)
273
273
  end
274
274
 
275
275
  end
@@ -280,13 +280,13 @@ describe HammerCLI::Output::Adapter::Base do
280
280
  let(:context) { {:output_file => tempfile} }
281
281
 
282
282
  it "should not print to stdout when --output-file is set" do
283
- fields = [name]
283
+ fields = [firstname]
284
284
 
285
- proc { adapter.print_collection(fields, data) }.must_output("")
285
+ _{ adapter.print_collection(fields, data) }.must_output("")
286
286
  end
287
287
 
288
288
  it "should print to file if --output-file is set" do
289
- fields = [name]
289
+ fields = [firstname]
290
290
  expected_output = [
291
291
  "Name: John",
292
292
  "\n"
@@ -294,14 +294,14 @@ describe HammerCLI::Output::Adapter::Base do
294
294
 
295
295
  adapter.print_collection(fields, data)
296
296
  tempfile.close
297
- IO.read(tempfile.path).must_equal(expected_output)
297
+ _(IO.read(tempfile.path)).must_equal(expected_output)
298
298
  end
299
299
 
300
300
  end
301
301
 
302
302
  context 'print_message' do
303
303
  it 'should print message with nil params' do
304
- proc { adapter.print_message('MESSAGE', nil) }.must_output(/.*MESSAGE.*/, '')
304
+ _{ adapter.print_message('MESSAGE', nil) }.must_output(/.*MESSAGE.*/, '')
305
305
  end
306
306
  end
307
307
  end