require "rails_helper" RSpec.describe TabNavHelper do let(:organisation) { FactoryBot.create(:organisation) } let(:current_user) { FactoryBot.build(:user, organisation:) } let(:scheme) { FactoryBot.create(:scheme, service_name: "Some name") } let(:location) { FactoryBot.create(:location, scheme:) } describe "#user_cell" do it "returns user link and email separated by a newline character" do expected_html = "#{current_user.name}\nUser #{current_user.email}" expect(user_cell(current_user)).to match(expected_html) end end describe "#org_cell" do it "returns the users org name and role separated by a newline character" do expected_html = "DLUHC\nData provider" expect(org_cell(current_user)).to match(expected_html) end end describe "#location_cell" do it "returns the location link to the postcode with optional name" do expected_html = "#{location.postcode}\nLocation" expect(location_cell_postcode(location, scheme)).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" expect(scheme_cell(scheme)).to match(expected_html) end end end