This repository has been archived by the owner on Nov 29, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #473 from YaleSTC/472_import_csv_breaks
Import CSV breakage (472)
- Loading branch information
Showing
6 changed files
with
80 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -209,6 +209,7 @@ | |
post :restore | ||
post :search | ||
post :save_import | ||
post :verify_import | ||
end | ||
end | ||
resources :loc_groups do | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
require 'rails_helper' | ||
|
||
describe "CSV import" do | ||
before(:each) do | ||
full_setup | ||
sign_in(@admin.login) | ||
end | ||
|
||
it 'should import users in correct format' do | ||
# CSV file has two users with valid roles, one with invalid role. | ||
# Expected behavior: import two, fail to import the third, display errors. | ||
visit users_path | ||
click_link('Import from CSV') | ||
attach_file('file', Rails.root + 'spec/fixtures/user_import.csv') | ||
expect { | ||
click_button 'Upload' | ||
}.to change { | ||
User.count | ||
}.by(2) | ||
expect(page).to have_content('Invalid role', count: 1) # exactly one error | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Login,First Name,Nick Name,Last Name,Email,Employee Id,Role | ||
kma47,Khadija,"",Abdullah,[email protected],141616,admin_role | ||
yoa3,Yaw,"",Abu,[email protected],150833,ordinary_role | ||
aaa86,Angel,"",Aguilera,[email protected],157725,CT |