Spec: Admins/users can destroy only their authored documentables/imageables (#2375)
This commit is contained in:
@@ -60,13 +60,31 @@ shared_examples "documentable" do |documentable_factory_name, documentable_path,
|
||||
end
|
||||
end
|
||||
|
||||
scenario "Administrators cannot destroy documentables they have not authored" do
|
||||
login_as(administrator)
|
||||
visit send(documentable_path, arguments)
|
||||
|
||||
within "#tab-documents" do
|
||||
expect(page).not_to have_link("Destroy")
|
||||
end
|
||||
end
|
||||
|
||||
scenario "Users cannot destroy documentables they have not authored" do
|
||||
login_as(create(:user))
|
||||
visit send(documentable_path, arguments)
|
||||
|
||||
within "#tab-documents" do
|
||||
expect(page).not_to have_link("Destroy")
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context "Destroy" do
|
||||
|
||||
scenario "Should show success notice after successfull document upload" do
|
||||
scenario "Should show success notice after successful document upload" do
|
||||
login_as documentable.author
|
||||
|
||||
visit send(documentable_path, arguments)
|
||||
|
||||
Reference in New Issue
Block a user