active_admin_import 7.0.0 → 8.0.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/README.md +37 -3
- data/lib/active_admin_import/importer.rb +23 -20
- data/lib/active_admin_import/version.rb +1 -1
- metadata +3 -39
- data/.github/workflows/test.yml +0 -211
- data/.gitignore +0 -19
- data/.rubocop.yml +0 -43
- data/Gemfile +0 -37
- data/Rakefile +0 -5
- data/active_admin_import.gemspec +0 -22
- data/spec/fixtures/files/author.csv +0 -2
- data/spec/fixtures/files/author_broken_header.csv +0 -2
- data/spec/fixtures/files/author_invalid.csv +0 -2
- data/spec/fixtures/files/author_invalid_format.txt +0 -2
- data/spec/fixtures/files/authors.csv +0 -3
- data/spec/fixtures/files/authors_bom.csv +0 -3
- data/spec/fixtures/files/authors_invalid_db.csv +0 -3
- data/spec/fixtures/files/authors_invalid_model.csv +0 -3
- data/spec/fixtures/files/authors_no_headers.csv +0 -2
- data/spec/fixtures/files/authors_values_exceeded_headers.csv +0 -3
- data/spec/fixtures/files/authors_win1251_win_endline.csv +0 -3
- data/spec/fixtures/files/authors_with_ids.csv +0 -3
- data/spec/fixtures/files/authors_with_semicolons.csv +0 -3
- data/spec/fixtures/files/authors_with_tabs.tsv +0 -3
- data/spec/fixtures/files/empty.csv +0 -0
- data/spec/fixtures/files/only_headers.csv +0 -1
- data/spec/fixtures/files/post_comments.csv +0 -3
- data/spec/fixtures/files/posts.csv +0 -4
- data/spec/fixtures/files/posts_for_author.csv +0 -3
- data/spec/fixtures/files/posts_for_author_no_headers.csv +0 -2
- data/spec/import_result_spec.rb +0 -39
- data/spec/import_spec.rb +0 -734
- data/spec/model_spec.rb +0 -6
- data/spec/spec_helper.rb +0 -54
- data/spec/support/active_model_lint.rb +0 -15
- data/spec/support/admin.rb +0 -32
- data/spec/support/import_form_selectors.rb +0 -24
- data/spec/support/rails_template.rb +0 -71
- data/spec/support/test_app_paths.rb +0 -14
- data/tasks/test.rake +0 -30
data/spec/import_result_spec.rb
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
require 'spec_helper'
|
|
3
|
-
|
|
4
|
-
describe ActiveAdminImport::ImportResult do
|
|
5
|
-
context 'failed_message' do
|
|
6
|
-
let(:import_result) { ActiveAdminImport::ImportResult.new }
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
let(:failed_instances) do
|
|
10
|
-
[
|
|
11
|
-
Author.new(last_name: 'Doe').tap {|r| r.errors.add(:last_name, :taken) },
|
|
12
|
-
Author.new(name: "", last_name: 'Doe').tap {|r| r.errors.add(:name, :blank); r.errors.add(:last_name, :taken) },
|
|
13
|
-
Author.new.tap {|r| r.errors.add(:base, 'custom') }
|
|
14
|
-
]
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
before do
|
|
18
|
-
@result = double \
|
|
19
|
-
failed_instances: failed_instances
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
it 'should work without any failed instances' do
|
|
23
|
-
expect(import_result.failed_message).to eq('')
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
it 'should work' do
|
|
27
|
-
import_result.add(@result, 4)
|
|
28
|
-
expect(import_result.failed_message)
|
|
29
|
-
.to eq(
|
|
30
|
-
"Last name has already been taken - Doe ; Name can't be blank - , Last name has already been taken - Doe ; custom"
|
|
31
|
-
)
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
it 'should work on limit param' do
|
|
35
|
-
import_result.add(@result, 4)
|
|
36
|
-
expect(import_result.failed_message(limit: 1)).to eq('Last name has already been taken - Doe')
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
|
-
end
|