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. 10
      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 @answer_options = answer_options
@merge = Merge.new(form_params) @merge = Merge.new(form_params)
@merging_organisations_list = Organisation.where(id: @merge.merging_organisations) @merging_organisations_list = Organisation.where(id: @merge.merging_organisations)
@organisation = Organisation.find(params[:id])
end end
def answer_options def answer_options

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

@ -23,11 +23,11 @@
<%= table.body do |body| %> <%= table.body do |body| %>
<%= body.row do |row| %> <%= body.row do |row| %>
<% row.cell(text: merging_organisation.name) %> <% row.cell(text: merging_organisation.name) %>
<% if current_user.data_coordinator? || current_user.support? %> <% row.cell(html_attributes: {
<% row.cell(html_attributes: { scope: "row",
scope: "row", class: "govuk-!-text-align-right",
class: "govuk-!-text-align-right", }) do %>
}) do %> <% if @organisation.id != merging_organisation.id %>
<%= govuk_link_to("Remove", merge_organisations_organisation_path) %> <%= govuk_link_to("Remove", merge_organisations_organisation_path) %>
<% end %> <% end %>
<% 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).to have_css("table tr", text: organisation.name)
expect(page).not_to have_css("table tr", text: unauthorised_organisation.name) expect(page).not_to have_css("table tr", text: unauthorised_organisation.name)
end end
it "does not have a remove link" do
expect(page).not_to have_link("Remove")
end
end end
context "and the page is loaded after adding a new merging organisation" do 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: organisation.name)
expect(page).to have_css("table tr", text: unauthorised_organisation.name) expect(page).to have_css("table tr", text: unauthorised_organisation.name)
end end
it "has a remove link" do
expect(page).to have_link("Remove", href: "/organisations/#{organisation.id}/merge/organisations")
end
end end
end end
end end

Loading…
Cancel
Save