Skip to content

Commit 34bbf78

Browse files
committed
added spec for csv options
1 parent de3d9c4 commit 34bbf78

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Name;Last name;Birthday
2+
John;Doe;1986-05-01
3+
Jane;Roe;1988-11-16

spec/import_spec.rb

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ def upload_file!(name, ext='csv')
4242
end
4343

4444
context "with hint defined" do
45-
let(:options){
46-
{template_object: ActiveAdminImport::Model.new( hint: "hint") }
45+
let(:options) {
46+
{template_object: ActiveAdminImport::Model.new(hint: "hint")}
4747
}
4848
it "renders hint at upload page" do
4949
expect(page).to have_content options[:template_object].hint
@@ -124,6 +124,17 @@ def upload_file!(name, ext='csv')
124124
end
125125

126126

127+
context "with semicolons separator" do
128+
let(:options) {
129+
{template_object: ActiveAdminImport::Model.new(csv_options: {col_sep: ";"})}
130+
}
131+
it "should import file" do
132+
upload_file!(:authors_with_semicolons)
133+
expect(page).to have_content "Successfully imported 2 authors"
134+
expect(Author.count).to eq(2)
135+
end
136+
end
137+
127138
end
128139

129140

0 commit comments

Comments
 (0)