Skip to content

Commit

Permalink
Added profile integration test for sorting gems in profile page alpha…
Browse files Browse the repository at this point in the history
…betically
  • Loading branch information
heyapricot committed Feb 20, 2024
1 parent dd7cdd7 commit 43b475e
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/integration/profile_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -177,4 +177,19 @@ def sign_out
assert page.has_content? "special note"
assert page.has_content? "request note"
end

test "sort gems alphabetically in profile" do
alphabetical_first = FactoryBot.create(:rubygem, name: "AGem", owners: [@user], downloads: 1)
alphabetical_last = FactoryBot.create(:rubygem, name: "ZGem", owners: [@user], downloads: 999)

visit profile_path(@user.handle)
dropdown = find(:element, "data-gem-sort-target": "select")
form = find(:element, "data-gem-sort-target": "form")
dropdown.select("Name")
# Submit form without button
Capybara::RackTest::Form.new(form.base.driver, form.native).submit({})
rubygem_links = page.all(:element, "a", class: "gems__gem__name")
assert rubygem_links.first.text == alphabetical_first.name
assert rubygem_links.last.text == alphabetical_last.name
end
end

0 comments on commit 43b475e

Please sign in to comment.