Browse Source

only display remove for other organisations

CLDC-2055-which-organisations-are-merging
Kat 2 years ago
parent
commit
61d406d239
  1. 1
      app/controllers/merge_controller.rb
  2. 2
      app/views/merge/organisations.html.erb
  3. 8
      spec/requests/organisations_controller_spec.rb

1
app/controllers/merge_controller.rb

@ -18,6 +18,7 @@ class MergeController < ApplicationController
@answer_options = answer_options
@merge = Merge.new(form_params)
@merging_organisations_list = Organisation.where(id: @merge.merging_organisations)
@organisation = Organisation.find(params[:id])
end
def answer_options

2
app/views/merge/organisations.html.erb

@ -23,11 +23,11 @@
<%= table.body do |body| %>
<%= body.row do |row| %>
<% row.cell(text: merging_organisation.name) %>
<% if current_user.data_coordinator? || current_user.support? %>
<% row.cell(html_attributes: {
scope: "row",
class: "govuk-!-text-align-right",
}) do %>
<% if @organisation.id != merging_organisation.id %>
<%= govuk_link_to("Remove", merge_organisations_organisation_path) %>
<% end %>
<% end %>

8
spec/requests/organisations_controller_spec.rb

@ -489,6 +489,10 @@ RSpec.describe OrganisationsController, type: :request do
expect(page).to have_css("table tr", text: organisation.name)
expect(page).not_to have_css("table tr", text: unauthorised_organisation.name)
end
it "does not have a remove link" do
expect(page).not_to have_link("Remove")
end
end
context "and the page is loaded after adding a new merging organisation" do
@ -498,6 +502,10 @@ RSpec.describe OrganisationsController, type: :request do
expect(page).to have_css("table tr", text: organisation.name)
expect(page).to have_css("table tr", text: unauthorised_organisation.name)
end
it "has a remove link" do
expect(page).to have_link("Remove", href: "/organisations/#{organisation.id}/merge/organisations")
end
end
end
end

Loading…
Cancel
Save