Skip to content

Commit

Permalink
Moves rooms helper method for surface_area to ApplicationHelper
Browse files Browse the repository at this point in the history
  • Loading branch information
B-Rass committed Oct 29, 2024
1 parent 127f635 commit 7acf040
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
3 changes: 3 additions & 0 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# frozen_string_literal: true

module ApplicationHelper
def surface_area_with_suffix(surface_area)
"#{surface_area} #{t("surface_area.unit")}"
end
end
3 changes: 0 additions & 3 deletions app/helpers/rooms_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,4 @@ def calculated_menu_width(islet)
frame_width * (((nb_of_frames) / nb_of_lanes) + 1)
end

def surface_area_with_suffix(surface_area)
"#{surface_area} #{t("surface_area.unit")}"
end
end
9 changes: 9 additions & 0 deletions spec/helpers/application_helper_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# frozen_string_literal: true

require "rails_helper"

RSpec.describe ApplicationHelper do
describe "#surface_area_with_suffix" do
it { expect(helper.surface_area_with_suffix(300)).to eq("300 m²") }
end
end
2 changes: 0 additions & 2 deletions spec/helpers/rooms_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,5 @@
require "rails_helper"

RSpec.describe RoomsHelper do
describe "#surface_area_with_suffix" do
it { expect(helper.surface_area_with_suffix(300)).to eq("300 m²") }
end
end

0 comments on commit 7acf040

Please sign in to comment.