diff --git a/spec/dummy/app/avo/actions/test/no_confirmation_redirect.rb b/spec/dummy/app/avo/actions/test/no_confirmation_redirect.rb new file mode 100644 index 0000000000..82e2818fa0 --- /dev/null +++ b/spec/dummy/app/avo/actions/test/no_confirmation_redirect.rb @@ -0,0 +1,9 @@ +class 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 diff --git a/spec/dummy/app/avo/resources/user_resource.rb b/spec/dummy/app/avo/resources/user_resource.rb index a4e21b5f9c..77b96b2bdf 100644 --- a/spec/dummy/app/avo/resources/user_resource.rb +++ b/spec/dummy/app/avo/resources/user_resource.rb @@ -146,6 +146,7 @@ class UserResource < Avo::BaseResource action DownloadFile action PreUpdate action Update + action Test::NoConfirmationRedirect filter UserNamesFilter filter IsAdmin diff --git a/spec/system/avo/actions_spec.rb b/spec/system/avo/actions_spec.rb index e9203fe621..56361cfacc 100644 --- a/spec/system/avo/actions_spec.rb +++ b/spec/system/avo/actions_spec.rb @@ -133,27 +133,12 @@ describe "redirects when no confirmation" do it "redirects to hey page" do - original_dummy_action = Sub::DummyAction.dup - - 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" - - Sub.send(:remove_const, "DummyAction") - Sub.const_set("DummyAction", original_dummy_action) end end # let!(:roles) { { admin: false, manager: false, writer: false } }