Skip to content

Commit

Permalink
Test that fails for the right reason
Browse files Browse the repository at this point in the history
It looks like maybe the `single_pickup` method in app/helpers/requests/application_helper.rb, specifically the `.to_json` called on the value, is causing a problem with this item, but removing it breaks other items, I'm not sure why this one is behaving differently
  • Loading branch information
maxkadel committed Jun 28, 2023
1 parent 7954672 commit 2bbd706
Show file tree
Hide file tree
Showing 4 changed files with 747 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/helpers/requests/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,7 @@ def single_pickup(is_charged, name, id, location)
else
''
end
# if we remove the `.json` it fixes our feature test, but breaks our other tests
hidden = hidden_field_tag name.to_s, "", value: { 'pick_up' => location[:gfa_pickup], 'pick_up_location_code' => location[:pick_up_location_code] }.to_json, class: 'single-pick-up-hidden', id: id
label = label_tag id, "Pick-up location: #{location[:label]}", class: 'single-pick-up', style: style.to_s
hidden + label
Expand Down
9 changes: 9 additions & 0 deletions spec/features/requests/request_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,16 @@
describe 'a mystery html item' do
xit 'does not display html as a string' do
stub_catalog_raw(bib_id: '993569343506421')
stub_single_holding_location('plasma$nb')
stub_availability_by_holding_id(bib_id: '993569343506421', holding_id: '22693661550006421')
visit('requests/993569343506421?aeon=false&mfhd=22693661550006421')
within('#request_user_supplied_22693661550006421') do
page.find("#requestable__delivery_mode_22693661550006421_print").click
expect(page).to have_selector('#fields-print__22693661550006421')
# This element should be rendered as html, not plain text
expect(page.body).not_to include('fields-print__22693661550006421_card')
expect(page).to have_selector('#fields-print__22693661550006421_card')
end
end
end

Expand Down
Loading

0 comments on commit 2bbd706

Please sign in to comment.