From ae6b9cd3bc23ec0875fe34d3b5efbd9fb3ccf0b0 Mon Sep 17 00:00:00 2001 From: LaRita Robinson Date: Tue, 19 Dec 2023 11:57:31 -0500 Subject: [PATCH] More spec fixes Menu presenter: removed html_options Application Helper: override for missing_translations now receives `false` when translation wasn't found rather than a string. --- app/helpers/application_helper.rb | 9 ++++++++- spec/presenters/hyku/menu_presenter_spec.rb | 6 +++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index e4cd54f18..7bbc7c3e3 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -26,6 +26,13 @@ def locale_for(type:, term:, record_class:) end def missing_translation(value, _options = {}) - value.include?('translation missing') + case value.class + when FalseClass, NilClass + true + when String + value.include?('translation missing') + else + raise "Unexpected value #{value.inspect}" + end end end diff --git a/spec/presenters/hyku/menu_presenter_spec.rb b/spec/presenters/hyku/menu_presenter_spec.rb index f1555a458..d2ee95ae7 100644 --- a/spec/presenters/hyku/menu_presenter_spec.rb +++ b/spec/presenters/hyku/menu_presenter_spec.rb @@ -125,7 +125,7 @@ let(:id) { "sample_id" } let(:icon_class) { "sample-icon-class" } let(:open) { true } - let(:html_options) { { class: "sample-class", data: { test: "test" } } } + let(:title) { "Cats" } let(:block) { proc { "
  • Item
  • " } } let(:presenter) { instance_double("CollapsableSectionPresenter") } @@ -137,13 +137,13 @@ id:, icon_class:, open:, - html_options: + title: ).and_return(presenter) end it "calls the render method on the CollapsableSectionPresenter with the given block" do expect(presenter).to receive(:render) - instance.collapsable_section(text, id:, icon_class:, open:, **html_options, &block) + instance.collapsable_section(text, id:, icon_class:, open:, title:, &block) end end end