diff --git a/app/controllers/admin/action_pages_controller.rb b/app/controllers/admin/action_pages_controller.rb index f1dd5592..29ceaff9 100644 --- a/app/controllers/admin/action_pages_controller.rb +++ b/app/controllers/admin/action_pages_controller.rb @@ -226,6 +226,6 @@ def filter_action_pages pages = pages.search(filter_params[:q]) if filter_params[:q].present? filters = filter_params[:action_filters].to_h || {} filters[:date_range] = filter_params[:date_range] - ActionPageFilters.run(relation: pages, **filters.transform_keys(&:to_sym)) + ActionPageFilters.run(relation: pages, **filters.deep_symbolize_keys.to_h) end end diff --git a/spec/support/javascript_helpers.rb b/spec/support/javascript_helpers.rb index 77426e65..611d3946 100644 --- a/spec/support/javascript_helpers.rb +++ b/spec/support/javascript_helpers.rb @@ -14,6 +14,6 @@ def fill_in_editor(locator, with:) def fill_in_select2(locator, with:) find(locator).sibling(".select2-container").click - find("li.select2-results__option[role=treeitem]", text: with).click + find("li.select2-results__option[role=option]", text: with).click end end diff --git a/spec/system/admin/action_index_spec.rb b/spec/system/admin/action_index_spec.rb new file mode 100644 index 00000000..ba4accf9 --- /dev/null +++ b/spec/system/admin/action_index_spec.rb @@ -0,0 +1,17 @@ +require "rails_helper" + +RSpec.describe "Admin action page index", type: :system, js: true do + before { warden_sign_in(FactoryBot.create(:admin_user)) } + + it "can filter actions" do + basic = FactoryBot.create(:action_page, title: "Filtered out") + email_action = FactoryBot.create(:action_page, enable_email: true) + + visit admin_action_pages_path + fill_in_select2("#action_filters_type", with: "email") + click_on "Search" + + expect(page).to have_content(email_action.title) + expect(page).not_to have_content(basic.title) + end +end