-
Notifications
You must be signed in to change notification settings - Fork 388
/
numeric_gauge_spec.rb
86 lines (73 loc) · 2.04 KB
/
numeric_gauge_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
require ::File.expand_path('../spec_helper.rb', __FILE__)
describe FnordMetric::NumericGauge do
before(:all) do
@now = Time.utc(1992,01,13,5,23,23).to_i
@redis = Redis.new
@redis_wrap = RedisWrap.new(@redis, false)
@gauge_klass = FnordMetric::NumericGauge
end
before(:each) do
@redis.keys("fnordmetric-myns*").each { |k| @redis.del(k) }
end
it_should_behave_like FnordMetric::GaugeLike
describe "option validation" do
it "should raise when initialized with non-unique series tokens" do
lambda{
FnordMetric::NumericGauge.new(
:series => [:fnord, :fnord],
:ticks => [1.hour],
:key => 123,
:key_prefix => 123
)
}.should raise_exception
end
it "should raise when initialized without series tokens key" do
lambda{
FnordMetric::NumericGauge.new(
:key => 123,
:ticks => [1.hour],
:key_prefix => 123
)
}.should raise_exception
end
it "should raise when initialized with emtpy series tokens" do
lambda{
FnordMetric::NumericGauge.new(
:series => [],
:key => 123,
:ticks => [1.hour],
:key_prefix => 123
)
}.should raise_exception
end
it "should raise when initialized without ticks key" do
lambda{
FnordMetric::NumericGauge.new(
:key => 123,
:series => [:fu],
:key_prefix => 123
)
}.should raise_exception
end
it "should raise when initialized with emtpy ticks" do
lambda{
FnordMetric::NumericGauge.new(
:ticks => [],
:series => [:fu],
:key => 123,
:key_prefix => 123
)
}.should raise_exception
end
it "should raise when initialized with invalid ticks" do
lambda{
FnordMetric::NumericGauge.new(
:ticks => ["fnord"],
:series => ["fu"],
:key => 123,
:key_prefix => 123
)
}.should raise_exception
end
end
end