Skip to content

Commit

Permalink
Merge pull request #92 from hathitrust/editable_contact
Browse files Browse the repository at this point in the history
Make contact editable
  • Loading branch information
moseshll authored Apr 7, 2021
2 parents 7b3f1ea + 1ff17f4 commit 9f65f8f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/controllers/ht_institutions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class HTInstitutionsController < ApplicationController
allowed_affiliations
shib_authncontext_class
emergency_status
emergency_contact
mapto_inst_id
mapto_name
us
Expand Down
16 changes: 16 additions & 0 deletions test/controllers/ht_institutions_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,22 @@ class HTInstitutionsControllerEditTest < ActionDispatch::IntegrationTest
assert_equal new_status, HTInstitution.find(inst.inst_id).emergency_status
end

test 'Can update emergency contact' do
new_contact = '[email protected]'
inst = create(:ht_institution, emergency_contact: '[email protected]')

patch ht_institution_url inst, params: {'ht_institution' => {'emergency_contact' => new_contact}}

assert_response :redirect
assert_equal 'update', @controller.action_name
assert_not_empty flash[:notice]
assert_redirected_to ht_institution_path(inst)
follow_redirect!

assert_match new_contact, @response.body
assert_equal new_contact, HTInstitution.find(inst.inst_id).emergency_contact
end

test 'Blank emergency status sets null' do
inst = create(:ht_institution, emergency_status: '^(member)@university.invalid')
patch ht_institution_url inst, params: {'ht_institution' => {'emergency_status' => ''}}
Expand Down

0 comments on commit 9f65f8f

Please sign in to comment.