Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,6 @@ COPY --chown=ruby:ruby --from=build /app /app
COPY --chown=ruby:ruby ./docker/eu-west-2-bundle.pem /home/ruby/.postgresql/root.crt

RUN mkdir -p "/app/tmp/" && chown ruby:ruby "/app/tmp/" && chown ruby:ruby "/app/db/"
VOLUME "/tmp/"
VOLUME "/app/tmp/"
VOLUME "/app/db/"

EXPOSE 3000

Expand Down
9 changes: 1 addition & 8 deletions app/controllers/mou_signatures_controller.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
class MouSignaturesController < WebController
before_action :set_agreement_type, except: %i[index]
after_action :verify_authorized, only: %i[index]

def index
authorize MouSignature, :can_manage_mous?
@mou_signatures = MouSignature.all
render template: "mou_signatures/index", locals: { mou_signatures: @mou_signatures }
end
before_action :set_agreement_type

def show
@mou_signature = current_user.current_organisation_mou_signature
Expand Down
6 changes: 3 additions & 3 deletions app/controllers/sitemap_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ def index
render locals: { active_groups:,
trial_groups:,
should_show_users_link: should_show_users?,
should_show_mous_link: should_show_mous_link?,
should_show_organisations_link: should_show_organisations_link?,
should_show_reports_link: should_show_reports_link? }
end

def should_show_users?
Pundit.policy(current_user, :user).can_manage_user?
end

def should_show_mous_link?
Pundit.policy(current_user, :mou_signature).can_manage_mous?
def should_show_organisations_link?
Pundit.policy(current_user, :organisation).can_view_organisations?
end

def should_show_reports_link?
Expand Down
5 changes: 0 additions & 5 deletions app/policies/mou_signature_policy.rb

This file was deleted.

11 changes: 0 additions & 11 deletions app/services/navigation_items_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ def navigation_items

navigation_items = [
your_groups_navigation_item,
mou_navigation_item,
users_navigation_item,
organisations_navigation_item,
reports_navigation_item,
Expand All @@ -42,12 +41,6 @@ def your_groups_navigation_item
NavigationItem.new(text: I18n.t("header.your_groups"), href: "/", active: false)
end

def mou_navigation_item
return nil unless should_show_mous_link?

NavigationItem.new(text: I18n.t("header.mous"), href: mou_signatures_path, active: false)
end

def users_navigation_item
return nil unless should_show_user_profile_link?

Expand Down Expand Up @@ -96,10 +89,6 @@ def should_show_user_profile_link?
Pundit.policy(user, :user).can_manage_user?
end

def should_show_mous_link?
Pundit.policy(user, :mou_signature).can_manage_mous?
end

def should_show_organisations_link?
Pundit.policy(user, :organisation).can_view_organisations?
end
Expand Down
42 changes: 0 additions & 42 deletions app/views/mou_signatures/index.html.erb

This file was deleted.

4 changes: 2 additions & 2 deletions app/views/sitemap/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
</ul>
<% end %>

<% if should_show_mous_link %>
<h2 class="govuk-heading-m"><%= link_to t("page_titles.mou_signatures"), mou_signatures_path %></h2>
<% if should_show_organisations_link %>
<h2 class="govuk-heading-m"><%= link_to t("page_titles.organisations"), organisations_path %></h2>
<ul class="govuk-list govuk-list--spaced">
<li><%= link_to t("page_titles.mou_signature_new"), mou_signature_url %></li>
</ul>
Expand Down
4 changes: 0 additions & 4 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -928,7 +928,6 @@ en:
Guidance will be displayed at the top of the page, above your question.
</p>
header:
mous: MOUs
organisations: Organisations
product_name: Forms
reports: Reports
Expand Down Expand Up @@ -1443,13 +1442,11 @@ en:
preamble_html: "<p>Someone from each organisation needs to agree to one of the GOV.UK Forms agreements before an organisation admin can be assigned or any groups upgraded to ‘active’.</p>\n"
share_mou_link_html: "<p>For Crown organisations, like government departments and executive agencies, share the Memorandum of Understanding:<br />%{mou_link}</p>\n"
share_non_crown_agreement_link_html: "<p>For non-crown organisations, like local authorities, share the GOV.UK Forms agreement:<br />%{agreement_link}</p>\n"
table_caption: Agreed MOUs and agreements
table_headings:
agreed_at: Agreed on
agreement_type: Agreement type
email: Email address
name: Name
organisation: Organisation
show:
crown:
banner:
Expand Down Expand Up @@ -1655,7 +1652,6 @@ en:
missing_draft_question: There’s a problem with this page
mou_signature_confirmation: You’ve agreed to the MOU
mou_signature_new: GOV.UK Forms Memorandum of Understanding
mou_signatures: MOUs and agreements
move_form: Move this form to a different group
name_settings: Ask for a person’s name
new_group: Give your group a name
Expand Down
2 changes: 0 additions & 2 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,6 @@
resource :contact_for_research, controller: :contact_for_research, only: %i[edit update]
end

resources :mou_signatures, only: %i[index], path: "mous"

resources :organisations, only: %i[index show]

resource :mou_signature, only: %i[new show create], path: "/memorandum-of-understanding", defaults: { agreement_type: :crown }, as: :mou_signature do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ def with_navigation_links
def with_super_admin_navigation_links
render(ServiceNavigationComponent::View.new(navigation_items: [
{ text: "Your groups", href: "/" },
{ text: "MOUs", href: "/mous" },
{ text: "Users", href: "/users" },
{ text: "Organisations", href: "/organisations" },
{ text: "Reports", href: "/reports" },
{ text: "Support", href: "/support" },
{ text: "A User", href: nil, classes: ["app-service-navigation__item--featured"] },
Expand Down
46 changes: 16 additions & 30 deletions spec/features/mou/upgrade_user_changes_mou_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,48 +3,34 @@
describe "Assign an organisation to a user with a signed MOU", type: :feature do
let(:user) { create :user, name: "Test User", organisation: nil }
let!(:mou_signature) { create(:mou_signature, user:, organisation: nil, created_at: Time.zone.parse("September 1, 2023")) }
let(:organisation) { create :organisation }
let!(:organisation) { create :organisation, slug: "department-for-testing" }

it "a logged in user can sign an MOU" do
it "assigning an organisation to a user adds it to their MOU" do
login_as_super_admin_user
when_i_visit_the_mou_index_page
then_i_can_see_the_mou_page
then_i_see_the_mou_with_no_organisation
then_i_visit_the_users_page
then_i_update_the_user_organisation
when_i_visit_the_mou_index_page
then_i_can_see_the_mou_page
when_i_update_the_user_organisation
then_i_visit_the_organisation_page
then_i_see_the_mou_with_organisation
end

private

def when_i_visit_the_mou_index_page
visit mou_signatures_path
end

def then_i_can_see_the_mou_page
expect(page).to have_text "MOUs and agreements"
end

def then_i_see_the_mou_with_no_organisation
expect(page).to have_text mou_signature.user.name
expect(page).to have_text mou_signature.user.email
expect(page).to have_text "No organisation"
def when_i_update_the_user_organisation
visit edit_user_path(user)
organisation_field = find_field "Organisation"
# The \n is important, it "presses enter" to confirm the autocomplete selection
organisation_field.fill_in with: "#{organisation.name}\n"
expect(organisation_field.value).to start_with organisation.name
click_button "Save"
end

def then_i_visit_the_users_page
click_link mou_signature.user.email
end

def then_i_update_the_user_organisation
fill_in "Organisation", with: "#{organisation.name}\n"
click_button "Save"
sleep 1
def then_i_visit_the_organisation_page
visit organisation_path(organisation)
end

def then_i_see_the_mou_with_organisation
expect(page).to have_text "MOUs and agreements"
expect(page).to have_text mou_signature.user.name
expect(page).to have_text organisation.name
expect(page).to have_link mou_signature.user.email
expect(page).to have_text "September 01, 2023"
end
end
37 changes: 15 additions & 22 deletions spec/features/mou/view_signed_mous_spec.rb
Original file line number Diff line number Diff line change
@@ -1,42 +1,35 @@
require "rails_helper"

describe "Check which MOUs have been signed", type: :feature do
let(:user) { super_admin_user }
let!(:mou_signatures) do
[create(:mou_signature, created_at: Time.zone.parse("October 12, 2023")),
create(:mou_signature, created_at: Time.zone.parse("September 1, 2023"))]
end
let(:organisation) { create :organisation, slug: "department-for-testing" }
let!(:mou_signature) { create(:mou_signature_for_organisation, organisation:, created_at: Time.zone.parse("October 12, 2023")) }

before do
login_as_super_admin_user
end

it "super_admin's can see the MOUs page" do
then_i_click_on_the_mou_link
then_i_can_see_the_mou_page
it "super_admin's can see an organisation's signed MOUs" do
then_i_click_on_the_organisations_link
then_i_click_on_the_organisation
then_i_can_see_the_mou_list
end

private

def then_i_can_see_the_mou_list
expect(page).to have_text mou_signatures.first.organisation.name
expect(page).to have_link mou_signatures.first.user.email
expect(page).to have_text mou_signatures.first.user.name
expect(page).to have_text "October 12, 2023"

expect(page).to have_text mou_signatures.second.organisation.name
expect(page).to have_link mou_signatures.second.user.email
expect(page).to have_text mou_signatures.second.user.name
expect(page).to have_text "September 01, 2023"
def then_i_click_on_the_organisations_link
visit root_path
click_link("Organisations")
end

def then_i_click_on_the_mou_link
visit root_path
click_link("MOUs")
def then_i_click_on_the_organisation
click_link organisation.name_with_abbreviation
end

def then_i_can_see_the_mou_page
def then_i_can_see_the_mou_list
expect(page).to have_text "MOUs and agreements"
expect(page).to have_text "Crown MOU"
expect(page).to have_text mou_signature.user.name
expect(page).to have_link mou_signature.user.email
expect(page).to have_text "October 12, 2023"
end
end
19 changes: 0 additions & 19 deletions spec/policies/mou_signature_policy_spec.rb

This file was deleted.

11 changes: 0 additions & 11 deletions spec/services/navigation_items_service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,11 @@

context "when user is present" do
let(:can_manage_user) { false }
let(:can_manage_mous) { false }
let(:can_view_reports) { false }
let(:can_view_organisations) { false }

before do
allow(Pundit).to receive(:policy).with(user, :user).and_return(instance_double(UserPolicy, can_manage_user?: can_manage_user))
allow(Pundit).to receive(:policy).with(user, :mou_signature).and_return(instance_double(MouSignaturePolicy, can_manage_mous?: can_manage_mous))
allow(Pundit).to receive(:policy).with(user, :report).and_return(instance_double(ReportPolicy, can_view_reports?: can_view_reports))
allow(Pundit).to receive(:policy).with(user, :organisation).and_return(instance_double(OrganisationPolicy, can_view_organisations?: can_view_organisations))
allow(Settings.forms_product_page).to receive(:support_url).and_return(support_url)
Expand All @@ -40,15 +38,6 @@
end
end

context "when user can manage mous" do
let(:can_manage_mous) { true }

it "includes mous in navigation items" do
mous_item = NavigationItemsService::NavigationItem.new(text: I18n.t("header.mous"), href: mou_signatures_path, active: false)
expect(service.navigation_items).to include(mous_item)
end
end

context "when user can view organisations" do
let(:can_view_organisations) { true }

Expand Down
Loading
Loading