sniff 0.1.8 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,14 +1,18 @@
1
1
  require 'time'
2
2
  require 'timeframe'
3
3
 
4
- Given /^an? (.+) (has|used) "(.+)" (of\s?)?"(.*)"$/ do |emitter, _, field, __, value|
4
+ Given /^an? (.+) emission$/ do |emitter|
5
5
  @emitter_class = emitter.gsub(/\s+/,'_').camelize
6
6
  @emitter_class = "#{@emitter_class}Record".constantize
7
+ @activity_hash = {}
8
+ end
9
+
10
+ Given /^an? (.+) (has|used) "(.+)" (of\s?)?"(.*)"$/ do |emitter, _, field, __, value|
11
+ Given "a #{emitter} emission"
7
12
  Given "it has \"#{field}\" of \"#{value}\""
8
13
  end
9
14
 
10
15
  Given /^it (has|used) "(.+)" (of\s?)?"(.*)"$/ do |_, field, __, value|
11
- @activity_hash ||= {}
12
16
  if value.present?
13
17
  methods = field.split('.')
14
18
  context = @activity_hash
@@ -38,11 +38,11 @@ When /^the "(.*)" committee is calculated$/ do |committee_name|
38
38
  args << []
39
39
  end
40
40
  @report = @committee.report *args
41
- if @report.nil?
42
- raise "The committee #{@committee.name} did not come to a conclusion. Characteristics: #{@characteristics.inspect}"
43
- else
41
+ # if @report.nil?
42
+ # raise "The committee #{@committee.name} did not come to a conclusion. Characteristics: #{@characteristics.inspect}"
43
+ # else
44
44
  @characteristics[committee_name.to_sym] = @report.andand.conclusion
45
- end
45
+ # end
46
46
  end
47
47
 
48
48
  Then /^the committee should have used quorum "(.*)"$/ do |quorum|
@@ -85,12 +85,19 @@ Then /^the conclusion of the committee should include "(.*)"$/ do |value|
85
85
  result.should_not be_nil
86
86
  end
87
87
 
88
- Then /^the conclusion of the committee should have a record identified with "(.*)" of "(.*)" and having "(.*)" of "(.*)"$/ do |id_field, id, field, value|
89
- id_field = id_field.to_sym
90
- records = @report.conclusion
91
- record = records.to_a.find { |r| equality? r.send(id_field), id }
92
- record.should_not be_nil
93
- compare_values record.send(field), value
88
+ Then /^the conclusion of the committee should have a( single)? record identified with "(.*)" of "(.*)" and having "(.*)" of "(.*)"$/ do |single, id_field, id, field, value|
89
+ if value.blank?
90
+ @report.should be_nil
91
+ else
92
+ id_field = id_field.to_sym
93
+ records = @report.conclusion
94
+ record = records.to_a.find { |r| equality? r.send(id_field), id }
95
+ record.should_not be_nil
96
+ compare_values record.send(field), value
97
+ if single
98
+ records.count.should == 1
99
+ end
100
+ end
94
101
  end
95
102
 
96
103
  Then /^the conclusion of the committee should have a record identified with "(.*)" of "(.*)" and having "(.*)" including "(.*)"$/ do |id_field, id, field, values|
@@ -25,10 +25,10 @@ def compare_values(a, b)
25
25
  a.should == b
26
26
  elsif b =~ /\d+\.\d+/
27
27
  b = b.to_f
28
- a.should be_close(b, 0.00001)
28
+ a.to_f.should be_close(b, 0.00001)
29
29
  elsif b =~ /^\d+$/
30
30
  b = b.to_i
31
- a.should == b
31
+ a.to_i.should == b
32
32
  else
33
33
  a.should == b
34
34
  end
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sniff
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 9
4
5
  prerelease: false
5
6
  segments:
6
7
  - 0
7
8
  - 1
8
- - 8
9
- version: 0.1.8
9
+ - 9
10
+ version: 0.1.9
10
11
  platform: ruby
11
12
  authors:
12
13
  - Derek Kastner
@@ -14,16 +15,18 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-08-20 00:00:00 -04:00
18
+ date: 2010-08-25 00:00:00 -04:00
18
19
  default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
21
22
  name: activerecord
22
23
  prerelease: false
23
24
  requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
24
26
  requirements:
25
27
  - - ">="
26
28
  - !ruby/object:Gem::Version
29
+ hash: -1848230024
27
30
  segments:
28
31
  - 3
29
32
  - 0
@@ -36,9 +39,11 @@ dependencies:
36
39
  name: activesupport
37
40
  prerelease: false
38
41
  requirement: &id002 !ruby/object:Gem::Requirement
42
+ none: false
39
43
  requirements:
40
44
  - - ">="
41
45
  - !ruby/object:Gem::Version
46
+ hash: -1848230024
42
47
  segments:
43
48
  - 3
44
49
  - 0
@@ -51,9 +56,11 @@ dependencies:
51
56
  name: sqlite3-ruby
52
57
  prerelease: false
53
58
  requirement: &id003 !ruby/object:Gem::Requirement
59
+ none: false
54
60
  requirements:
55
61
  - - ">="
56
62
  - !ruby/object:Gem::Version
63
+ hash: 27
57
64
  segments:
58
65
  - 1
59
66
  - 3
@@ -65,9 +72,11 @@ dependencies:
65
72
  name: common_name
66
73
  prerelease: false
67
74
  requirement: &id004 !ruby/object:Gem::Requirement
75
+ none: false
68
76
  requirements:
69
77
  - - ">="
70
78
  - !ruby/object:Gem::Version
79
+ hash: 17
71
80
  segments:
72
81
  - 0
73
82
  - 1
@@ -79,9 +88,11 @@ dependencies:
79
88
  name: earth
80
89
  prerelease: false
81
90
  requirement: &id005 !ruby/object:Gem::Requirement
91
+ none: false
82
92
  requirements:
83
93
  - - ">="
84
94
  - !ruby/object:Gem::Version
95
+ hash: 3
85
96
  segments:
86
97
  - 0
87
98
  - 0
@@ -93,9 +104,11 @@ dependencies:
93
104
  name: timeframe
94
105
  prerelease: false
95
106
  requirement: &id006 !ruby/object:Gem::Requirement
107
+ none: false
96
108
  requirements:
97
109
  - - ">="
98
110
  - !ruby/object:Gem::Version
111
+ hash: 15
99
112
  segments:
100
113
  - 0
101
114
  - 0
@@ -107,9 +120,11 @@ dependencies:
107
120
  name: bundler
108
121
  prerelease: false
109
122
  requirement: &id007 !ruby/object:Gem::Requirement
123
+ none: false
110
124
  requirements:
111
125
  - - ">="
112
126
  - !ruby/object:Gem::Version
127
+ hash: 3
113
128
  segments:
114
129
  - 0
115
130
  version: "0"
@@ -119,9 +134,11 @@ dependencies:
119
134
  name: jeweler
120
135
  prerelease: false
121
136
  requirement: &id008 !ruby/object:Gem::Requirement
137
+ none: false
122
138
  requirements:
123
139
  - - ">="
124
140
  - !ruby/object:Gem::Version
141
+ hash: 3
125
142
  segments:
126
143
  - 0
127
144
  version: "0"
@@ -131,9 +148,11 @@ dependencies:
131
148
  name: rake
132
149
  prerelease: false
133
150
  requirement: &id009 !ruby/object:Gem::Requirement
151
+ none: false
134
152
  requirements:
135
153
  - - ">="
136
154
  - !ruby/object:Gem::Version
155
+ hash: 3
137
156
  segments:
138
157
  - 0
139
158
  version: "0"
@@ -143,9 +162,11 @@ dependencies:
143
162
  name: rspec
144
163
  prerelease: false
145
164
  requirement: &id010 !ruby/object:Gem::Requirement
165
+ none: false
146
166
  requirements:
147
167
  - - ">="
148
168
  - !ruby/object:Gem::Version
169
+ hash: 62196417
149
170
  segments:
150
171
  - 2
151
172
  - 0
@@ -159,9 +180,11 @@ dependencies:
159
180
  name: rcov
160
181
  prerelease: false
161
182
  requirement: &id011 !ruby/object:Gem::Requirement
183
+ none: false
162
184
  requirements:
163
185
  - - ">="
164
186
  - !ruby/object:Gem::Version
187
+ hash: 3
165
188
  segments:
166
189
  - 0
167
190
  version: "0"
@@ -171,9 +194,11 @@ dependencies:
171
194
  name: rdoc
172
195
  prerelease: false
173
196
  requirement: &id012 !ruby/object:Gem::Requirement
197
+ none: false
174
198
  requirements:
175
199
  - - ">="
176
200
  - !ruby/object:Gem::Version
201
+ hash: 3
177
202
  segments:
178
203
  - 0
179
204
  version: "0"
@@ -183,9 +208,11 @@ dependencies:
183
208
  name: fast_timestamp
184
209
  prerelease: false
185
210
  requirement: &id013 !ruby/object:Gem::Requirement
211
+ none: false
186
212
  requirements:
187
213
  - - ">="
188
214
  - !ruby/object:Gem::Version
215
+ hash: 23
189
216
  segments:
190
217
  - 0
191
218
  - 0
@@ -221,6 +248,8 @@ files:
221
248
  - lib/test_support/db/fixtures/urbanities.csv
222
249
  - lib/test_support/db/fixtures/zip_codes.csv
223
250
  - README.markdown
251
+ - spec/lib/sniff/database_spec.rb
252
+ - spec/spec_helper.rb
224
253
  has_rdoc: true
225
254
  homepage: http://github.com/brighterplanet/sniff
226
255
  licenses: []
@@ -231,23 +260,27 @@ rdoc_options:
231
260
  require_paths:
232
261
  - lib
233
262
  required_ruby_version: !ruby/object:Gem::Requirement
263
+ none: false
234
264
  requirements:
235
265
  - - ">="
236
266
  - !ruby/object:Gem::Version
267
+ hash: 3
237
268
  segments:
238
269
  - 0
239
270
  version: "0"
240
271
  required_rubygems_version: !ruby/object:Gem::Requirement
272
+ none: false
241
273
  requirements:
242
274
  - - ">="
243
275
  - !ruby/object:Gem::Version
276
+ hash: 3
244
277
  segments:
245
278
  - 0
246
279
  version: "0"
247
280
  requirements: []
248
281
 
249
282
  rubyforge_project:
250
- rubygems_version: 1.3.6
283
+ rubygems_version: 1.3.7
251
284
  signing_key:
252
285
  specification_version: 3
253
286
  summary: Test support for Brighter Planet carbon gems