Browse Source

Add mock s3 service

pull/2653/head
Manny Dinssa 2 years ago
parent
commit
841568562a
  1. 7
      spec/features/accessibility_spec.rb

7
spec/features/accessibility_spec.rb

@ -3,6 +3,7 @@ require "rails_helper"
RSpec.describe "Accessibility", js: true do
let(:user) { create(:user, :support) }
let!(:other_user) { create(:user, name: "new user", organisation: user.organisation, email: "new_user@example.com", confirmation_token: "abc") }
let(:mock_storage_service) { instance_double("S3Service") }
def find_routes(type, resource, subresource)
routes = Rails.application.routes.routes.select do |route|
@ -20,6 +21,7 @@ RSpec.describe "Accessibility", js: true do
end
before do
allow(Storage::S3Service).to receive(:new).and_return(mock_storage_service)
allow(user).to receive(:need_two_factor_authentication?).and_return(false)
sign_in(user)
end
@ -107,6 +109,7 @@ RSpec.describe "Accessibility", js: true do
log.save(validate: false)
end
allow(FormHandler.instance).to receive(:in_crossover_period?).and_return(true)
allow(mock_storage_service).to receive(:get_presigned_url).with(bulk_upload.identifier, 60, response_content_disposition: "attachment; filename=#{bulk_upload.filename}").and_return("http://example.com/lettings-logs/bulk-uploads/#{bulk_upload.id}/download")
end
it "is has accessible pages" do
@ -145,6 +148,10 @@ RSpec.describe "Accessibility", js: true do
}.uniq
end
before do
allow(mock_storage_service).to receive(:get_presigned_url).with(bulk_upload.identifier, 60, response_content_disposition: "attachment; filename=#{bulk_upload.filename}").and_return("http://example.com/sales-logs/bulk-uploads/#{bulk_upload.id}/download")
end
it "is has accessible pages" do
sales_log_paths.each do |path|
path += "?original_log_id=#{sales_log.id}" if path.include?("duplicate")

Loading…
Cancel
Save