nightfury 0.4.2 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,8 +7,8 @@ module Nightfury
7
7
  init_time_series unless redis.exists(redis_key)
8
8
  end
9
9
 
10
- def set(value, time=Time.now)
11
- value = before_set(value)
10
+ def set(value, time=Time.now, options={})
11
+ value = before_set(value) unless options[:skip_before_set]
12
12
  # make sure the time_series is initialized.
13
13
  # It will not if the metric is removed and
14
14
  # set is called on the smae object
@@ -1,3 +1,3 @@
1
1
  module Nightfury
2
- VERSION = "0.4.2"
2
+ VERSION = "0.4.3"
3
3
  end
@@ -135,6 +135,20 @@ describe Nightfury::Metric::TimeSeries do
135
135
  end
136
136
 
137
137
  describe "Setter" do
138
+ describe "before set" do
139
+ it "should call before_set, before adding the value to the timeline" do
140
+ ts_metric = Nightfury::Metric::TimeSeries.new(:avg_time)
141
+ flexmock(ts_metric).should_receive(:before_set).with(1).once
142
+ ts_metric.set(1)
143
+ end
144
+
145
+ it "should not call before_set, before adding the value to the timeline if optiond ':skip_before_set' is provided" do
146
+ ts_metric = Nightfury::Metric::TimeSeries.new(:avg_time)
147
+ flexmock(ts_metric).should_receive(:before_set).with(1).never
148
+ ts_metric.set(1, Time.now, :skip_before_set => true)
149
+ end
150
+ end
151
+
138
152
  describe "add the value to timeline" do
139
153
  it "should default time to current time" do
140
154
  time_now = Time.now
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nightfury
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-01-28 00:00:00.000000000 Z
13
+ date: 2013-01-30 00:00:00.000000000 Z
14
14
  dependencies: []
15
15
  description: Nightfury is a reporting/analytics backend written on Redis
16
16
  email: