Skip to content
Draft
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
8 changes: 8 additions & 0 deletions features/admin-limit-access-editions.feature
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,11 @@ Feature: Viewing most recent editions in admin
And I check the "Limit access to publishers from organisations associated with this document before you publish" box
When I click "Save"
Then I should see the validation error "Access can only be limited by users belonging to an organisation tagged to the document"

Scenario: Attempting to change organisation when document is access limited
Given I am an editor in the organisation "Foo"
And I create an access limited document
When I set the Lead organisation to an org I am not in
When I click "Save"
Then I should see the validation error "Access can only be limited by users belonging to an organisation tagged to the document"
And I should still be able to access the document
13 changes: 13 additions & 0 deletions features/step_definitions/admin_limit_access_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,16 @@
Then(/^I should see the validation error "(.+)"$/) do |string|
expect(page).to have_content string
end

Given(/^I create an access limited document$/) do
step "I begin drafting a new document"
step "I check the \"Limit access to publishers from organisations associated with this document before you publish\" box"
step "I click \"Save\""
end

Then(/^I should still be able to access the document$/) do
visit current_url # refresh
expect(page).not_to have_content "You do not have permission to access this page."
expect(page).to have_content "Test publication"
expect(Edition.last.organisations).to eq([@user.organisation])
end
Loading