Add file import test
This commit is contained in:
parent
c31d015434
commit
1063aea4af
2 changed files with 23 additions and 0 deletions
|
|
@ -1,3 +1,4 @@
|
|||
# encoding: utf-8
|
||||
require_relative '../spec_helper'
|
||||
|
||||
describe 'supplier', :type => :feature do
|
||||
|
|
@ -58,6 +59,23 @@ describe 'supplier', :type => :feature do
|
|||
end
|
||||
expect(page).to have_content(article.name)
|
||||
end
|
||||
|
||||
it 'can import articles' do
|
||||
article_category.save!
|
||||
visit upload_supplier_articles_path(supplier)
|
||||
attach_file 'articles_file', Rails.root.join('spec/fixtures/foodsoft_file_01.csv')
|
||||
find('input[type="submit"]').click
|
||||
|
||||
expect(find("#articles_0_note").value).to eq "bio ◎"
|
||||
expect(find("#articles_1_name").value).to eq "Pijnboompitten"
|
||||
|
||||
4.times do |i|
|
||||
select article_category.name, :from => "articles_#{i}_article_category_id"
|
||||
end
|
||||
find('input[type="submit"]').click
|
||||
|
||||
expect(supplier.articles.count).to eq 4
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue