mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Use fixture_file_upload helper where possible
We can't use it in factories but in other places it's a nice shortcut.
This commit is contained in:
@@ -9,7 +9,7 @@ describe Api::V0::ProductImagesController, type: :controller do
|
||||
|
||||
describe "uploading an image" do
|
||||
let(:image) { black_logo_file }
|
||||
let(:pdf) { Rack::Test::UploadedFile.new(pdf_path, 'application/pdf') }
|
||||
let(:pdf) { fixture_file_upload(pdf_path, 'application/pdf') }
|
||||
let(:pdf_path) { Rails.public_path.join('Terms-of-service.pdf') }
|
||||
let(:product_without_image) { create(:product) }
|
||||
let(:product_with_image) { create(:product_with_image) }
|
||||
|
||||
@@ -14,7 +14,7 @@ module Api
|
||||
describe "removing terms and conditions file" do
|
||||
let(:terms_file_path) { Rails.public_path.join('Terms-of-service.pdf') }
|
||||
let(:terms_and_conditions_file) {
|
||||
Rack::Test::UploadedFile.new(terms_file_path, "application/pdf")
|
||||
fixture_file_upload(terms_file_path, "application/pdf")
|
||||
}
|
||||
let(:enterprise) { create(:enterprise, owner: enterprise_owner) }
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ require 'spec_helper'
|
||||
|
||||
describe TermsOfServiceFile do
|
||||
let(:pdf) { File.open(Rails.public_path.join('Terms-of-service.pdf')) }
|
||||
let(:upload) { Rack::Test::UploadedFile.new(pdf, "application/pdf") }
|
||||
let(:upload) { fixture_file_upload(pdf, "application/pdf") }
|
||||
|
||||
describe ".current" do
|
||||
it "returns nil" do
|
||||
|
||||
@@ -28,7 +28,7 @@ module OpenFoodNetwork
|
||||
end
|
||||
|
||||
def image(filename)
|
||||
Rack::Test::UploadedFile.new(Rails.root + "spec/support/fixtures" + filename)
|
||||
fixture_file_upload(Rails.root + "spec/support/fixtures" + filename)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -8,7 +8,7 @@ describe 'Terms of Service banner' do
|
||||
let(:admin_user) { create(:admin_user, terms_of_service_accepted_at: nil) }
|
||||
let(:test_file) { "Terms-of-service.pdf" }
|
||||
let(:pdf_upload) do
|
||||
Rack::Test::UploadedFile.new(Rails.public_path.join(test_file), "application/pdf")
|
||||
fixture_file_upload(Rails.public_path.join(test_file), "application/pdf")
|
||||
end
|
||||
|
||||
before do
|
||||
|
||||
@@ -126,10 +126,10 @@ describe "As a consumer, I want to checkout my order" do
|
||||
let(:system_terms_path) { Rails.public_path.join('Terms-of-service.pdf') }
|
||||
let(:shop_terms_path) { Rails.public_path.join('Terms-of-ServiceUK.pdf') }
|
||||
let(:system_terms) {
|
||||
Rack::Test::UploadedFile.new(system_terms_path, "application/pdf")
|
||||
fixture_file_upload(system_terms_path, "application/pdf")
|
||||
}
|
||||
let(:shop_terms) {
|
||||
Rack::Test::UploadedFile.new(shop_terms_path, "application/pdf")
|
||||
fixture_file_upload(shop_terms_path, "application/pdf")
|
||||
}
|
||||
|
||||
context "when none are required" do
|
||||
|
||||
@@ -90,7 +90,7 @@ describe "As a consumer I want to check out my cart" do
|
||||
pending 'login in as user' do
|
||||
let(:user) { create(:user) }
|
||||
let(:pdf_upload) {
|
||||
Rack::Test::UploadedFile.new(
|
||||
fixture_file_upload(
|
||||
Rails.public_path.join('Terms-of-service.pdf'),
|
||||
"application/pdf"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user