mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-13 04:00:21 +00:00
Moves/Updates terms_of_service_files_spec into system
This commit is contained in:
@@ -1,46 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe "Terms of Service files" do
|
||||
include AuthenticationHelper
|
||||
|
||||
describe "as admin" do
|
||||
let(:test_file_path) { "public/Terms-of-service.pdf" }
|
||||
|
||||
before { login_as_admin }
|
||||
|
||||
it "can be reached via Configuration" do
|
||||
visit spree.edit_admin_general_settings_path
|
||||
click_link "Terms of Service"
|
||||
|
||||
expect(page).to have_content "No terms of services have been uploaded yet."
|
||||
expect(page).to have_content "your old Terms of service"
|
||||
expect(page).to have_link "Terms of service", href: "/Terms-of-service.pdf"
|
||||
end
|
||||
|
||||
it "can be uploaded" do
|
||||
visit admin_terms_of_service_files_path
|
||||
attach_file "Attachment", Rails.root.join(test_file_path)
|
||||
click_button "Create Terms of service file"
|
||||
|
||||
expect(page).to have_link "Terms of Service"
|
||||
end
|
||||
|
||||
it "provides Rails' standard action for a new file" do
|
||||
visit new_admin_terms_of_service_files_path
|
||||
expect(page).to have_button "Create Terms of service file"
|
||||
end
|
||||
|
||||
it "can delete the current file", js: true do
|
||||
attachment = File.open(Rails.root.join(test_file_path))
|
||||
TermsOfServiceFile.create!(attachment: attachment)
|
||||
|
||||
visit admin_terms_of_service_files_path
|
||||
|
||||
accept_alert { click_link "Delete" }
|
||||
|
||||
expect(page).to have_content "No terms of services have been uploaded yet."
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user