rails_spreadsheet_reader 0.1.0 → 0.1.1
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.
- checksums.yaml +8 -8
- data/lib/rails_spreadsheet_reader/base.rb +1 -1
- data/lib/rails_spreadsheet_reader/version.rb +1 -1
- data/spec/base_spec.rb +10 -0
- data/spec/models/user_spreadsheet.rb +4 -0
- data/spec/row_collection_spec.rb +46 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
Nzc2ODllYzU0OGI0N2I4MzRhMDIzMmUzNTAxOWEzYWI4MjI2OWQ1MQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OTI2ODJlYTgzNDZlZjM4OTkzNDA3ZWRhNzQ1MWY5ODIxZjBjYmIxOQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MDIxMTAxMDM0ZjdiOTcyZTA0NjE5YmMwMzVjNGE3MjAzODc1NjNhNDlhNzFj
|
10
|
+
MzAwMTc4MDAxOTA1MTQ4ZGMyYjM0OWNmMmQ4OWM3NDJjMjJjOTNkZjMxNTZl
|
11
|
+
MzQzMjAxMmQxMjNhMjc5Nzg2MGMyMjQ5N2Y5ODhjMTg1OGU0MTQ=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
OTY3MDgwYmYwMjMwMTc5YzRmMWRjZDQ4ZTg1MGYwNDJjODc2YmRjZjgwZjBj
|
14
|
+
YjczYjdjZDMwMWQ0ZTUyNGNkMzFjYmVkOTgzNzgyMGNiOTQwNzhhZDUxZmI0
|
15
|
+
M2NlNzVmZDUzZmIwMjA2YWEwNmM4MDYxZGZmMTMwNGRjYzYxNGI=
|
data/spec/base_spec.rb
CHANGED
@@ -73,4 +73,14 @@ describe RailsSpreadsheetReader::Base do
|
|
73
73
|
expect(row_collection.errors.full_messages).to eq(["Email can't be blank"])
|
74
74
|
end
|
75
75
|
|
76
|
+
it 'copy_errors' do
|
77
|
+
user_spreadsheet = UserSpreadsheet.new
|
78
|
+
user_spreadsheet.errors.add(:username, 'is unique')
|
79
|
+
expect(user_spreadsheet.valid?).to eq(false)
|
80
|
+
expect(user_spreadsheet.invalid?).to eq(true)
|
81
|
+
valid = UserSpreadsheet.new
|
82
|
+
valid.copy_errors(user_spreadsheet)
|
83
|
+
expect(valid.valid?).to eq(false)
|
84
|
+
end
|
85
|
+
|
76
86
|
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require_relative 'models/invalid_column_spreadsheet'
|
3
|
+
require_relative 'models/user_spreadsheet'
|
4
|
+
require_relative 'models/user_invalid_spreadsheet'
|
5
|
+
require_relative 'models/empty_column_spreadsheet.rb'
|
6
|
+
|
7
|
+
describe RailsSpreadsheetReader::RowCollection do
|
8
|
+
|
9
|
+
it 'empty properties' do
|
10
|
+
collection = RailsSpreadsheetReader::RowCollection.new
|
11
|
+
expect(collection.rows).to eq([])
|
12
|
+
expect(collection.invalid?).to eq(false)
|
13
|
+
expect(collection.valid?).to eq(true)
|
14
|
+
expect(collection.errors).to eq(nil)
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'push rows' do
|
18
|
+
collection = RailsSpreadsheetReader::RowCollection.new
|
19
|
+
user_spreadsheet = UserSpreadsheet.new
|
20
|
+
collection.push(user_spreadsheet)
|
21
|
+
expect(collection.rows.count).to eq(1)
|
22
|
+
end
|
23
|
+
|
24
|
+
it 'push invalid rows' do
|
25
|
+
collection = RailsSpreadsheetReader::RowCollection.new
|
26
|
+
user_spreadsheet = UserSpreadsheet.new
|
27
|
+
user_spreadsheet.make_invalid
|
28
|
+
expect(user_spreadsheet.invalid?).to eq(true)
|
29
|
+
collection.push(user_spreadsheet)
|
30
|
+
expect(collection.valid?).to eq(false)
|
31
|
+
expect(collection.invalid?).to eq(true)
|
32
|
+
end
|
33
|
+
|
34
|
+
it 'set_invalid_row' do
|
35
|
+
collection = RailsSpreadsheetReader::RowCollection.new
|
36
|
+
row = UserSpreadsheet.new
|
37
|
+
model = UserSpreadsheet.new
|
38
|
+
model.make_invalid
|
39
|
+
collection.push(row)
|
40
|
+
collection.set_invalid_row(row, model)
|
41
|
+
expect(collection.valid?).to eq(false)
|
42
|
+
expect(collection.invalid?).to eq(true)
|
43
|
+
expect(collection.invalid_row).to_not eq(nil)
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_spreadsheet_reader
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- muzk
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-09-
|
11
|
+
date: 2015-09-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -120,6 +120,7 @@ files:
|
|
120
120
|
- spec/models/invalid_column_spreadsheet.rb
|
121
121
|
- spec/models/user_invalid_spreadsheet.rb
|
122
122
|
- spec/models/user_spreadsheet.rb
|
123
|
+
- spec/row_collection_spec.rb
|
123
124
|
- spec/spec_helper.rb
|
124
125
|
homepage: https://github.com/HasuSoftware/rails_spreadsheet_reader
|
125
126
|
licenses:
|
@@ -153,4 +154,5 @@ test_files:
|
|
153
154
|
- spec/models/invalid_column_spreadsheet.rb
|
154
155
|
- spec/models/user_invalid_spreadsheet.rb
|
155
156
|
- spec/models/user_spreadsheet.rb
|
157
|
+
- spec/row_collection_spec.rb
|
156
158
|
- spec/spec_helper.rb
|