Skip to content

Commit

Permalink
[#58160] fix existing sort helper specs
Browse files Browse the repository at this point in the history
  • Loading branch information
EinLama committed Dec 10, 2024
1 parent 80bd36d commit 1f25d4e
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions spec/helpers/sort_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -281,11 +281,7 @@ def session; @session ||= {}; end
end

describe "#sort_header_with_action_menu" do
subject(:output) do
helper.sort_header_with_action_menu("id",
%w[name id description], {}, **options)
end

let(:column) { Queries::Projects::Selects::Default.new "id" }
let(:options) { { param: :json, sortable: true } }
let(:sort_criteria) { SortHelper::SortCriteria.new }

Expand All @@ -295,6 +291,11 @@ def session; @session ||= {}; end
Nokogiri::HTML(output).at_css("th .generic-table--sort-header action-menu")
end

subject(:output) do
helper.sort_header_with_action_menu(column,
%w[name id description], {}, **options)
end

before do
# helper relies on this instance var
@sort_criteria = sort_criteria
Expand Down Expand Up @@ -343,7 +344,7 @@ def session; @session ||= {}; end

context "with the current column being the leftmost one" do
subject(:output) do
helper.sort_header_with_action_menu("id",
helper.sort_header_with_action_menu(column,
%w[id name description], {}, **options)
end

Expand All @@ -359,7 +360,7 @@ def session; @session ||= {}; end

context "with the current column being the rightmost one" do
subject(:output) do
helper.sort_header_with_action_menu("id",
helper.sort_header_with_action_menu(column,
%w[name description id], {}, **options)
end

Expand Down Expand Up @@ -397,7 +398,7 @@ def session; @session ||= {}; end

context "with a filter mapping for the column" do
subject(:output) do
helper.sort_header_with_action_menu("id",
helper.sort_header_with_action_menu(column,
%w[name id description], { "id" => "id_code" }, **options)
end

Expand All @@ -413,7 +414,7 @@ def session; @session ||= {}; end
context "with the filter mapping specifying there is no filter for the column" do
subject(:output) do
# With the filter name mapped to nil, we expect no filter action to be present.
helper.sort_header_with_action_menu("id",
helper.sort_header_with_action_menu(column,
%w[name id description], { "id" => nil }, **options)
end

Expand Down

0 comments on commit 1f25d4e

Please sign in to comment.