Browse Source

Hide toggle scheme button from child organisation

pull/1637/head
Kat 3 years ago
parent
commit
584d0e7637
  1. 2
      app/views/schemes/show.html.erb
  2. 3
      spec/requests/schemes_controller_spec.rb

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

@ -32,6 +32,6 @@
</div> </div>
<% end %> <% end %>
<% if FeatureToggle.scheme_toggle_enabled? %> <% if FeatureToggle.scheme_toggle_enabled? && user_can_edit_scheme?(current_user, @scheme) %>
<%= toggle_scheme_link(@scheme) %> <%= toggle_scheme_link(@scheme) %>
<% end %> <% end %>

3
spec/requests/schemes_controller_spec.rb

@ -339,6 +339,7 @@ RSpec.describe SchemesController, type: :request do
let!(:specific_scheme) { FactoryBot.create(:scheme, owning_organisation: parent_organisation) } let!(:specific_scheme) { FactoryBot.create(:scheme, owning_organisation: parent_organisation) }
before do before do
FactoryBot.create(:location, scheme: specific_scheme)
create(:organisation_relationship, parent_organisation:, child_organisation: user.organisation) create(:organisation_relationship, parent_organisation:, child_organisation: user.organisation)
get "/schemes/#{specific_scheme.id}" get "/schemes/#{specific_scheme.id}"
end end
@ -349,6 +350,8 @@ RSpec.describe SchemesController, type: :request do
it "does not allow editing the scheme" do it "does not allow editing the scheme" do
expect(page).not_to have_link("Change") expect(page).not_to have_link("Change")
expect(page).not_to have_content("Reactivate this scheme")
expect(page).not_to have_content("Deactivate this scheme")
end end
end end
end end

Loading…
Cancel
Save