influxer 0.2.2 → 0.2.4

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.
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  describe Influxer::Metrics do
4
4
  before do
5
- allow_any_instance_of(Influxer::Client).to receive(:query) do |_, sql|
5
+ allow_any_instance_of(Influxer::Client).to receive(:query) do |_, sql|
6
6
  sql
7
7
  end
8
8
  end
@@ -10,32 +10,30 @@ describe Influxer::Metrics do
10
10
  let(:metrics) { Influxer::Metrics.new }
11
11
  let(:metrics_class) { Influxer::Metrics }
12
12
 
13
-
14
13
  # class methods
15
14
 
16
- specify {expect(metrics_class).to respond_to :attributes}
17
- specify {expect(metrics_class).to respond_to :set_series}
18
- specify {expect(metrics_class).to respond_to :series}
15
+ specify { expect(metrics_class).to respond_to :attributes }
16
+ specify { expect(metrics_class).to respond_to :set_series }
17
+ specify { expect(metrics_class).to respond_to :series }
19
18
 
20
19
  # query methods
21
-
22
- specify { expect(metrics_class).to respond_to :all}
23
- specify { expect(metrics_class).to respond_to :where}
24
- specify { expect(metrics_class).to respond_to :merge}
25
- specify { expect(metrics_class).to respond_to :time}
26
- specify { expect(metrics_class).to respond_to :past}
27
- specify { expect(metrics_class).to respond_to :since}
28
- specify { expect(metrics_class).to respond_to :limit}
29
- specify { expect(metrics_class).to respond_to :select}
30
- specify { expect(metrics_class).to respond_to :delete_all}
20
+
21
+ specify { expect(metrics_class).to respond_to :all }
22
+ specify { expect(metrics_class).to respond_to :where }
23
+ specify { expect(metrics_class).to respond_to :merge }
24
+ specify { expect(metrics_class).to respond_to :time }
25
+ specify { expect(metrics_class).to respond_to :past }
26
+ specify { expect(metrics_class).to respond_to :since }
27
+ specify { expect(metrics_class).to respond_to :limit }
28
+ specify { expect(metrics_class).to respond_to :select }
29
+ specify { expect(metrics_class).to respond_to :delete_all }
31
30
 
32
31
  # instance methods
33
32
 
34
33
  specify { expect(metrics).to respond_to :write }
35
34
  specify { expect(metrics).to respond_to :write! }
36
35
  specify { expect(metrics).to respond_to :persisted? }
37
- specify { expect(metrics).to respond_to :series}
38
-
36
+ specify { expect(metrics).to respond_to :series }
39
37
 
40
38
  # ActiveModel::Validations
41
39
 
@@ -43,86 +41,80 @@ describe Influxer::Metrics do
43
41
  specify { expect(metrics).to respond_to :invalid? }
44
42
  specify { expect(metrics).to respond_to :errors }
45
43
 
46
-
47
-
48
44
  describe "instance methods" do
49
-
50
- let(:dummy_metrics) { DummyMetrics.new dummy_id: 1, user_id: 1}
45
+ let(:dummy_metrics) { DummyMetrics.new dummy_id: 1, user_id: 1 }
51
46
 
52
47
  describe "#write" do
53
-
54
48
  context "Validations" do
55
49
  it "should not write if required attribute is missing" do
56
50
  m = DummyMetrics.new(dummy_id: 1)
57
51
  expect(m.write).to be false
58
52
  expect(m.errors.size).to eq(1)
59
- end
53
+ end
60
54
 
61
55
  it "should raise error if required attribute is missing" do
62
- expect{DummyMetrics.new(user_id: 1).write!}.to raise_error(StandardError)
63
- end
56
+ expect { DummyMetrics.new(user_id: 1).write! }.to raise_error(StandardError)
57
+ end
64
58
 
65
59
  it "should raise error if you want to write twice" do
66
60
  expect(dummy_metrics.write).to be_truthy
67
- expect{dummy_metrics.write!}.to raise_error(StandardError)
61
+ expect { dummy_metrics.write! }.to raise_error(StandardError)
68
62
  end
69
- end
63
+ end
70
64
 
71
65
  it "should write successfully when all required attributes are set" do
72
66
  expect(Influxer.client).to receive(:write_point).with("dummy", anything)
73
67
  expect(dummy_metrics.write).to be_truthy
74
68
  expect(dummy_metrics.persisted?).to be_truthy
75
- end
69
+ end
76
70
  end
77
71
 
78
72
  context "active_model callbacks" do
79
73
  it "should set current time" do
80
- Timecop.freeze(Time.local(2014,10,10,10,10,10)) do
74
+ Timecop.freeze(Time.local(2014, 10, 10, 10, 10, 10)) do
81
75
  dummy_metrics.write!
82
76
  end
83
- expect(dummy_metrics.time).to eq Time.local(2014,10,10,10,10,10)
77
+ expect(dummy_metrics.time).to eq Time.local(2014, 10, 10, 10, 10, 10)
84
78
  end
85
79
  end
86
-
87
80
  end
88
81
 
89
82
  describe "class methods" do
90
-
91
83
  let(:dummy_metrics) do
92
84
  Class.new(Influxer::Metrics) do
93
- set_series :dummies
94
- attributes :user_id, :dummy_id
85
+ set_series :dummies
86
+ attributes :user_id, :dummy_id
95
87
  end
96
88
  end
97
89
 
98
90
  let(:dummy_metrics_2) do
99
91
  Class.new(Influxer::Metrics) do
100
- set_series "dummy \"A\""
92
+ set_series "dummy \"A\""
101
93
  end
102
94
  end
103
95
 
104
96
  let(:dummy_metrics_3) do
105
97
  Class.new(Influxer::Metrics) do
106
- set_series /^.*$/
98
+ set_series /^.*$/
107
99
  end
108
100
  end
109
101
 
110
102
  let(:dummy_with_2_series) do
111
103
  Class.new(Influxer::Metrics) do
112
- set_series :events, :errors
104
+ set_series :events, :errors
113
105
  end
114
106
  end
115
107
 
116
108
  let(:dummy_with_2_series_quoted) do
117
109
  Class.new(Influxer::Metrics) do
118
- set_series "dummy \"A\"", "dummy \"B\""
110
+ set_series "dummy \"A\"", "dummy \"B\""
119
111
  end
120
112
  end
121
113
 
122
114
  let(:dummy_with_proc_series) do
123
115
  Class.new(Influxer::Metrics) do
124
116
  attributes :user_id, :test_id
125
- set_series ->(metrics) { "test/#{metrics.test_id}/user/#{metrics.user_id}"}
117
+ set_series ->(metrics) { "test/#{metrics.test_id}/user/#{metrics.user_id}" }
126
118
  end
127
119
  end
128
120
 
@@ -148,30 +140,32 @@ describe Influxer::Metrics do
148
140
  end
149
141
 
150
142
  it "should set several series with quotes" do
151
- expect(dummy_with_2_series_quoted.new.series).to eq "merge(\"dummy \\\"A\\\"\",\"dummy \\\"B\\\"\")"
143
+ expect(dummy_with_2_series_quoted.new.series)
144
+ .to eq "merge(\"dummy \\\"A\\\"\",\"dummy \\\"B\\\"\")"
152
145
  end
153
146
 
154
147
  it "should set series from proc" do
155
148
  expect(dummy_with_proc_series.series).to be_an_instance_of Proc
156
149
 
157
- m = dummy_with_proc_series.new user_id: 2, test_id:123
150
+ m = dummy_with_proc_series.new user_id: 2, test_id: 123
158
151
  expect(m.series).to eq "\"test/123/user/2\""
159
152
  end
160
153
  end
161
154
 
162
155
  describe "write method" do
163
156
  it "should write data and return point" do
164
- expect(Influxer.client).to receive(:write_point).with("dummies", {user_id: 1, dummy_id: 2})
165
-
157
+ expect(Influxer.client)
158
+ .to receive(:write_point).with("dummies", user_id: 1, dummy_id: 2)
159
+
166
160
  point = dummy_metrics.write(user_id: 1, dummy_id: 2)
167
161
  expect(point.persisted?).to be_truthy
168
162
  expect(point.user_id).to eq 1
169
163
  expect(point.dummy_id).to eq 2
170
- end
164
+ end
171
165
 
172
166
  it "should not write data and return false" do
173
167
  expect(DummyMetrics.write(dummy_id: 2)).to be false
174
- end
168
+ end
175
169
  end
176
170
 
177
171
  describe "all method" do
@@ -179,6 +173,5 @@ describe Influxer::Metrics do
179
173
  expect(metrics_class.all).to be_an_instance_of Influxer::Relation
180
174
  end
181
175
  end
182
-
183
176
  end
184
- end
177
+ end
@@ -2,32 +2,31 @@ require 'spec_helper'
2
2
 
3
3
  describe Influxer::Relation do
4
4
  before do
5
- allow_any_instance_of(Influxer::Client).to receive(:query) do |_, sql|
5
+ allow_any_instance_of(Influxer::Client).to receive(:query) do |_, sql|
6
6
  sql
7
7
  end
8
8
  end
9
9
 
10
- let(:rel) { Influxer::Relation.new DummyMetrics}
11
- let(:rel2) { Influxer::Relation.new DummyComplexMetrics}
12
-
13
- specify { expect(rel).to respond_to :write}
14
- specify { expect(rel).to respond_to :build}
10
+ let(:rel) { Influxer::Relation.new DummyMetrics }
11
+ let(:rel2) { Influxer::Relation.new DummyComplexMetrics }
12
+
13
+ specify { expect(rel).to respond_to :write }
14
+ specify { expect(rel).to respond_to :build }
15
15
 
16
16
  # read
17
17
  specify { expect(rel).to respond_to :select }
18
18
  specify { expect(rel).to respond_to :where }
19
19
  specify { expect(rel).to respond_to :limit }
20
20
  specify { expect(rel).to respond_to :group }
21
-
22
- #delete
21
+
22
+ # delete
23
23
  specify { expect(rel).to respond_to :delete_all }
24
24
 
25
25
  specify { expect(rel).to respond_to :to_sql }
26
26
 
27
-
28
27
  describe "#merge!" do
29
28
  it "should merge multi values" do
30
- r1 = rel.where(id: [1,2], dummy: 'qwe').time(:hour)
29
+ r1 = rel.where(id: [1, 2], dummy: 'qwe').time(:hour)
31
30
  r2 = Influxer::Relation.new(DummyMetrics).where.not(user_id: 0).group(:user_id)
32
31
  r1.merge!(r2)
33
32
  expect(r1.to_sql).to eq "select * from \"dummy\" group by time(1h),user_id where (id=1 or id=2) and (dummy='qwe') and (user_id<>0)"
@@ -39,7 +38,6 @@ describe Influxer::Relation do
39
38
  r1.merge!(r2)
40
39
  expect(r1.to_sql).to eq "select * from \"dummy\" merge \"doomy\" group by time(1h) fill(0) limit 5"
41
40
  end
42
-
43
41
  end
44
42
 
45
43
  describe "sql generation" do
@@ -51,35 +49,35 @@ describe Influxer::Relation do
51
49
 
52
50
  describe "#select" do
53
51
  it "should select array of symbols" do
54
- expect(rel.select(:user_id, :dummy_id).to_sql).to eq "select user_id,dummy_id from \"dummy\""
52
+ expect(rel.select(:user_id, :dummy_id).to_sql).to eq "select user_id,dummy_id from \"dummy\""
55
53
  end
56
54
 
57
55
  it "should select string" do
58
- expect(rel.select("count(user_id)").to_sql).to eq "select count(user_id) from \"dummy\""
56
+ expect(rel.select("count(user_id)").to_sql).to eq "select count(user_id) from \"dummy\""
59
57
  end
60
58
  end
61
59
 
62
60
  describe "#where" do
63
61
  it "should generate valid conditions from hash" do
64
62
  Timecop.freeze(Time.now) do
65
- expect(rel.where(user_id: 1, dummy: 'q', timer: Time.now).to_sql).to eq "select * from \"dummy\" where (user_id=1) and (dummy='q') and (timer=#{Time.now.to_i}s)"
63
+ expect(rel.where(user_id: 1, dummy: 'q', timer: Time.now).to_sql).to eq "select * from \"dummy\" where (user_id=1) and (dummy='q') and (timer=#{Time.now.to_i}s)"
66
64
  end
67
65
  end
68
66
 
69
67
  it "should generate valid conditions from strings" do
70
- expect(rel.where("time > now() - 1d").to_sql).to eq "select * from \"dummy\" where (time > now() - 1d)"
68
+ expect(rel.where("time > now() - 1d").to_sql).to eq "select * from \"dummy\" where (time > now() - 1d)"
71
69
  end
72
70
 
73
71
  it "should handle regexps" do
74
- expect(rel.where(user_id: 1, dummy: /^du.*/).to_sql).to eq "select * from \"dummy\" where (user_id=1) and (dummy=~/^du.*/)"
72
+ expect(rel.where(user_id: 1, dummy: /^du.*/).to_sql).to eq "select * from \"dummy\" where (user_id=1) and (dummy=~/^du.*/)"
75
73
  end
76
74
 
77
75
  it "should handle ranges" do
78
- expect(rel.where(user_id: 1..4).to_sql).to eq "select * from \"dummy\" where (user_id>1 and user_id<4)"
76
+ expect(rel.where(user_id: 1..4).to_sql).to eq "select * from \"dummy\" where (user_id>1 and user_id<4)"
79
77
  end
80
78
 
81
79
  it "should handle arrays" do
82
- expect(rel.where(user_id: [1,2,3]).to_sql).to eq "select * from \"dummy\" where (user_id=1 or user_id=2 or user_id=3)"
80
+ expect(rel.where(user_id: [1, 2, 3]).to_sql).to eq "select * from \"dummy\" where (user_id=1 or user_id=2 or user_id=3)"
83
81
  end
84
82
  end
85
83
 
@@ -89,15 +87,15 @@ describe Influxer::Relation do
89
87
  end
90
88
 
91
89
  it "should handle regexp" do
92
- expect(rel.where.not(user_id: 1, dummy: /^du.*/).to_sql).to eq "select * from \"dummy\" where (user_id<>1) and (dummy!~/^du.*/)"
90
+ expect(rel.where.not(user_id: 1, dummy: /^du.*/).to_sql).to eq "select * from \"dummy\" where (user_id<>1) and (dummy!~/^du.*/)"
93
91
  end
94
92
 
95
93
  it "should handle ranges" do
96
- expect(rel.where.not(user_id: 1..4).to_sql).to eq "select * from \"dummy\" where (user_id<1 and user_id>4)"
94
+ expect(rel.where.not(user_id: 1..4).to_sql).to eq "select * from \"dummy\" where (user_id<1 and user_id>4)"
97
95
  end
98
96
 
99
97
  it "should handle arrays" do
100
- expect(rel.where.not(user_id: [1,2,3]).to_sql).to eq "select * from \"dummy\" where (user_id<>1 and user_id<>2 and user_id<>3)"
98
+ expect(rel.where.not(user_id: [1, 2, 3]).to_sql).to eq "select * from \"dummy\" where (user_id<>1 and user_id<>2 and user_id<>3)"
101
99
  end
102
100
  end
103
101
 
@@ -113,7 +111,7 @@ describe Influxer::Relation do
113
111
 
114
112
  describe "#past" do
115
113
  it "should work with predefined symbols" do
116
- expect(rel.past(:hour).to_sql).to eq "select * from \"dummy\" where (time > now() - 1h)"
114
+ expect(rel.past(:hour).to_sql).to eq "select * from \"dummy\" where (time > now() - 1h)"
117
115
  end
118
116
 
119
117
  it "should work with any symbols" do
@@ -125,19 +123,19 @@ describe Influxer::Relation do
125
123
  end
126
124
 
127
125
  it "should work with numbers" do
128
- expect(rel.past(1.day).to_sql).to eq "select * from \"dummy\" where (time > now() - 86400s)"
126
+ expect(rel.past(1.day).to_sql).to eq "select * from \"dummy\" where (time > now() - 86400s)"
129
127
  end
130
128
  end
131
129
 
132
130
  describe "#since" do
133
131
  it "should work with datetime" do
134
- expect(rel.since(Time.utc(2014,12,31)).to_sql).to eq "select * from \"dummy\" where (time > 1419984000s)"
132
+ expect(rel.since(Time.utc(2014, 12, 31)).to_sql).to eq "select * from \"dummy\" where (time > 1419984000s)"
135
133
  end
136
134
  end
137
135
 
138
136
  describe "#group" do
139
137
  it "should generate valid groups" do
140
- expect(rel.group(:user_id, "time(1m) fill(0)").to_sql).to eq "select * from \"dummy\" group by user_id,time(1m) fill(0)"
138
+ expect(rel.group(:user_id, "time(1m) fill(0)").to_sql).to eq "select * from \"dummy\" group by user_id,time(1m) fill(0)"
141
139
  end
142
140
 
143
141
  context "group by time predefined values" do
@@ -189,29 +187,35 @@ describe Influxer::Relation do
189
187
 
190
188
  describe "#limit" do
191
189
  it "should generate valid limi" do
192
- expect(rel.limit(100).to_sql).to eq "select * from \"dummy\" limit 100"
190
+ expect(rel.limit(100).to_sql).to eq "select * from \"dummy\" limit 100"
193
191
  end
194
192
  end
195
193
 
196
194
  describe "calculations" do
197
195
  context "one arg calculation methods" do
198
196
  [
199
- :count, :min, :max, :mean,
200
- :mode, :median, :distinct, :derivative,
197
+ :count, :min, :max, :mean,
198
+ :mode, :median, :distinct, :derivative,
201
199
  :stddev, :sum, :first, :last, :difference, :histogram
202
200
  ].each do |method|
203
201
  describe "##{method}" do
204
- it { expect(rel.where(user_id: 1).calc(method, :column_name).to_sql).to eq "select #{method}(column_name) from \"dummy\" where (user_id=1)"}
202
+ it do
203
+ expect(rel.where(user_id: 1).calc(method, :column_name).to_sql)
204
+ .to eq "select #{method}(column_name) from \"dummy\" where (user_id=1)"
205
+ end
205
206
  end
206
207
  end
207
208
  end
208
209
 
209
210
  context "two args calculation methods" do
210
211
  [
211
- :percentile, :histogram, :top, :bottom
212
+ :percentile, :histogram, :top, :bottom
212
213
  ].each do |method|
213
214
  describe "##{method}" do
214
- it { expect(rel.where(user_id: 1).calc(method, :column_name, 10).to_sql).to eq "select #{method}(column_name,10) from \"dummy\" where (user_id=1)"}
215
+ it do
216
+ expect(rel.where(user_id: 1).calc(method, :column_name, 10).to_sql)
217
+ .to eq "select #{method}(column_name,10) from \"dummy\" where (user_id=1)"
218
+ end
215
219
  end
216
220
  end
217
221
  end
@@ -221,7 +225,7 @@ describe Influxer::Relation do
221
225
  describe "#empty?" do
222
226
  after(:each) { Influxer.reset }
223
227
  it "should return false if has points" do
224
- Influxer.client.stub(:query) { {points: [{time: 1, id: 2}]} }
228
+ Influxer.client.stub(:query) { { points: [{ time: 1, id: 2 }] } }
225
229
  expect(rel.empty?).to be_falsey
226
230
  expect(rel.present?).to be_truthy
227
231
  end
@@ -236,30 +240,30 @@ describe Influxer::Relation do
236
240
  describe "#delete_all" do
237
241
  it do
238
242
  Timecop.freeze(Time.now) do
239
- expect(rel.where(user_id: 1, dummy: 'q', timer: Time.now).delete_all).to eq "delete from \"dummy\" where (user_id=1) and (dummy='q') and (timer=#{Time.now.to_i}s)"
243
+ expect(rel.where(user_id: 1, dummy: 'q', timer: Time.now).delete_all)
244
+ .to eq "delete from \"dummy\" where (user_id=1) and (dummy='q') and (timer=#{Time.now.to_i}s)"
240
245
  end
241
246
  end
242
247
  end
243
248
 
244
249
  describe "#inspect" do
245
-
246
250
  after(:each) do
247
251
  Influxer.reset
248
252
  end
249
-
253
+
250
254
  it "should return correct String represantation of empty relation" do
251
255
  Influxer.client.stub(:query) { {} }
252
- expect(rel.inspect).to eq "#<Influxer::Relation []>"
256
+ expect(rel.inspect).to eq "#<Influxer::Relation []>"
253
257
  end
254
258
 
255
259
  it "should return correct String represantation of non-empty relation" do
256
- Influxer.client.stub(:query){ {"dummy" => [1,2,3]} }
257
- expect(rel.inspect).to eq "#<Influxer::Relation [1, 2, 3]>"
260
+ Influxer.client.stub(:query) { { "dummy" => [1, 2, 3] } }
261
+ expect(rel.inspect).to eq "#<Influxer::Relation [1, 2, 3]>"
258
262
  end
259
263
 
260
- it "should return correct String represantation of non-empty large (>11) relation" do
261
- Influxer.client.stub(:query){ {"dummy" => [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]} }
262
- expect(rel.inspect).to eq "#<Influxer::Relation [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ...]>"
264
+ it "should return correct String represantation of non-empty large (>11) relation" do
265
+ Influxer.client.stub(:query) { { "dummy" => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13] } }
266
+ expect(rel.inspect).to eq "#<Influxer::Relation [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, ...]>"
263
267
  end
264
- end
265
- end
268
+ end
269
+ end
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  describe Influxer::Metrics do
4
4
  before do
5
- allow_any_instance_of(Influxer::Client).to receive(:query) do |_, sql|
5
+ allow_any_instance_of(Influxer::Client).to receive(:query) do |_, sql|
6
6
  sql
7
7
  end
8
8
  end
@@ -33,7 +33,6 @@ describe Influxer::Metrics do
33
33
  end
34
34
  end
35
35
 
36
-
37
36
  describe "default scope" do
38
37
  it "should work without default scope" do
39
38
  expect(klass.all.to_sql).to eq "select * from \"dummy\""
@@ -48,13 +47,15 @@ describe Influxer::Metrics do
48
47
  end
49
48
 
50
49
  it "should work with several defaults" do
51
- expect(dappy.where(user_id:1).to_sql).to eq "select * from \"dummy\" group by time(1h) where (user_id=1) limit 100"
50
+ expect(dappy.where(user_id: 1).to_sql)
51
+ .to eq "select * from \"dummy\" group by time(1h) where (user_id=1) limit 100"
52
52
  end
53
53
  end
54
54
 
55
55
  describe "named scope" do
56
56
  it "should work with named scope" do
57
- expect(doomy.by_user(1).to_sql).to eq "select * from \"dummy\" group by time(1h) where (user_id=1) limit 100"
57
+ expect(doomy.by_user(1).to_sql)
58
+ .to eq "select * from \"dummy\" group by time(1h) where (user_id=1) limit 100"
58
59
  end
59
60
 
60
61
  it "should work with named scope with empty relation" do
@@ -62,7 +63,8 @@ describe Influxer::Metrics do
62
63
  end
63
64
 
64
65
  it "should work with several scopes" do
65
- expect(doomy.where(dummy_id: 100).by_user([1,2,3]).daily.to_sql).to eq "select * from \"dummy\" group by time(1d) where (dummy_id=100) and (user_id=1 or user_id=2 or user_id=3) limit 100"
66
+ expect(doomy.where(dummy_id: 100).by_user([1, 2, 3]).daily.to_sql)
67
+ .to eq "select * from \"dummy\" group by time(1d) where (dummy_id=100) and (user_id=1 or user_id=2 or user_id=3) limit 100"
66
68
  end
67
69
  end
68
- end
70
+ end
@@ -1,11 +1,11 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Testo do
4
- let(:testo) { Testo.new receipt_id: 10}
5
- specify { expect(testo).to respond_to :metrics }
6
- specify { expect(testo).to respond_to :testo_metrics }
7
- specify { expect(testo).to respond_to :testo2_metrics }
8
- specify { expect(testo).to respond_to :custom_metrics }
4
+ let(:testo) { Testo.new receipt_id: 10 }
5
+ specify { expect(testo).to respond_to :metrics }
6
+ specify { expect(testo).to respond_to :testo_metrics }
7
+ specify { expect(testo).to respond_to :testo2_metrics }
8
+ specify { expect(testo).to respond_to :custom_metrics }
9
9
 
10
10
  describe "metrics attributes" do
11
11
  it "should add foreign key and inherits" do
@@ -24,4 +24,4 @@ describe Testo do
24
24
  expect(testo.custom_metrics.build.receipt_id).to be_nil
25
25
  end
26
26
  end
27
- end
27
+ end
data/spec/spec_helper.rb CHANGED
@@ -15,9 +15,9 @@ require 'timecop'
15
15
 
16
16
  require "dummy/config/environment"
17
17
 
18
- Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
18
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
19
19
 
20
20
  RSpec.configure do |config|
21
21
  config.mock_with :rspec
22
22
  config.use_transactional_fixtures = true
23
- end
23
+ end
@@ -1,9 +1,9 @@
1
- class DummyMetrics < Influxer::Metrics
1
+ class DummyMetrics < Influxer::Metrics # :nodoc:
2
2
  attributes :dummy_id, :user_id
3
3
 
4
4
  validates_presence_of :dummy_id, :user_id
5
5
 
6
- before_write ->{ self.time = DateTime.now }
6
+ before_write -> { self.time = DateTime.now }
7
7
 
8
8
  scope :calc, ->(method, *args) { send(method, *args) }
9
- end
9
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: influxer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vlad Dem
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-12 00:00:00.000000000 Z
11
+ date: 2015-04-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -29,9 +29,6 @@ dependencies:
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: 0.1.0
34
- - - ">="
35
32
  - !ruby/object:Gem::Version
36
33
  version: 0.1.8
37
34
  type: :runtime
@@ -39,9 +36,6 @@ dependencies:
39
36
  version_requirements: !ruby/object:Gem::Requirement
40
37
  requirements:
41
38
  - - "~>"
42
- - !ruby/object:Gem::Version
43
- version: 0.1.0
44
- - - ">="
45
39
  - !ruby/object:Gem::Version
46
40
  version: 0.1.8
47
41
  - !ruby/object:Gem::Dependency
@@ -49,9 +43,6 @@ dependencies:
49
43
  requirement: !ruby/object:Gem::Requirement
50
44
  requirements:
51
45
  - - "~>"
52
- - !ruby/object:Gem::Version
53
- version: '0'
54
- - - ">="
55
46
  - !ruby/object:Gem::Version
56
47
  version: '0.3'
57
48
  type: :runtime
@@ -59,9 +50,6 @@ dependencies:
59
50
  version_requirements: !ruby/object:Gem::Requirement
60
51
  requirements:
61
52
  - - "~>"
62
- - !ruby/object:Gem::Version
63
- version: '0'
64
- - - ">="
65
53
  - !ruby/object:Gem::Version
66
54
  version: '0.3'
67
55
  - !ruby/object:Gem::Dependency
@@ -171,6 +159,7 @@ extra_rdoc_files: []
171
159
  files:
172
160
  - ".gitignore"
173
161
  - ".hound.yml"
162
+ - ".rubocop.yml"
174
163
  - ".travis.yml"
175
164
  - Changelog.md
176
165
  - Gemfile
@@ -245,6 +234,7 @@ files:
245
234
  - spec/dummy/public/422.html
246
235
  - spec/dummy/public/500.html
247
236
  - spec/dummy/public/favicon.ico
237
+ - spec/fixtures/fanout_series.json
248
238
  - spec/metrics/fanout_spec.rb
249
239
  - spec/metrics/metrics_spec.rb
250
240
  - spec/metrics/relation_spec.rb