rmuh 0.1.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.
- checksums.yaml +7 -0
- data/.gitignore +33 -0
- data/.rspec +2 -0
- data/.travis.yml +8 -0
- data/Gemfile +4 -0
- data/LICENSE +21 -0
- data/README.md +19 -0
- data/Rakefile +15 -0
- data/lib/rmuh.rb +22 -0
- data/lib/rmuh/rpt/log/fetch.rb +56 -0
- data/lib/rmuh/rpt/log/parsers/base.rb +29 -0
- data/lib/rmuh/rpt/log/parsers/unitedoperationslog.rb +94 -0
- data/lib/rmuh/rpt/log/parsers/unitedoperationsrpt.rb +65 -0
- data/lib/rmuh/rpt/log/util/unitedoperations.rb +127 -0
- data/lib/rmuh/rpt/log/util/unitedoperationslog.rb +26 -0
- data/lib/rmuh/rpt/log/util/unitedoperationsrpt.rb +37 -0
- data/lib/rmuh/serverstats/base.rb +55 -0
- data/lib/rmuh/version.rb +10 -0
- data/rmuh.gemspec +33 -0
- data/spec/files/content-length.txt +1 -0
- data/spec/helpers/spec_helper.rb +13 -0
- data/spec/helpers/unitedoperations.rb +106 -0
- data/spec/rmuh_rpt_log_fetch_spec.rb +112 -0
- data/spec/rmuh_rpt_log_parsers_base_spec.rb +57 -0
- data/spec/rmuh_rpt_log_parsers_unitedoperationslog_spec.rb +390 -0
- data/spec/rmuh_rpt_log_parsers_unitedoperationsrpt_spec.rb +252 -0
- data/spec/rmuh_rpt_log_util_unitedoperations_spec.rb +473 -0
- data/spec/rmuh_rpt_log_util_unitedoperationslog_spec.rb +66 -0
- data/spec/rmuh_rpt_log_util_unitedoperationsrpt_spec.rb +122 -0
- data/spec/rmuh_rpt_spec.rb +45 -0
- data/spec/rmuh_serverstats_base_spec.rb +190 -0
- metadata +225 -0
@@ -0,0 +1,473 @@
|
|
1
|
+
# -*- coding: UTF-8 -*-
|
2
|
+
require 'rspec'
|
3
|
+
require 'tzinfo'
|
4
|
+
require 'helpers/spec_helper'
|
5
|
+
require File.join(repo_root, 'lib/rmuh/rpt/log/util/unitedoperations')
|
6
|
+
require 'helpers/unitedoperations'
|
7
|
+
|
8
|
+
describe RMuh::RPT::Log::Util::UnitedOperations do
|
9
|
+
before(:all) do
|
10
|
+
@uo_util = Class.new
|
11
|
+
@uo_util.extend(RMuh::RPT::Log::Util::UnitedOperations)
|
12
|
+
@mi = Regexp.new(
|
13
|
+
'(?<year>\d+)/(?<month>\d+)/(?<day>\d+)'\
|
14
|
+
'\s(?<hour>\d+):(?<min>\d+):(?<sec>\d+)'
|
15
|
+
)
|
16
|
+
@mf = Regexp.new(
|
17
|
+
'(?<server_time>[0-9.]+)\s(?<damage>[0-9.]+)\s(?<distance>[0-9.]+)'
|
18
|
+
)
|
19
|
+
@ma = /(?:(?<nearby_players>None.|\[.*?\])")/
|
20
|
+
@full_line = {
|
21
|
+
year: 2014, month: 1, day: 1, hour: 0, min: 0, sec: 0, type: :killed,
|
22
|
+
victim: 'Player1', offender: 'Player2', server_time: 2042.0,
|
23
|
+
distance: 42.0, damage: 42.0, player: 'Player1',
|
24
|
+
player_beguid: 'abc123', channel: 'side', iso8601: '2014-01-01T00:00:00Z'
|
25
|
+
}
|
26
|
+
end
|
27
|
+
|
28
|
+
context RMuh::RPT::Log::Util::UnitedOperations::UO_TZ do
|
29
|
+
let(:tz) { TZInfo::Timezone.get('America/Log_Angeles') }
|
30
|
+
let(:uo_tz) { RMuh::RPT::Log::Util::UnitedOperations::UO_TZ }
|
31
|
+
|
32
|
+
it 'should be an instance of TZInfo::DataTimezone' do
|
33
|
+
expect(uo_tz).to be_an_instance_of TZInfo::DataTimezone
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'should default to America/Los_Angeles' do
|
37
|
+
expect(uo_tz).to eql TZInfo::Timezone.get('America/Los_Angeles')
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
context '#zulu!' do
|
42
|
+
let(:uo_tz) { RMuh::RPT::Log::Util::UnitedOperations::UO_TZ }
|
43
|
+
let(:good_time) do
|
44
|
+
utc = TZInfo::Timezone.get('Etc/UTC')
|
45
|
+
t = utc.local_to_utc(Time.new(2014, 01, 01, 00, 00, 00))
|
46
|
+
t.strftime('%Y-%m-%dT%H:%M:%SZ')
|
47
|
+
end
|
48
|
+
let(:zulued) do
|
49
|
+
ml = @uo_util.m_to_h(@mi.match('2013/12/31 16:00:00'))
|
50
|
+
@uo_util.zulu!(ml, uo_tz)
|
51
|
+
end
|
52
|
+
|
53
|
+
it 'should not take more than three arguments' do
|
54
|
+
expect { @uo_util.zulu!({}, nil, nil) }.to raise_error ArgumentError
|
55
|
+
end
|
56
|
+
|
57
|
+
it 'should not take less than two arguments' do
|
58
|
+
expect { @uo_util.zulu! }.to raise_error ArgumentError
|
59
|
+
end
|
60
|
+
|
61
|
+
it 'should return a Hash' do
|
62
|
+
ml = @uo_util.m_to_h(@mi.match('2013/12/31 16:00:00'))
|
63
|
+
mr = @uo_util.zulu!(ml, uo_tz)
|
64
|
+
mr.should be_an_instance_of Hash
|
65
|
+
end
|
66
|
+
|
67
|
+
it 'should properly convert the time to zulu' do
|
68
|
+
zulued[:iso8601].should eql good_time
|
69
|
+
end
|
70
|
+
|
71
|
+
it 'should properly format the time in iso8601' do
|
72
|
+
m = /^\d+-\d+-\d+T\d+:\d+:\d+Z$/
|
73
|
+
m.match(zulued[:iso8601]).should be_an_instance_of MatchData
|
74
|
+
end
|
75
|
+
|
76
|
+
it 'should properly format the time in DTG' do
|
77
|
+
m = /^\d+Z\s([A-Z]){3}\s\d+$/
|
78
|
+
m.match(zulued[:dtg]).should be_an_instance_of MatchData
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
context '#__guid_data_base' do
|
83
|
+
let(:fline) do
|
84
|
+
x = @full_line.dup
|
85
|
+
x.delete(:iso8601)
|
86
|
+
x
|
87
|
+
end
|
88
|
+
it 'should not take more than one arg' do
|
89
|
+
expect do
|
90
|
+
@uo_util.__guid_data_base(nil, nil)
|
91
|
+
end.to raise_error ArgumentError
|
92
|
+
end
|
93
|
+
|
94
|
+
it 'should not take less than one arg' do
|
95
|
+
expect { @uo_util.__guid_data_base }.to raise_error ArgumentError
|
96
|
+
end
|
97
|
+
|
98
|
+
it 'should return a String if key :iso8601 is there' do
|
99
|
+
@uo_util.__guid_data_base(@full_line).should be_an_instance_of String
|
100
|
+
end
|
101
|
+
|
102
|
+
it 'should return a String if key :iso8608 is missing' do
|
103
|
+
@uo_util.__guid_data_base(fline).should be_an_instance_of String
|
104
|
+
end
|
105
|
+
|
106
|
+
it 'should return iso8601 + type if key :is8601 is there' do
|
107
|
+
x = @uo_util.__guid_data_base(@full_line)
|
108
|
+
x.should eql "#{@full_line[:iso8601]}#{@full_line[:type].to_s}"
|
109
|
+
end
|
110
|
+
|
111
|
+
it 'should be year + month + day + hr + min + sec + type if !iso8601' do
|
112
|
+
x = @uo_util.__guid_data_base(fline)
|
113
|
+
s = "#{fline[:year]}#{fline[:month]}#{fline[:day]}#{fline[:hour]}" \
|
114
|
+
"#{fline[:min]}#{fline[:sec]}#{fline[:type].to_s}"
|
115
|
+
x.should eql s
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
context '#__guid_add_data' do
|
120
|
+
it 'should not take more than two args' do
|
121
|
+
expect do
|
122
|
+
@uo_util.__guid_add_data(nil, nil, nil)
|
123
|
+
end.to raise_error ArgumentError
|
124
|
+
end
|
125
|
+
|
126
|
+
it 'should not take less than two args' do
|
127
|
+
expect do
|
128
|
+
@uo_util.__guid_add_data(nil)
|
129
|
+
end.to raise_error ArgumentError
|
130
|
+
end
|
131
|
+
|
132
|
+
it 'should return a String' do
|
133
|
+
l = {}
|
134
|
+
@uo_util.__guid_add_data(l, :year).should be_an_instance_of String
|
135
|
+
end
|
136
|
+
|
137
|
+
it 'should return the key you requested by as a String' do
|
138
|
+
l = { year: 2014 }
|
139
|
+
@uo_util.__guid_add_data(l, :year).should eql '2014'
|
140
|
+
end
|
141
|
+
|
142
|
+
it 'should return an empty String if the key does not exist' do
|
143
|
+
l = { year: 2014 }
|
144
|
+
@uo_util.__guid_add_data(l, :month).should eql ''
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
context '#add_guid!' do
|
149
|
+
let(:guid_line) { spec_guid_reference_implementation(@full_line) }
|
150
|
+
|
151
|
+
it 'should not take more than one argument' do
|
152
|
+
expect { @uo_util.add_guid!(nil, nil) }.to raise_error ArgumentError
|
153
|
+
end
|
154
|
+
|
155
|
+
it 'should not take less than one argument' do
|
156
|
+
expect { @uo_util.add_guid! }.to raise_error ArgumentError
|
157
|
+
end
|
158
|
+
|
159
|
+
it 'should return a Hash' do
|
160
|
+
@uo_util.add_guid!(@full_line).should be_an_instance_of Hash
|
161
|
+
end
|
162
|
+
|
163
|
+
it 'should return a Hash that matches the reference' do
|
164
|
+
@uo_util.add_guid!(@full_line).should eql guid_line
|
165
|
+
end
|
166
|
+
|
167
|
+
it 'should properly set the :event_guid for killed' do
|
168
|
+
x = @uo_util.add_guid!(spec_killed_line)
|
169
|
+
y = spec_guid_reference_implementation(spec_killed_line)
|
170
|
+
x.key?(:event_guid).should be_true
|
171
|
+
x[:event_guid].should eql y[:event_guid]
|
172
|
+
end
|
173
|
+
|
174
|
+
it 'should properly set the :event_guid for died' do
|
175
|
+
x = @uo_util.add_guid!(spec_died_line)
|
176
|
+
y = spec_guid_reference_implementation(spec_died_line)
|
177
|
+
x.key?(:event_guid).should be_true
|
178
|
+
y[:event_guid].should eql y[:event_guid]
|
179
|
+
end
|
180
|
+
|
181
|
+
it 'should properly set the :event_guid for wounded' do
|
182
|
+
x = @uo_util.add_guid!(spec_wounded_line)
|
183
|
+
y = spec_guid_reference_implementation(spec_wounded_line)
|
184
|
+
x.key?(:event_guid).should be_true
|
185
|
+
x[:event_guid].should eql y[:event_guid]
|
186
|
+
end
|
187
|
+
|
188
|
+
it 'should properly set the :event_guid for announcements' do
|
189
|
+
x = @uo_util.add_guid!(spec_announcement_line)
|
190
|
+
y = spec_guid_reference_implementation(spec_announcement_line)
|
191
|
+
x.key?(:event_guid).should be_true
|
192
|
+
x[:event_guid].should eql y[:event_guid]
|
193
|
+
end
|
194
|
+
|
195
|
+
it 'should properly set the :event_guid for beguid' do
|
196
|
+
x = @uo_util.add_guid!(spec_beguid_line)
|
197
|
+
y = spec_guid_reference_implementation(spec_beguid_line)
|
198
|
+
x.key?(:event_guid).should be_true
|
199
|
+
x[:event_guid].should eql y[:event_guid]
|
200
|
+
end
|
201
|
+
|
202
|
+
it 'should properly set the :event_guid for chat' do
|
203
|
+
x = @uo_util.add_guid!(spec_chat_line)
|
204
|
+
y = spec_guid_reference_implementation(spec_chat_line)
|
205
|
+
x.key?(:event_guid).should be_true
|
206
|
+
x[:event_guid].should eql y[:event_guid]
|
207
|
+
end
|
208
|
+
end
|
209
|
+
|
210
|
+
context '#__check_match_arg' do
|
211
|
+
it 'should take at most one argument' do
|
212
|
+
expect do
|
213
|
+
@uo_util.__check_match_arg(nil, nil)
|
214
|
+
end.to raise_error ArgumentError
|
215
|
+
end
|
216
|
+
|
217
|
+
it 'should take at least one argument' do
|
218
|
+
expect { @uo_util.__check_match_arg }.to raise_error ArgumentError
|
219
|
+
end
|
220
|
+
|
221
|
+
it 'should raise ArgumentError if arg 1 is not a MatchData object' do
|
222
|
+
expect { @uo_util.__check_match_arg(nil) }.to raise_error ArgumentError
|
223
|
+
end
|
224
|
+
end
|
225
|
+
|
226
|
+
context '#__modifiers' do
|
227
|
+
it 'should take at most two args' do
|
228
|
+
expect do
|
229
|
+
@uo_util.__modifiers(nil, nil, nil)
|
230
|
+
end.to raise_error ArgumentError
|
231
|
+
end
|
232
|
+
|
233
|
+
it 'should take at least two args' do
|
234
|
+
expect { @uo_util.__modifiers(nil) }.to raise_error ArgumentError
|
235
|
+
end
|
236
|
+
|
237
|
+
it 'should convert the correct values to Float' do
|
238
|
+
md = @mf.match('2321.3 0.342 123.45')
|
239
|
+
%w{server_time damage distance}.each do |m|
|
240
|
+
x = @uo_util.__modifiers(md, m)
|
241
|
+
x.should be_an_instance_of Float
|
242
|
+
x.should eql md[m].to_f
|
243
|
+
end
|
244
|
+
end
|
245
|
+
|
246
|
+
it 'should convert channel to lowercase' do
|
247
|
+
chat = 'Group'
|
248
|
+
md = /(?<channel>.*)/.match(chat)
|
249
|
+
x = @uo_util.__modifiers(md, 'channel')
|
250
|
+
x.should be_an_instance_of String
|
251
|
+
/[[:lower:]]+/.match(x).should_not be_nil
|
252
|
+
x.should eql chat.downcase
|
253
|
+
end
|
254
|
+
|
255
|
+
it 'should convert the nearby players to Array' do
|
256
|
+
md = @ma.match('["one","two","three"]"')
|
257
|
+
x = @uo_util.__modifiers(md, 'nearby_players')
|
258
|
+
x.should be_an_instance_of Array
|
259
|
+
x.length.should be 3
|
260
|
+
end
|
261
|
+
end
|
262
|
+
|
263
|
+
context '#__line_modifiers' do
|
264
|
+
it 'should take at most two args' do
|
265
|
+
expect do
|
266
|
+
@uo_util.__line_modifiers(nil, nil, nil)
|
267
|
+
end.to raise_error ArgumentError
|
268
|
+
end
|
269
|
+
|
270
|
+
it 'should take at least two args' do
|
271
|
+
expect { @uo_util.__line_modifiers(nil) }.to raise_error ArgumentError
|
272
|
+
end
|
273
|
+
|
274
|
+
it 'should convert the correct values to Fixnum' do
|
275
|
+
md = @mi.match('2014/02/09 14:44:44')
|
276
|
+
%w{year month day hour min sec}.each do |m|
|
277
|
+
x = @uo_util.__line_modifiers(md, m)
|
278
|
+
x.should be_an_instance_of Fixnum
|
279
|
+
x.should eql md[m].to_i
|
280
|
+
end
|
281
|
+
end
|
282
|
+
|
283
|
+
it 'should convert the correct values to Float' do
|
284
|
+
md = @mf.match('2321.3 0.342 123.45')
|
285
|
+
%w{server_time damage distance}.each do |m|
|
286
|
+
x = @uo_util.__modifiers(md, m)
|
287
|
+
x.should be_an_instance_of Float
|
288
|
+
x.should eql md[m].to_f
|
289
|
+
end
|
290
|
+
end
|
291
|
+
|
292
|
+
it 'should return the the match itself if the matcher is not recognized' do
|
293
|
+
d = '042ZYK'
|
294
|
+
md = /(?<something>.*)/.match(d)
|
295
|
+
x = @uo_util.__line_modifiers(md, 'something')
|
296
|
+
x.should be_an_instance_of md['something'].class
|
297
|
+
x.should eql md['something']
|
298
|
+
end
|
299
|
+
end
|
300
|
+
|
301
|
+
context '#m_to_h' do
|
302
|
+
it 'should not take more than one argument' do
|
303
|
+
expect { @uo_util.m_to_h(1, 2) }.to raise_error ArgumentError
|
304
|
+
end
|
305
|
+
|
306
|
+
it 'should not take less than one argument' do
|
307
|
+
expect { @uo_util.m_to_h }.to raise_error ArgumentError
|
308
|
+
end
|
309
|
+
|
310
|
+
it 'should throw an exception if arg 1 is not a MatchData object' do
|
311
|
+
expect { @uo_util.m_to_h(nil) }.to raise_error ArgumentError
|
312
|
+
end
|
313
|
+
|
314
|
+
it 'should return a Hash' do
|
315
|
+
h = @uo_util.m_to_h(/.*/.match('thing'))
|
316
|
+
h.should be_an_instance_of Hash
|
317
|
+
end
|
318
|
+
|
319
|
+
it 'should properly convert the correct values to int' do
|
320
|
+
md = @mi.match('2014/02/09 14:44:44')
|
321
|
+
h = @uo_util.m_to_h(md)
|
322
|
+
[:year, :month, :day, :hour, :min, :sec].each do |m|
|
323
|
+
h[m].should be_an_instance_of Fixnum
|
324
|
+
end
|
325
|
+
end
|
326
|
+
|
327
|
+
it 'should properly convert the correct values to float' do
|
328
|
+
md = @mf.match('2321.3 0.342 123.45')
|
329
|
+
h = @uo_util.m_to_h(md)
|
330
|
+
[:server_time, :damage, :distance].each do |m|
|
331
|
+
h[m].should be_an_instance_of Float
|
332
|
+
end
|
333
|
+
end
|
334
|
+
|
335
|
+
it 'should convert the nearby players to an Array of Strings' do
|
336
|
+
md = @ma.match('["one","two","three"]"')
|
337
|
+
h = @uo_util.m_to_h(md)
|
338
|
+
h[:nearby_players].should be_an_instance_of Array
|
339
|
+
h[:nearby_players].length.should be 3
|
340
|
+
|
341
|
+
h[:nearby_players].each do |p|
|
342
|
+
p.should be_an_instance_of String
|
343
|
+
p.empty?.should be false
|
344
|
+
end
|
345
|
+
end
|
346
|
+
|
347
|
+
it 'should convert nearby players to an empty Array if it is None' do
|
348
|
+
md = @ma.match('None."')
|
349
|
+
h = @uo_util.m_to_h(md)
|
350
|
+
h[:nearby_players].should be_an_instance_of Array
|
351
|
+
h[:nearby_players].empty?.should be_true
|
352
|
+
end
|
353
|
+
end
|
354
|
+
|
355
|
+
context '#validate_bool_opt' do
|
356
|
+
it 'should not take more than two args' do
|
357
|
+
expect do
|
358
|
+
@uo_util.validate_bool_opt(nil, nil, nil)
|
359
|
+
end.to raise_error ArgumentError
|
360
|
+
end
|
361
|
+
|
362
|
+
it 'should not take less than two args' do
|
363
|
+
expect do
|
364
|
+
@uo_util.validate_bool_opt(nil)
|
365
|
+
end.to raise_error ArgumentError
|
366
|
+
end
|
367
|
+
|
368
|
+
it 'should return nil if the key does not exist' do
|
369
|
+
h = { one: 'two' }
|
370
|
+
@uo_util.validate_bool_opt(h, :two).should be_nil
|
371
|
+
end
|
372
|
+
|
373
|
+
it 'should return nil if the key is true' do
|
374
|
+
h = { x: true }
|
375
|
+
@uo_util.validate_bool_opt(h, :x).should be_nil
|
376
|
+
end
|
377
|
+
|
378
|
+
it 'should return nil if the key is false' do
|
379
|
+
h = { x: false }
|
380
|
+
@uo_util.validate_bool_opt(h, :x).should be_nil
|
381
|
+
end
|
382
|
+
|
383
|
+
it 'should raise ArgumentError if the key is a String' do
|
384
|
+
expect do
|
385
|
+
@uo_util.validate_bool_opt({ x: '' }, :x)
|
386
|
+
end.to raise_error ArgumentError
|
387
|
+
end
|
388
|
+
|
389
|
+
it 'should raise ArgumentError if the key is a Symbol' do
|
390
|
+
expect do
|
391
|
+
@uo_util.validate_bool_opt({ x: :x }, :x)
|
392
|
+
end.to raise_error ArgumentError
|
393
|
+
end
|
394
|
+
|
395
|
+
it 'should raise ArgumentError if the key is a Fixnum' do
|
396
|
+
expect do
|
397
|
+
@uo_util.validate_bool_opt({ x: 0 }, :x)
|
398
|
+
end.to raise_error ArgumentError
|
399
|
+
end
|
400
|
+
|
401
|
+
it 'should raise ArgumentError if the key is a Float' do
|
402
|
+
expect do
|
403
|
+
@uo_util.validate_bool_opt({ x: 0.0 }, :x)
|
404
|
+
end.to raise_error ArgumentError
|
405
|
+
end
|
406
|
+
|
407
|
+
it 'should raise ArgumentError if the key is a Array' do
|
408
|
+
expect do
|
409
|
+
@uo_util.validate_bool_opt({ x: [] }, :x)
|
410
|
+
end.to raise_error ArgumentError
|
411
|
+
end
|
412
|
+
|
413
|
+
it 'should raise ArgumentError if the key is a Hash' do
|
414
|
+
expect do
|
415
|
+
@uo_util.validate_bool_opt({ x: '' }, :x)
|
416
|
+
end.to raise_error ArgumentError
|
417
|
+
end
|
418
|
+
end
|
419
|
+
|
420
|
+
context '#validate_timezone' do
|
421
|
+
let(:uo_tz) { RMuh::RPT::Log::Util::UnitedOperations::UO_TZ }
|
422
|
+
|
423
|
+
it 'should not take more than one arg' do
|
424
|
+
expect do
|
425
|
+
@uo_util.validate_timezone(nil, nil)
|
426
|
+
end.to raise_error ArgumentError
|
427
|
+
end
|
428
|
+
|
429
|
+
it 'should not take less than one arg' do
|
430
|
+
expect { @uo_util.validate_timezone }.to raise_error ArgumentError
|
431
|
+
end
|
432
|
+
|
433
|
+
it 'should return nil if arg 1 is an instance of TZInfo::DataTimezone' do
|
434
|
+
@uo_util.validate_timezone(timezone: uo_tz).should be_nil
|
435
|
+
end
|
436
|
+
|
437
|
+
it 'should raise ArgumentError if arg 1 is a String' do
|
438
|
+
expect do
|
439
|
+
@uo_util.validate_timezone(timezone: '')
|
440
|
+
end.to raise_error ArgumentError
|
441
|
+
end
|
442
|
+
|
443
|
+
it 'should raise ArgumentError if arg 1 is a Symbol' do
|
444
|
+
expect do
|
445
|
+
@uo_util.validate_timezone(timezone: :x)
|
446
|
+
end.to raise_error ArgumentError
|
447
|
+
end
|
448
|
+
|
449
|
+
it 'should raise ArgumentError if arg 1 is a Fixnum' do
|
450
|
+
expect do
|
451
|
+
@uo_util.validate_timezone(timezone: 0)
|
452
|
+
end.to raise_error ArgumentError
|
453
|
+
end
|
454
|
+
|
455
|
+
it 'should raise ArgumentError if arg 1 is a Float' do
|
456
|
+
expect do
|
457
|
+
@uo_util.validate_timezone(timezone: 0.0)
|
458
|
+
end.to raise_error ArgumentError
|
459
|
+
end
|
460
|
+
|
461
|
+
it 'should raise ArgumentError if arg 1 is an Array' do
|
462
|
+
expect do
|
463
|
+
@uo_util.validate_timezone(timezone: [])
|
464
|
+
end.to raise_error ArgumentError
|
465
|
+
end
|
466
|
+
|
467
|
+
it 'should raise ArgumentError if arg 1 is a Hash' do
|
468
|
+
expect do
|
469
|
+
@uo_util.validate_timezone(timezone: {})
|
470
|
+
end.to raise_error ArgumentError
|
471
|
+
end
|
472
|
+
end
|
473
|
+
end
|