cosm-rb 0.2.02 → 0.2.03

Sign up to get free protection for your applications and to get access to all the features.
data/.rbenv-version CHANGED
@@ -1 +1 @@
1
- ruby-1.8.7-p249
1
+ ruby-1.8.7-p370
@@ -43,11 +43,12 @@ module Cosm
43
43
 
44
44
  private
45
45
 
46
+ # This is used by v2 only
46
47
  def extract_datastreams(rows)
47
48
  row_sizes = rows.collect { |row| row.size }.uniq
48
49
  row_ids = rows.collect { |row| row.first.to_s.strip }.uniq
49
50
 
50
- raise InvalidCSVError, "CSV is invalid. Incorrect number of fields" if row_sizes.max > 3
51
+ raise InvalidCSVError, "CSV is invalid. Incorrect number of fields" if row_sizes.max > 3 || row_sizes.min <= 1
51
52
 
52
53
  datastream_buckets = {}
53
54
 
@@ -1,3 +1,3 @@
1
1
  module Cosm #:nodoc:
2
- VERSION = '0.2.02'
2
+ VERSION = '0.2.03'
3
3
  end
@@ -37,6 +37,18 @@ describe "default feed csv parser" do
37
37
  feed.should fully_represent_feed(:csv_v1, csv)
38
38
  end
39
39
 
40
+ it "should accept explicit blank values for v2 csv" do
41
+ expect {
42
+ Cosm::Feed.new("stream_id,''", :v2)
43
+ }.to_not raise_error(Cosm::Parsers::CSV::InvalidCSVError)
44
+ end
45
+
46
+ it "should raise an error if passed some v2 csv that does not contain a value" do
47
+ expect {
48
+ Cosm::Feed.new("stream_id", :v2)
49
+ }.to raise_error(Cosm::Parsers::CSV::InvalidCSVError)
50
+ end
51
+
40
52
  it "should raise an error if passed some wild csv with more than max permitted three columns" do
41
53
  csv =<<-CSV
42
54
  Date-Time, System HOA,Jockey Pump HOA,VFD Pump HOA,Lag Pump HOA,Lag Pump 2 HOA,Power Monitor,Water Level Relay,High Discharge Pressure,Reset Function,Jockey Running,VFD Run,Lag Pump Run,VFD Fault,Filter In Auto,Filter In Hand,Differential Press 1,Filter 1 Running,High Limit Switch,Low Limit Switch,Lag Pump Running,VFD Run Output Auto,VFD Pump On,Lag Pump,Lag Pump 1 On,System Auto Mode,Fault,Lag Pump 2 Run,Jockey On,Jockey Pump Run,Lag Pump 2,Filter Forward,Filter Reverse,Filter Solenoid,Pressure,Flow,Unknown?,VFD Input,VFD Output,
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cosm-rb
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 17
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 2
10
- version: 0.2.02
9
+ - 3
10
+ version: 0.2.03
11
11
  platform: ruby
12
12
  authors:
13
13
  - Paul Bellamy
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2012-09-12 00:00:00 +00:00
20
+ date: 2012-11-27 00:00:00 +00:00
21
21
  default_executable:
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency
@@ -108,7 +108,7 @@ dependencies:
108
108
  requirements:
109
109
  - - ">="
110
110
  - !ruby/object:Gem::Version
111
- hash: 121
111
+ hash: -1810746622
112
112
  segments:
113
113
  - 1
114
114
  - 5