csv_model 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ccb22507d47dc2e7db940efdbb20d6366de3fb94
4
- data.tar.gz: b7c9bf17cfac53e97271d63f6d3ea78634b2f8f6
3
+ metadata.gz: b2c3dcb21cddf9d14f4d44336770c35d737c4165
4
+ data.tar.gz: 96510b317ed2ec88d19ad86a51ee15c1b1c5c8ce
5
5
  SHA512:
6
- metadata.gz: 05ee82ff370463e138682ac77425d21e3dff73b6a876c4588a681a0efe45069936ce0b03d823f75ef086d0334ffd99cba8a80706b58341ed2336bba0a6f6492a
7
- data.tar.gz: 31679c8cc0fc3314c9b27512940e1a2590997245791a41f33173c63887ea04d5a26b20c391621e795772130e81569676511dba30242dc8345365c193b8000cd9
6
+ metadata.gz: 565a7e1407cdcbbedcea280b6cf1cc63e050954275fd87b9c45e6b4073b69463aefc49baa77df3809f134259a69164ca6c95415e877fd8c40e4ed6e1e89a3de9
7
+ data.tar.gz: 90f26d172765c9b1e28f49cd85045f753c896b41d6ca77fc4fe47e9b9bbe5aa5ba5f0e41cd4225c778eec950eb6df5e4f11af60f1e66fc088e39fd930d82c970
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- csv_model (0.2.0)
4
+ csv_model (0.2.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -8,3 +8,10 @@ csv_model
8
8
  TODO: ability to have multiple alternate primary keys
9
9
 
10
10
  active_record?
11
+
12
+
13
+ gem build csv_model.gemspec
14
+ gem push csv_model-0.2.1.gem
15
+
16
+ gem install csv_model-0.2.1.gem
17
+ gem uninstall csv_model -v 0.2.0
@@ -25,7 +25,7 @@ module CSVModel
25
25
  end
26
26
 
27
27
  def errors
28
- duplicate_column_errors + illegal_column_errors + missing_column_errors + missing_key_column_errors
28
+ (duplicate_column_errors + illegal_column_errors + missing_column_errors + missing_key_column_errors).uniq
29
29
  end
30
30
 
31
31
  def has_column?(key)
@@ -170,7 +170,7 @@ module CSVModel
170
170
  end
171
171
 
172
172
  def primary_key_column_errors
173
- missing_primary_key_column_names.collect { |name| "Missing primary key column #{name}" }
173
+ missing_primary_key_column_names.collect { |name| "Missing column #{name}" }
174
174
  end
175
175
 
176
176
  def primary_key_column_keys
@@ -1,3 +1,3 @@
1
1
  module CSVModel
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
@@ -106,7 +106,12 @@ describe CSVModel::HeaderRow do
106
106
 
107
107
  it "returns required column message when header is missing required primary key columns" do
108
108
  subject = described_class.new(data, primary_key: ["Column Two"])
109
- expect(subject.errors).to eq(["Missing primary key column Column Two"])
109
+ expect(subject.errors).to eq(["Missing column Column Two"])
110
+ end
111
+
112
+ it "returns single message when column is missing required and primary key" do
113
+ subject = described_class.new(data, primary_key: ["Column Two"], required_columns: ["Column Two"])
114
+ expect(subject.errors).to eq(["Missing column Column Two"])
110
115
  end
111
116
 
112
117
  it "returns empty array when header is missing required primary key column but alternate is available" do
@@ -116,7 +121,7 @@ describe CSVModel::HeaderRow do
116
121
 
117
122
  it "returns required column message when header is missing required primary key and alternate is not available " do
118
123
  subject = described_class.new(data, primary_key: ["Column Two"], alternate_primary_key: ["Column Three"])
119
- expect(subject.errors).to eq(["Missing primary key column Column Two"])
124
+ expect(subject.errors).to eq(["Missing column Column Two"])
120
125
  end
121
126
  end
122
127
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: csv_model
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Chadwick