diff --git a/app/helpers/cms_helper.rb b/app/helpers/cms_helper.rb index 629a5c21ff..c511396364 100644 --- a/app/helpers/cms_helper.rb +++ b/app/helpers/cms_helper.rb @@ -1,7 +1,7 @@ module CmsHelper def cms_url(url) if Rails.env.development? - return url if url.starts_with?("http") + return url if url.starts_with?("http") || url.starts_with?("/test-images") "#{Rails.application.config.strapi_image_url}#{url}" else url diff --git a/app/services/cms/providers/strapi/mocks/image.rb b/app/services/cms/providers/strapi/mocks/image.rb index 85eacdaba9..f7a30e9629 100644 --- a/app/services/cms/providers/strapi/mocks/image.rb +++ b/app/services/cms/providers/strapi/mocks/image.rb @@ -3,10 +3,25 @@ module Providers module Strapi module Mocks class Image + include ActionView::Helpers::AssetUrlHelper + SIZES = { - medium: [750, 500], - small: [500, 300], - thumbnail: [250, 100] + large: { + size: [1000, 800], + url: "/test-images/large_test.png" + }, + medium: { + size: [750, 500], + url: "/test-images/medium_test.png" + }, + small: { + size: [500, 300], + url: "/test-images/small_test.png" + }, + thumbnail: { + size: [250, 100], + url: "/test-images/thumbail_test.png" + } } def self.as_model(caption: nil) @@ -40,20 +55,20 @@ def self.generate_data(caption: nil) ext: ".png", mime: "image/png", size: 137.23, - url: Faker::LoremFlickr.image(size: "1000x800") + url: SIZES[:large][:url] } end def self.format(name, hash_name, size) { ext: ".png", - url: Faker::LoremFlickr.image(size: SIZES[size].join("x")), + url: SIZES[size][:url], hash: hash_name, mime: "image/png", name: name, size: 390.03, - width: SIZES[size][0], - height: SIZES[size][1], + width: SIZES[size][:size][0], + height: SIZES[size][:size][1], sizeInBytes: 390028 } end diff --git a/public/test-images/large_test.png b/public/test-images/large_test.png new file mode 100644 index 0000000000..f17af2e087 Binary files /dev/null and b/public/test-images/large_test.png differ diff --git a/public/test-images/medium_test.png b/public/test-images/medium_test.png new file mode 100644 index 0000000000..49328cae16 Binary files /dev/null and b/public/test-images/medium_test.png differ diff --git a/public/test-images/small_test.png b/public/test-images/small_test.png new file mode 100644 index 0000000000..c303ffa500 Binary files /dev/null and b/public/test-images/small_test.png differ diff --git a/public/test-images/thumbnail_test.png b/public/test-images/thumbnail_test.png new file mode 100644 index 0000000000..6233e37203 Binary files /dev/null and b/public/test-images/thumbnail_test.png differ