Skip to content

Commit

Permalink
chore: fix actions spec (#2068)
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul-Bob authored Nov 28, 2023
1 parent 367939e commit 191b5d1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 16 deletions.
9 changes: 9 additions & 0 deletions spec/dummy/app/avo/actions/test/no_confirmation_redirect.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class Avo::Actions::Test::NoConfirmationRedirect < Avo::BaseAction
self.name = "Test No Confirmation Redirect"
self.no_confirmation = true
self.standalone = true

def handle(**args)
redirect_to main_app.hey_path
end
end
1 change: 1 addition & 0 deletions spec/dummy/app/avo/resources/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ def actions
action Avo::Actions::ToggleAdmin
action Avo::Actions::Sub::DummyAction
action Avo::Actions::DownloadFile
action Avo::Actions::Test::NoConfirmationRedirect
end

def filters
Expand Down
17 changes: 1 addition & 16 deletions spec/system/avo/actions_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -151,27 +151,12 @@

describe "redirects when no confirmation" do
it "redirects to hey page" do
original_dummy_action = Avo::Actions::Sub::DummyAction.dup

Avo::Actions::Sub::DummyAction.class_eval do
self.no_confirmation = true

define_method(:redirect_handle) do |**args|
redirect_to main_app.hey_path
end

alias_method :handle, :redirect_handle
end

visit "/admin/resources/users"

click_on "Actions"
click_on "Dummy action"
click_on "Test No Confirmation Redirect"

expect(page).to have_text "hey en"

Avo::Actions::Sub.send(:remove_const, "DummyAction")
Avo::Actions::Sub.const_set("DummyAction", original_dummy_action)
end
end

Expand Down

0 comments on commit 191b5d1

Please sign in to comment.