rexport 1.2.0 → 1.2.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 +4 -4
- data/lib/rexport/export_methods.rb +3 -3
- data/lib/rexport/version.rb +1 -1
- data/test/factories.rb +20 -0
- data/test/unit/export_methods_test.rb +7 -0
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8cf8cb2fe8850f491ab8eb8a92d0034d1447babd6a4a79457acea80fcbec94fc
|
4
|
+
data.tar.gz: 2e646631a4c3673359f31bd222c43c32ed6fcb20813f7f6ac34d633005899628
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '08d2fd739cf9775d22295a57ba4ffd934da63079339f0b697ff923ecba958b2bf5c007987a5ade00756b56a758672d37b23482dc9151dbb610157be181761521'
|
7
|
+
data.tar.gz: '0359913d6d17b4303518284a54a5da8428a1c0b3ce871766fa117a37c063f5d739aa812a08e495689867502ca63be23e719405211eb2ea35b2c046dae006c6e7'
|
@@ -126,6 +126,8 @@ module Rexport #:nodoc:
|
|
126
126
|
|
127
127
|
def get_records(limit = nil)
|
128
128
|
get_export_values(export_model.where(build_conditions).includes(build_include).limit(limit))
|
129
|
+
rescue ActiveRecord::StatementInvalid => e
|
130
|
+
[[e.message]]
|
129
131
|
end
|
130
132
|
|
131
133
|
def seed_records(objects)
|
@@ -198,9 +200,7 @@ module Rexport #:nodoc:
|
|
198
200
|
end
|
199
201
|
end
|
200
202
|
|
201
|
-
|
202
|
-
rexport_fields.each do |rexport_field|
|
203
|
-
position += 1
|
203
|
+
rexport_fields.each.with_index(1) do |rexport_field, position|
|
204
204
|
export_item = export_items.detect { |i| i.rexport_field == rexport_field } || export_items.create(rexport_field: rexport_field)
|
205
205
|
export_item.update_attribute(:position, position) if set_position
|
206
206
|
end
|
data/lib/rexport/version.rb
CHANGED
data/test/factories.rb
CHANGED
@@ -54,6 +54,21 @@ module Rexport
|
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
57
|
+
factory :invalid_filtered_export, class: 'Export' do
|
58
|
+
name { 'Invalid Filtered Enrollment Export' }
|
59
|
+
model_class_name { 'Enrollment' }
|
60
|
+
export_items do |items|
|
61
|
+
%w(grade_export_item status_name_export_item).map do |item|
|
62
|
+
items.association(item)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
export_filters do |filters|
|
66
|
+
%w(invalid_filter).map do |filter|
|
67
|
+
filters.association(filter)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
57
72
|
factory :family_name_export_item, class: 'ExportItem' do
|
58
73
|
position { 1 }
|
59
74
|
name { 'Family Name' }
|
@@ -86,6 +101,11 @@ module Rexport
|
|
86
101
|
filter_field { 'status.name' }
|
87
102
|
value { 'active' }
|
88
103
|
end
|
104
|
+
|
105
|
+
factory :invalid_filter, class: 'ExportFilter' do
|
106
|
+
filter_field { 'invalid' }
|
107
|
+
value { '1' }
|
108
|
+
end
|
89
109
|
end
|
90
110
|
end
|
91
111
|
end
|
@@ -42,6 +42,13 @@ class ExportMethodsTest < ActiveSupport::TestCase
|
|
42
42
|
assert_equal [['1', 'active']], create(:filtered_export).records
|
43
43
|
end
|
44
44
|
|
45
|
+
test 'should return error message for records when export has an invalid filter' do
|
46
|
+
assert_equal(
|
47
|
+
[["SQLite3::SQLException: no such column: enrollments.invalid"]],
|
48
|
+
create(:invalid_filtered_export).records
|
49
|
+
)
|
50
|
+
end
|
51
|
+
|
45
52
|
test 'should call get_records' do
|
46
53
|
export = build(:export)
|
47
54
|
export.expects(:get_records).with(Rexport::SAMPLE_SIZE).returns(true)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rexport
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aaron Baldwin
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2022-09-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -135,17 +135,17 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
135
135
|
- !ruby/object:Gem::Version
|
136
136
|
version: '0'
|
137
137
|
requirements: []
|
138
|
-
rubygems_version: 3.
|
138
|
+
rubygems_version: 3.3.9
|
139
139
|
signing_key:
|
140
140
|
specification_version: 4
|
141
141
|
summary: Ruby on Rails gem to manage exports.
|
142
142
|
test_files:
|
143
|
-
- test/
|
143
|
+
- test/factories.rb
|
144
|
+
- test/test_helper.rb
|
144
145
|
- test/unit/data_field_test.rb
|
145
|
-
- test/unit/rexport_model_test.rb
|
146
|
-
- test/unit/export_filter_methods_test.rb
|
147
146
|
- test/unit/data_fields_test.rb
|
148
|
-
- test/unit/
|
147
|
+
- test/unit/export_filter_methods_test.rb
|
149
148
|
- test/unit/export_item_methods_test.rb
|
150
|
-
- test/
|
151
|
-
- test/
|
149
|
+
- test/unit/export_methods_test.rb
|
150
|
+
- test/unit/rexport_model_test.rb
|
151
|
+
- test/unit/tree_node_test.rb
|