Skip to content

Commit

Permalink
Fix admin promotions controller
Browse files Browse the repository at this point in the history
This controller still did not know how what to authorize against, and
wanted to visit a URL that doesn't exist when clicking on a promotion.

This fixes both and adds a test helper, `#click_row` that clicks a row
without selecting it for batch editing purposes.
  • Loading branch information
mamhoff committed Nov 19, 2024
1 parent 583b17c commit 77126cc
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions admin/lib/solidus_admin/testing_support/feature_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ def find_row(text)
find('table tbody tr', text:)
end

def click_row(text)
find('table tbody tr td', text: text).click
end

def find_row_checkbox(text)
find_row(text).find('td:first-child input[type="checkbox"]')
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def search_url
end

def row_url(promotion)
solidus_promotions.admin_promotion_path(promotion)
solidus_promotions.edit_admin_promotion_path(promotion)
end

def page_actions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,9 @@
expect(page).to have_content("Promotions were successfully removed.")
expect(page).not_to have_content("My active Promotion")
expect(SolidusPromotions::Promotion.count).to eq(3)

click_row("My future Promotion")
expect(page).to have_content("My future Promotion")
expect(page).to have_content("Starts at")
end
end

0 comments on commit 77126cc

Please sign in to comment.