-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
413 User avatar upload validation error (#420)
* Fix avatarable form render after validation error * Add system tests for avatar upload * Update registration system test to match avatarable_form
- Loading branch information
Showing
3 changed files
with
39 additions
and
4 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
Binary file not shown.
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,37 @@ | ||
require "application_system_test_case" | ||
|
||
class RegistrationTest < ApplicationSystemTestCase | ||
setup do | ||
@user = create(:user, :verified_staff) | ||
@organization = @user.organization | ||
set_organization(@organization) | ||
|
||
visit root_url | ||
click_on "Log In" | ||
|
||
fill_in "Email", with: @user.email | ||
fill_in "Password", with: @user.password | ||
click_on "Log in" | ||
visit edit_user_registration_path | ||
end | ||
|
||
context "when uploading avatar" do | ||
should "return error for invalid file type/size" do | ||
attach_file("Attach picture", Rails.root + "test/fixtures/files/blank.pdf") | ||
fill_in "Current password", with: @user.password | ||
click_on "Update" | ||
|
||
alert = first("div.alert") | ||
|
||
assert !alert.nil? | ||
end | ||
|
||
should "direct to home index path with valid upload" do | ||
attach_file("Attach picture", Rails.root + "test/fixtures/files/test.png") | ||
fill_in "Current password", with: @user.password | ||
click_on "Update" | ||
|
||
assert_equal current_path, home_index_path | ||
end | ||
end | ||
end |