Browse Source

Show reactivate user link for deactivated users

pull/624/head
Kat 3 years ago
parent
commit
47c0538449
  1. 2
      app/views/users/show.html.erb
  2. 19
      spec/requests/users_controller_spec.rb

2
app/views/users/show.html.erb

@ -9,7 +9,7 @@
<% if @user.active? %>
<%= govuk_link_to "Deactivate user", "/users/#{@user.id}/deactivate" %>
<% else %>
<span class="app-!-colour-muted govuk-!-margin-right-2">This user has been deactivated.</span>
<span class="app-!-colour-muted govuk-!-margin-right-2">This user has been deactivated. <%= govuk_link_to "Reactivate user", "/users/#{@user.id}/reactivate" %></span>
<% end %>
<% end %>

19
spec/requests/users_controller_spec.rb

@ -515,6 +515,10 @@ RSpec.describe UsersController, type: :request do
it "shows if user is not active" do
expect(page).to have_content("This user has been deactivated.")
end
it "allows reactivating the user" do
expect(page).to have_link("Reactivate user", href: "/users/#{other_user.id}/reactivate")
end
end
end
@ -1086,6 +1090,21 @@ RSpec.describe UsersController, type: :request do
it "allows deactivating the user" do
expect(page).to have_link("Deactivate user", href: "/users/#{other_user.id}/deactivate")
end
context "when user is deactivated" do
before do
other_user.update!(active: false)
get "/users/#{other_user.id}", headers:, params: {}
end
it "shows if user is not active" do
expect(page).to have_content("This user has been deactivated.")
end
it "allows reactivating the user" do
expect(page).to have_link("Reactivate user", href: "/users/#{other_user.id}/reactivate")
end
end
end
context "when the user is not part of the same organisation as the current user" do

Loading…
Cancel
Save