Skip to content

Commit

Permalink
Merge pull request #5627 from elasticspoon/fix-volunteers-request-edi…
Browse files Browse the repository at this point in the history
…t-spec

fix: flaky volunteers edit request spec
  • Loading branch information
compwron authored Apr 25, 2024
2 parents 4c01d3d + b372fbf commit 9a3fe2f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions app/views/volunteers/_manage_supervisor.erb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<%= form_for SupervisorVolunteer.new, url: supervisor_volunteers_path(volunteer_id: @volunteer.id) do |form| %>
<div class="select-style-1">
<label for='supervisor_volunteer_supervisor_id'>Select a Supervisor</label>
<select name='supervisor_volunteer[supervisor_id]' class='form-control select2'>
<select name='supervisor_volunteer[supervisor_id]' id="supervisor_volunteer_supervisor_id" class='form-control select2'>
<% @supervisors.each do |supervisor| %>
<option value="<%= supervisor.id %>"><%= supervisor.display_name %></option>
<% end %>
Expand All @@ -38,4 +38,4 @@
<% end %>
</div>
</div>
</div>
</div>
6 changes: 4 additions & 2 deletions spec/requests/volunteers_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,11 @@

it "shows correct supervisor options", :aggregate_failures do
supervisors = create_list(:supervisor, 3, casa_org: organization)
supervisors.append(create(:supervisor, casa_org: organization, display_name: "O'Hara")) # test for HTML escaping

page = request.parsed_body.to_html
supervisors.each { |supervisor| expect(page).to include(CGI.escape_html(supervisor.display_name)) }
page = Nokogiri::HTML(subject.body)
names = page.css("#supervisor_volunteer_supervisor_id option").map(&:text)
expect(supervisors.map(&:display_name)).to match_array(names)
end
end

Expand Down

0 comments on commit 9a3fe2f

Please sign in to comment.