From 85d8394c7c1cf4df667e8f3ed32082e0f45d5ef0 Mon Sep 17 00:00:00 2001 From: JG Date: Tue, 7 Jun 2022 10:57:01 +0100 Subject: [PATCH] spec for item_label --- spec/helpers/item_label_helper_spec.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 spec/helpers/item_label_helper_spec.rb diff --git a/spec/helpers/item_label_helper_spec.rb b/spec/helpers/item_label_helper_spec.rb new file mode 100644 index 000000000..244b552c2 --- /dev/null +++ b/spec/helpers/item_label_helper_spec.rb @@ -0,0 +1,15 @@ +require "rails_helper" + +RSpec.describe ItemLabelHelper do + let(:item) { "organisation" } + + describe "get the correct label" do + it "returns singular when count is 1" do + expect(format_label(1, item)).to eq("organisation") + end + + it "returns plural when count greater than 1" do + expect(format_label(2, item)).to eq("organisations") + end + end +end