|
|
|
@ -2,21 +2,21 @@ require "rails_helper" |
|
|
|
|
|
|
|
|
|
|
|
RSpec.describe TabNavHelper do |
|
|
|
RSpec.describe TabNavHelper do |
|
|
|
let(:organisation) { FactoryBot.create(:organisation) } |
|
|
|
let(:organisation) { FactoryBot.create(:organisation) } |
|
|
|
let(:user) { FactoryBot.build(:user, organisation:) } |
|
|
|
let(:current_user) { FactoryBot.build(:user, organisation:) } |
|
|
|
let(:scheme) { FactoryBot.create(:scheme, service_name: "Some name") } |
|
|
|
let(:scheme) { FactoryBot.create(:scheme, service_name: "Some name") } |
|
|
|
let(:location) { FactoryBot.create(:location, scheme:) } |
|
|
|
let(:location) { FactoryBot.create(:location, scheme:) } |
|
|
|
|
|
|
|
|
|
|
|
describe "#user_cell" do |
|
|
|
describe "#user_cell" do |
|
|
|
it "returns user link and email separated by a newline character" do |
|
|
|
it "returns user link and email separated by a newline character" do |
|
|
|
expected_html = "<a class=\"govuk-link\" href=\"/users\">#{user.name}</a>\n<span class=\"govuk-visually-hidden\">User </span><span class=\"govuk-!-font-weight-regular app-!-colour-muted\">#{user.email}</span>" |
|
|
|
expected_html = "<a class=\"govuk-link\" href=\"/users\">#{current_user.name}</a>\n<span class=\"govuk-visually-hidden\">User </span><span class=\"govuk-!-font-weight-regular app-!-colour-muted\">#{current_user.email}</span>" |
|
|
|
expect(user_cell(user)).to match(expected_html) |
|
|
|
expect(user_cell(current_user)).to match(expected_html) |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
describe "#org_cell" do |
|
|
|
describe "#org_cell" do |
|
|
|
it "returns the users org name and role separated by a newline character" do |
|
|
|
it "returns the users org name and role separated by a newline character" do |
|
|
|
expected_html = "DLUHC\n<span class=\"app-!-colour-muted\">Data provider</span>" |
|
|
|
expected_html = "DLUHC\n<span class=\"app-!-colour-muted\">Data provider</span>" |
|
|
|
expect(org_cell(user)).to match(expected_html) |
|
|
|
expect(org_cell(current_user)).to match(expected_html) |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|