Skip to content

Commit

Permalink
Proposal: don't rely on JS for this
Browse files Browse the repository at this point in the history
  • Loading branch information
pablobm committed Jun 25, 2020
1 parent 5071abb commit 4139752
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
9 changes: 8 additions & 1 deletion spec/features/log_entries_index_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,18 @@
end

scenario "user deletes record" do
create(:log_entry)
log_entry = create(:log_entry)

visit admin_log_entries_path
click_on t("administrate.actions.destroy")
expect(page).to have_text(
t(
"administrate.actions.destroy_resource",
name: LogEntryDashboard.new.display_resource(log_entry),
),
)

click_on t("administrate.actions.destroy")
expect(page).to have_flash(
t("administrate.controller.destroy.success", resource: "LogEntry"),
)
Expand Down
13 changes: 10 additions & 3 deletions spec/features/orders_index_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,20 @@
end

scenario "user deletes record" do
create(:order)
order = create(:order)

visit admin_orders_path
click_on t("administrate.actions.destroy")
expect(page).to have_text(
t(
"administrate.actions.destroy_resource",
name: OrderDashboard.new.display_resource(order),
),
)

click_on t("administrate.actions.destroy")
expect(page).to have_flash(
t("administrate.controller.destroy.success", resource: "Order")
t("administrate.controller.destroy.success", resource: "Order"),
)
end

Expand All @@ -61,7 +68,7 @@

visit admin_orders_path
click_on t("administrate.actions.destroy")

click_on t("administrate.actions.destroy")
expect(page).to have_flash(
"Cannot delete record because dependent payments exist", type: :error
)
Expand Down

0 comments on commit 4139752

Please sign in to comment.