diff --git a/app/helpers/user_table_helper.rb b/app/helpers/user_table_helper.rb
new file mode 100644
index 000000000..867108556
--- /dev/null
+++ b/app/helpers/user_table_helper.rb
@@ -0,0 +1,12 @@
+module UserTableHelper
+ include GovukLinkHelper
+
+ def user_cell(user)
+ [govuk_link_to(user.name, user), user.email].join("\n")
+ end
+
+ def org_cell(user)
+ role = "#{user.role}"
+ [user.organisation.name, role].join("\n")
+ end
+end
diff --git a/app/javascript/styles/application.scss b/app/javascript/styles/application.scss
index a5eda4f44..28f46740f 100644
--- a/app/javascript/styles/application.scss
+++ b/app/javascript/styles/application.scss
@@ -20,3 +20,8 @@ $govuk-global-styles: true;
// display: block;
// border: 1px solid blue
// }
+
+//overrides
+.app-\!-colour-muted {
+ color: $govuk-secondary-text-colour !important;
+}
diff --git a/app/views/organisations/users.html.erb b/app/views/organisations/users.html.erb
index 4b27fe2d6..e8e319058 100644
--- a/app/views/organisations/users.html.erb
+++ b/app/views/organisations/users.html.erb
@@ -10,10 +10,8 @@
<% @organisation.users.each do |user| %>
<%= table.body do |body| %>
<%= body.row do |row|
- user_cell = [govuk_link_to(user.name, user), user.email].join("\n")
- org_cell = [user.organisation.name, user.role].join("\n")
- row.cell(text: simple_format(user_cell, {}, wrapper_tag: "div"))
- row.cell(text: simple_format(org_cell, {}, wrapper_tag: "div"))
+ row.cell(text: simple_format(user_cell(user), {}, wrapper_tag: "div"))
+ row.cell(text: simple_format(org_cell(user), {}, wrapper_tag: "div"))
row.cell(text: user.last_sign_in_at&.strftime("%d %b %Y") )
end %>
<% end %>
diff --git a/spec/factories/user.rb b/spec/factories/user.rb
index 6509c2457..36789715a 100644
--- a/spec/factories/user.rb
+++ b/spec/factories/user.rb
@@ -1,8 +1,10 @@
FactoryBot.define do
factory :user do
sequence(:email) { |i| "test#{i}@example.com" }
+ name { "Danny Rojas" }
password { "pAssword1" }
organisation
+ role { "Data Provider" }
created_at { Time.zone.now }
updated_at { Time.zone.now }
end
diff --git a/spec/helpers/user_table_helper_spec.rb b/spec/helpers/user_table_helper_spec.rb
new file mode 100644
index 000000000..6d8921a0f
--- /dev/null
+++ b/spec/helpers/user_table_helper_spec.rb
@@ -0,0 +1,19 @@
+require "rails_helper"
+
+RSpec.describe UserTableHelper do
+ let(:user) { FactoryBot.build(:user) }
+
+ describe "#user_cell" do
+ it "returns user link and email separated by a newline character" do
+ expected_html = "Danny Rojas\n#{user.email}"
+ expect(user_cell(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(user)).to match(expected_html)
+ end
+ end
+end