Skip to content

Commit

Permalink
More spec fixes
Browse files Browse the repository at this point in the history
Menu presenter: removed html_options
Application Helper: override for missing_translations now receives
`false` when translation wasn't found rather than a string.
  • Loading branch information
LaRita Robinson committed Dec 19, 2023
1 parent 5655df8 commit ae6b9cd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
9 changes: 8 additions & 1 deletion app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 3 additions & 3 deletions spec/presenters/hyku/menu_presenter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 { "<li>Item</li>" } }

let(:presenter) { instance_double("CollapsableSectionPresenter") }
Expand All @@ -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

0 comments on commit ae6b9cd

Please sign in to comment.