From 08223c2db8351da8a7f47c65a01f56d42fe3df85 Mon Sep 17 00:00:00 2001 From: JG Date: Mon, 4 Jul 2022 17:13:42 +0100 Subject: [PATCH] testing location cell --- spec/helpers/tab_nav_helper_spec.rb | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/spec/helpers/tab_nav_helper_spec.rb b/spec/helpers/tab_nav_helper_spec.rb index f1e483fd1..a4b5c3306 100644 --- a/spec/helpers/tab_nav_helper_spec.rb +++ b/spec/helpers/tab_nav_helper_spec.rb @@ -3,7 +3,8 @@ require "rails_helper" RSpec.describe TabNavHelper do let(:organisation) { FactoryBot.create(:organisation) } let(:user) { FactoryBot.build(:user, organisation:) } - let(:scheme) { FactoryBot.build(:scheme, service_name: "Some name") } + let(:scheme) { FactoryBot.create(:scheme, service_name: "Some name") } + let(:location) { FactoryBot.create(:location, scheme: scheme) } describe "#user_cell" do it "returns user link and email separated by a newline character" do @@ -19,9 +20,16 @@ RSpec.describe TabNavHelper do end end + describe "#location_cell" do + it "returns the location link to the postcode with optional name" do + expected_html = "#{location.postcode}\nLocation #{location.name}" + expect(location_cell(location)).to match(expected_html) + end + end + describe "#scheme_cell" do it "returns the scheme link service name and primary user group separated by a newline character" do - expected_html = "#{scheme.service_name}\nScheme #{scheme.primary_client_group}" + expected_html = "#{scheme.service_name}\nScheme #{scheme.primary_client_group}" expect(scheme_cell(scheme)).to match(expected_html) end end