rexport 1.2.0 → 1.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
  SHA256:
3
- metadata.gz: 4b74f494058f073c3dbb32d53a74274bce5223f64d09c75ed971e9b0c2ba27a0
4
- data.tar.gz: 7b4eec86b8a911ce049bc8205f656fa0904d4b5f405eeb1475a07e6cdfe658e6
3
+ metadata.gz: 8cf8cb2fe8850f491ab8eb8a92d0034d1447babd6a4a79457acea80fcbec94fc
4
+ data.tar.gz: 2e646631a4c3673359f31bd222c43c32ed6fcb20813f7f6ac34d633005899628
5
5
  SHA512:
6
- metadata.gz: 9437e26f118ac7e267faa26e5b662d4391e09462501955b1d6c93e6eda8ceddf6c61a8c5e498b531d4da8e3eb6761984901e5b944f59f8dabc7bad288bd4f13c
7
- data.tar.gz: 7287f82ee398f49c45a424d0a7538127d96bdfb3cb5e6160cc9d19b72eca2688976af71db0731f898f6d5c73147c4de9954fc086ea6faccfe6f61800b8351210
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
- position = 0
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
@@ -1,3 +1,3 @@
1
1
  module Rexport
2
- VERSION = '1.2.0'
2
+ VERSION = '1.2.1'
3
3
  end
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.0
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: 2021-06-29 00:00:00.000000000 Z
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.1.2
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/unit/export_methods_test.rb
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/tree_node_test.rb
147
+ - test/unit/export_filter_methods_test.rb
149
148
  - test/unit/export_item_methods_test.rb
150
- - test/factories.rb
151
- - test/test_helper.rb
149
+ - test/unit/export_methods_test.rb
150
+ - test/unit/rexport_model_test.rb
151
+ - test/unit/tree_node_test.rb