From d8739c3a120d929727a59a28f892a877e1f970ce Mon Sep 17 00:00:00 2001 From: Didier Lafforgue Date: Tue, 6 Feb 2024 18:01:21 +0100 Subject: [PATCH] fix: fix the locale serializer in Rails 7.0.x --- .github/workflows/verify.yml | 2 +- Gemfile.legacy => Gemfile.rails_6_0 | 0 Gemfile.legacy.lock => Gemfile.rails_6_0.lock | 92 ++--- Gemfile.rails_7_0 | 51 +++ Gemfile.rails_7_0.lock | 322 ++++++++++++++++++ app/models/maglev/site/locales_concern.rb | 2 +- spec/dummy/config/environments/test.rb | 2 +- spec/factories/maglev/assets.rb | 4 +- spec/factories/products.rb | 2 +- spec/models/maglev/asset_spec.rb | 2 +- spec/rails_helper.rb | 2 +- spec/requests/maglev/api/assets_spec.rb | 2 +- spec/requests/maglev/page_preview_spec.rb | 2 +- 13 files changed, 436 insertions(+), 49 deletions(-) rename Gemfile.legacy => Gemfile.rails_6_0 (100%) rename Gemfile.legacy.lock => Gemfile.rails_6_0.lock (83%) create mode 100644 Gemfile.rails_7_0 create mode 100644 Gemfile.rails_7_0.lock diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml index cfd9784..158599f 100644 --- a/.github/workflows/verify.yml +++ b/.github/workflows/verify.yml @@ -20,7 +20,7 @@ jobs: strategy: matrix: node: [18] - gemfile: ["Gemfile.legacy", "Gemfile"] + gemfile: ["Gemfile.rails_6", "Gemfile.rails_7", "Gemfile"] steps: - name: Checkout code diff --git a/Gemfile.legacy b/Gemfile.rails_6_0 similarity index 100% rename from Gemfile.legacy rename to Gemfile.rails_6_0 diff --git a/Gemfile.legacy.lock b/Gemfile.rails_6_0.lock similarity index 83% rename from Gemfile.legacy.lock rename to Gemfile.rails_6_0.lock index 2fcd6bc..8bf2e5d 100644 --- a/Gemfile.legacy.lock +++ b/Gemfile.rails_6_0.lock @@ -72,12 +72,12 @@ GEM tzinfo (~> 2.0) zeitwerk (~> 2.3) ast (2.4.2) - bcrypt (3.1.19) + bcrypt (3.1.20) builder (3.2.4) - concurrent-ruby (1.2.2) + concurrent-ruby (1.2.3) crass (1.0.6) date (3.3.4) - diff-lcs (1.5.0) + diff-lcs (1.5.1) docile (1.4.0) dry-cli (1.0.0) erubi (1.12.0) @@ -87,7 +87,7 @@ GEM factory_bot (~> 6.2.0) railties (>= 5.0.0) ffi (1.16.3) - generator_spec (0.9.4) + generator_spec (0.10.0) activesupport (>= 3.0.0) railties (>= 3.0.0) globalid (1.2.1) @@ -100,7 +100,7 @@ GEM jbuilder (2.11.5) actionview (>= 5.0.0) activesupport (>= 5.0.0) - json (2.6.3) + json (2.7.1) kaminari (1.2.2) activesupport (>= 4.1.0) kaminari-actionview (= 1.2.2) @@ -114,7 +114,7 @@ GEM kaminari-core (= 1.2.2) kaminari-core (1.2.2) language_server-protocol (3.17.0.3) - loofah (2.21.4) + loofah (2.22.0) crass (~> 1.0.2) nokogiri (>= 1.12.0) maglev-injectable (2.1.1) @@ -127,23 +127,31 @@ GEM method_source (1.0.0) mini_magick (4.12.0) mini_mime (1.1.5) - minitest (5.20.0) - net-imap (0.4.4) + minitest (5.22.0) + net-imap (0.4.10) date net-protocol net-pop (0.1.2) net-protocol net-protocol (0.2.2) timeout - net-smtp (0.4.0) + net-smtp (0.4.0.1) net-protocol - nio4r (2.5.9) - nokogiri (1.15.4-x86_64-darwin) + nio4r (2.7.0) + nokogiri (1.16.2-aarch64-linux) racc (~> 1.4) - nokogiri (1.15.4-x86_64-linux) + nokogiri (1.16.2-arm-linux) racc (~> 1.4) - parallel (1.23.0) - parser (3.2.2.4) + nokogiri (1.16.2-arm64-darwin) + racc (~> 1.4) + nokogiri (1.16.2-x86-linux) + racc (~> 1.4) + nokogiri (1.16.2-x86_64-darwin) + racc (~> 1.4) + nokogiri (1.16.2-x86_64-linux) + racc (~> 1.4) + parallel (1.24.0) + parser (3.3.0.5) ast (~> 2.4.1) racc pg (1.5.4) @@ -183,17 +191,17 @@ GEM thor (~> 1.0) rainbow (3.1.1) rake (13.1.0) - regexp_parser (2.8.2) + regexp_parser (2.9.0) rexml (3.2.6) - rspec-core (3.12.2) - rspec-support (~> 3.12.0) - rspec-expectations (3.12.3) + rspec-core (3.13.0) + rspec-support (~> 3.13.0) + rspec-expectations (3.13.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.12.0) - rspec-mocks (3.12.6) + rspec-support (~> 3.13.0) + rspec-mocks (3.13.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.12.0) - rspec-rails (6.0.3) + rspec-support (~> 3.13.0) + rspec-rails (6.1.1) actionpack (>= 6.1) activesupport (>= 6.1) railties (>= 6.1) @@ -201,37 +209,39 @@ GEM rspec-expectations (~> 3.12) rspec-mocks (~> 3.12) rspec-support (~> 3.12) - rspec-support (3.12.1) - rubocop (1.57.2) + rspec-support (3.13.0) + rubocop (1.60.2) json (~> 2.3) language_server-protocol (>= 3.17.0) parallel (~> 1.10) - parser (>= 3.2.2.4) + parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.8, < 3.0) rexml (>= 3.2.5, < 4.0) - rubocop-ast (>= 1.28.1, < 2.0) + rubocop-ast (>= 1.30.0, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 3.0) rubocop-ast (1.30.0) parser (>= 3.2.1.0) - rubocop-capybara (2.19.0) + rubocop-capybara (2.20.0) + rubocop (~> 1.41) + rubocop-factory_bot (2.25.1) rubocop (~> 1.41) - rubocop-factory_bot (2.24.0) - rubocop (~> 1.33) - rubocop-md (1.2.1) + rubocop-md (1.2.2) rubocop (>= 1.0) - rubocop-minitest (0.33.0) + rubocop-minitest (0.34.5) rubocop (>= 1.39, < 2.0) + rubocop-ast (>= 1.30.0, < 2.0) rubocop-packaging (0.5.2) rubocop (>= 1.33, < 2.0) - rubocop-performance (1.19.1) - rubocop (>= 1.7.0, < 2.0) - rubocop-ast (>= 0.4.0) - rubocop-rails (2.22.1) + rubocop-performance (1.20.2) + rubocop (>= 1.48.1, < 2.0) + rubocop-ast (>= 1.30.0, < 2.0) + rubocop-rails (2.23.1) activesupport (>= 4.2.0) rack (>= 1.1) rubocop (>= 1.33.0, < 2.0) + rubocop-ast (>= 1.30.0, < 2.0) rubocop-rails_config (1.16.0) rubocop (>= 1.57.0) rubocop-ast (>= 1.26.0) @@ -240,7 +250,7 @@ GEM rubocop-packaging (~> 0.5) rubocop-performance (~> 1.11) rubocop-rails (~> 2.0) - rubocop-rspec (2.25.0) + rubocop-rspec (2.26.1) rubocop (~> 1.40) rubocop-capybara (~> 2.17) rubocop-factory_bot (~> 2.22) @@ -275,10 +285,14 @@ GEM websocket-driver (0.7.6) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) - zeitwerk (2.6.12) + zeitwerk (2.6.13) PLATFORMS - x86_64-darwin-22 + aarch64-linux + arm-linux + arm64-darwin + x86-linux + x86_64-darwin x86_64-linux DEPENDENCIES @@ -299,4 +313,4 @@ DEPENDENCIES sprockets-rails BUNDLED WITH - 2.3.26 + 2.5.4 diff --git a/Gemfile.rails_7_0 b/Gemfile.rails_7_0 new file mode 100644 index 0000000..778c312 --- /dev/null +++ b/Gemfile.rails_7_0 @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +source 'https://rubygems.org' +git_source(:github) { |repo| "https://github.com/#{repo}.git" } + +# Declare your gem's dependencies in maglev.gemspec. +# Bundler will treat runtime dependencies like base dependencies, and +# development dependencies will be added by default to the :development group. +gemspec + +gem 'rails', '7.0.8' + +# Active Storage analyser +gem 'mini_magick', '~> 4.11' + +# Use Active Storage variant +gem 'image_processing', '~> 1.12.2' + +# Use Sprockets to deal with assets in the dummy app +gem "sprockets-rails" + +# Temporary use this branch because it solves a bug +# gem 'maglev-injectable', path: '../injectable' + +# Declare any dependencies that are still in development here instead of in +# your gemspec. These might include edge Rails or gems from your path or +# Git. Remember to move these dependencies to your gemspec before releasing +# your gem to rubygems.org. + +# To use a debugger +# gem 'byebug', group: [:development, :test] + +group :development, :test do + # Use SCSS for stylesheets + gem 'bcrypt' + + gem 'factory_bot_rails', '~> 6.2.0' + gem 'rspec-rails' + + gem 'rubocop', require: false + gem 'rubocop-rails_config' + gem 'rubocop-rspec' + + gem 'generator_spec' + + gem 'nokogiri', '>= 1.13.10' +end + +group :test do + gem 'simplecov', require: false +end diff --git a/Gemfile.rails_7_0.lock b/Gemfile.rails_7_0.lock new file mode 100644 index 0000000..fb7cc28 --- /dev/null +++ b/Gemfile.rails_7_0.lock @@ -0,0 +1,322 @@ +PATH + remote: . + specs: + maglevcms (1.5.1) + jbuilder (~> 2.11.2) + kaminari (~> 1.2.1) + maglev-injectable (~> 2.1.1) + rails (>= 6, < 7.2) + vite_rails (>= 3, < 4) + vite_ruby (>= 3.5) + +GEM + remote: https://rubygems.org/ + specs: + actioncable (7.0.8) + actionpack (= 7.0.8) + activesupport (= 7.0.8) + nio4r (~> 2.0) + websocket-driver (>= 0.6.1) + actionmailbox (7.0.8) + actionpack (= 7.0.8) + activejob (= 7.0.8) + activerecord (= 7.0.8) + activestorage (= 7.0.8) + activesupport (= 7.0.8) + mail (>= 2.7.1) + net-imap + net-pop + net-smtp + actionmailer (7.0.8) + actionpack (= 7.0.8) + actionview (= 7.0.8) + activejob (= 7.0.8) + activesupport (= 7.0.8) + mail (~> 2.5, >= 2.5.4) + net-imap + net-pop + net-smtp + rails-dom-testing (~> 2.0) + actionpack (7.0.8) + actionview (= 7.0.8) + activesupport (= 7.0.8) + rack (~> 2.0, >= 2.2.4) + rack-test (>= 0.6.3) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.2.0) + actiontext (7.0.8) + actionpack (= 7.0.8) + activerecord (= 7.0.8) + activestorage (= 7.0.8) + activesupport (= 7.0.8) + globalid (>= 0.6.0) + nokogiri (>= 1.8.5) + actionview (7.0.8) + activesupport (= 7.0.8) + builder (~> 3.1) + erubi (~> 1.4) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.1, >= 1.2.0) + activejob (7.0.8) + activesupport (= 7.0.8) + globalid (>= 0.3.6) + activemodel (7.0.8) + activesupport (= 7.0.8) + activerecord (7.0.8) + activemodel (= 7.0.8) + activesupport (= 7.0.8) + activestorage (7.0.8) + actionpack (= 7.0.8) + activejob (= 7.0.8) + activerecord (= 7.0.8) + activesupport (= 7.0.8) + marcel (~> 1.0) + mini_mime (>= 1.1.0) + activesupport (7.0.8) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 1.6, < 2) + minitest (>= 5.1) + tzinfo (~> 2.0) + ast (2.4.2) + bcrypt (3.1.20) + builder (3.2.4) + concurrent-ruby (1.2.3) + crass (1.0.6) + date (3.3.4) + diff-lcs (1.5.1) + docile (1.4.0) + dry-cli (1.0.0) + erubi (1.12.0) + factory_bot (6.2.1) + activesupport (>= 5.0.0) + factory_bot_rails (6.2.0) + factory_bot (~> 6.2.0) + railties (>= 5.0.0) + ffi (1.16.3) + generator_spec (0.10.0) + activesupport (>= 3.0.0) + railties (>= 3.0.0) + globalid (1.2.1) + activesupport (>= 6.1) + i18n (1.14.1) + concurrent-ruby (~> 1.0) + image_processing (1.12.2) + mini_magick (>= 4.9.5, < 5) + ruby-vips (>= 2.0.17, < 3) + jbuilder (2.11.5) + actionview (>= 5.0.0) + activesupport (>= 5.0.0) + json (2.7.1) + kaminari (1.2.2) + activesupport (>= 4.1.0) + kaminari-actionview (= 1.2.2) + kaminari-activerecord (= 1.2.2) + kaminari-core (= 1.2.2) + kaminari-actionview (1.2.2) + actionview + kaminari-core (= 1.2.2) + kaminari-activerecord (1.2.2) + activerecord + kaminari-core (= 1.2.2) + kaminari-core (1.2.2) + language_server-protocol (3.17.0.3) + loofah (2.22.0) + crass (~> 1.0.2) + nokogiri (>= 1.12.0) + maglev-injectable (2.1.1) + mail (2.8.1) + mini_mime (>= 0.1.1) + net-imap + net-pop + net-smtp + marcel (1.0.2) + method_source (1.0.0) + mini_magick (4.12.0) + mini_mime (1.1.5) + minitest (5.22.0) + net-imap (0.4.10) + date + net-protocol + net-pop (0.1.2) + net-protocol + net-protocol (0.2.2) + timeout + net-smtp (0.4.0.1) + net-protocol + nio4r (2.7.0) + nokogiri (1.16.2-aarch64-linux) + racc (~> 1.4) + nokogiri (1.16.2-arm-linux) + racc (~> 1.4) + nokogiri (1.16.2-arm64-darwin) + racc (~> 1.4) + nokogiri (1.16.2-x86-linux) + racc (~> 1.4) + nokogiri (1.16.2-x86_64-darwin) + racc (~> 1.4) + nokogiri (1.16.2-x86_64-linux) + racc (~> 1.4) + parallel (1.24.0) + parser (3.3.0.5) + ast (~> 2.4.1) + racc + pg (1.5.4) + racc (1.7.3) + rack (2.2.8) + rack-proxy (0.7.7) + rack + rack-test (2.1.0) + rack (>= 1.3) + rails (7.0.8) + actioncable (= 7.0.8) + actionmailbox (= 7.0.8) + actionmailer (= 7.0.8) + actionpack (= 7.0.8) + actiontext (= 7.0.8) + actionview (= 7.0.8) + activejob (= 7.0.8) + activemodel (= 7.0.8) + activerecord (= 7.0.8) + activestorage (= 7.0.8) + activesupport (= 7.0.8) + bundler (>= 1.15.0) + railties (= 7.0.8) + rails-dom-testing (2.2.0) + activesupport (>= 5.0.0) + minitest + nokogiri (>= 1.6) + rails-html-sanitizer (1.6.0) + loofah (~> 2.21) + nokogiri (~> 1.14) + railties (7.0.8) + actionpack (= 7.0.8) + activesupport (= 7.0.8) + method_source + rake (>= 12.2) + thor (~> 1.0) + zeitwerk (~> 2.5) + rainbow (3.1.1) + rake (13.1.0) + regexp_parser (2.9.0) + rexml (3.2.6) + rspec-core (3.13.0) + rspec-support (~> 3.13.0) + rspec-expectations (3.13.0) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.13.0) + rspec-mocks (3.13.0) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.13.0) + rspec-rails (6.1.1) + actionpack (>= 6.1) + activesupport (>= 6.1) + railties (>= 6.1) + rspec-core (~> 3.12) + rspec-expectations (~> 3.12) + rspec-mocks (~> 3.12) + rspec-support (~> 3.12) + rspec-support (3.13.0) + rubocop (1.60.2) + json (~> 2.3) + language_server-protocol (>= 3.17.0) + parallel (~> 1.10) + parser (>= 3.3.0.2) + rainbow (>= 2.2.2, < 4.0) + regexp_parser (>= 1.8, < 3.0) + rexml (>= 3.2.5, < 4.0) + rubocop-ast (>= 1.30.0, < 2.0) + ruby-progressbar (~> 1.7) + unicode-display_width (>= 2.4.0, < 3.0) + rubocop-ast (1.30.0) + parser (>= 3.2.1.0) + rubocop-capybara (2.20.0) + rubocop (~> 1.41) + rubocop-factory_bot (2.25.1) + rubocop (~> 1.41) + rubocop-md (1.2.2) + rubocop (>= 1.0) + rubocop-minitest (0.34.5) + rubocop (>= 1.39, < 2.0) + rubocop-ast (>= 1.30.0, < 2.0) + rubocop-packaging (0.5.2) + rubocop (>= 1.33, < 2.0) + rubocop-performance (1.20.2) + rubocop (>= 1.48.1, < 2.0) + rubocop-ast (>= 1.30.0, < 2.0) + rubocop-rails (2.23.1) + activesupport (>= 4.2.0) + rack (>= 1.1) + rubocop (>= 1.33.0, < 2.0) + rubocop-ast (>= 1.30.0, < 2.0) + rubocop-rails_config (1.16.0) + rubocop (>= 1.57.0) + rubocop-ast (>= 1.26.0) + rubocop-md + rubocop-minitest (~> 0.22) + rubocop-packaging (~> 0.5) + rubocop-performance (~> 1.11) + rubocop-rails (~> 2.0) + rubocop-rspec (2.26.1) + rubocop (~> 1.40) + rubocop-capybara (~> 2.17) + rubocop-factory_bot (~> 2.22) + ruby-progressbar (1.13.0) + ruby-vips (2.2.0) + ffi (~> 1.12) + simplecov (0.22.0) + docile (~> 1.1) + simplecov-html (~> 0.11) + simplecov_json_formatter (~> 0.1) + simplecov-html (0.12.3) + simplecov_json_formatter (0.1.4) + sprockets (4.2.1) + concurrent-ruby (~> 1.0) + rack (>= 2.2.4, < 4) + sprockets-rails (3.4.2) + actionpack (>= 5.2) + activesupport (>= 5.2) + sprockets (>= 3.0.0) + thor (1.3.0) + timeout (0.4.1) + tzinfo (2.0.6) + concurrent-ruby (~> 1.0) + unicode-display_width (2.5.0) + vite_rails (3.0.17) + railties (>= 5.1, < 8) + vite_ruby (~> 3.0, >= 3.2.2) + vite_ruby (3.5.0) + dry-cli (>= 0.7, < 2) + rack-proxy (~> 0.6, >= 0.6.1) + zeitwerk (~> 2.2) + websocket-driver (0.7.6) + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.5) + zeitwerk (2.6.13) + +PLATFORMS + aarch64-linux + arm-linux + arm64-darwin + x86-linux + x86_64-darwin + x86_64-linux + +DEPENDENCIES + bcrypt + factory_bot_rails (~> 6.2.0) + generator_spec + image_processing (~> 1.12.2) + maglevcms! + mini_magick (~> 4.11) + nokogiri (>= 1.13.10) + pg (~> 1.5.4) + rails (= 7.0.8) + rspec-rails + rubocop + rubocop-rails_config + rubocop-rspec + simplecov + sprockets-rails + +BUNDLED WITH + 2.5.4 diff --git a/app/models/maglev/site/locales_concern.rb b/app/models/maglev/site/locales_concern.rb index b9de035..da572a4 100644 --- a/app/models/maglev/site/locales_concern.rb +++ b/app/models/maglev/site/locales_concern.rb @@ -6,7 +6,7 @@ module Maglev::Site::LocalesConcern included do ## serializers ## - if Rails::VERSION::MAJOR > 6 + if Rails::VERSION::MAJOR >= 7 && Rails::VERSION::MINOR > 0 serialize :locales, coder: LocalesSerializer else serialize :locales, LocalesSerializer diff --git a/spec/dummy/config/environments/test.rb b/spec/dummy/config/environments/test.rb index ebc8012..151eab3 100644 --- a/spec/dummy/config/environments/test.rb +++ b/spec/dummy/config/environments/test.rb @@ -28,7 +28,7 @@ config.cache_store = :null_store # Raise exceptions instead of rendering exception templates. - config.action_dispatch.show_exceptions = if Rails::VERSION::MAJOR > 6 + config.action_dispatch.show_exceptions = if Rails::VERSION::MAJOR >= 7 && Rails::VERSION::MINOR > 0 :none else false diff --git a/spec/factories/maglev/assets.rb b/spec/factories/maglev/assets.rb index 0c7182a..eb5ff9f 100644 --- a/spec/factories/maglev/assets.rb +++ b/spec/factories/maglev/assets.rb @@ -2,9 +2,9 @@ FactoryBot.define do factory :asset, class: 'Maglev::Asset' do - file { Rack::Test::UploadedFile.new('spec/fixtures/files/asset.jpg', 'image/jpg') } + file { Rack::Test::UploadedFile.new('spec/fixtures/files/asset.jpg', 'image/jpeg') } filename { 'asset.jpg' } - content_type { 'image/jpg' } + content_type { 'image/jpeg' } end end diff --git a/spec/factories/products.rb b/spec/factories/products.rb index 775145c..c1146e7 100644 --- a/spec/factories/products.rb +++ b/spec/factories/products.rb @@ -5,7 +5,7 @@ sequence(:name) { |n| "Product ##{n.to_s.rjust(2, '0')}" } sequence(:sku) { |n| "sku-#{n}" } price { 42.0 } - thumbnail { Rack::Test::UploadedFile.new('spec/fixtures/files/asset.jpg', 'image/jpg') } + thumbnail { Rack::Test::UploadedFile.new('spec/fixtures/files/asset.jpg', 'image/jpeg') } trait :without_thumbnail do thumbnail { nil } diff --git a/spec/models/maglev/asset_spec.rb b/spec/models/maglev/asset_spec.rb index 12bfc15..be1e08d 100644 --- a/spec/models/maglev/asset_spec.rb +++ b/spec/models/maglev/asset_spec.rb @@ -14,7 +14,7 @@ asset.file.attach( io: File.open(Rails.root.join('../fixtures/files/asset.jpg').to_s), filename: 'asset.jpg', - content_type: 'image/jpg' + content_type: 'image/jpeg' ) end diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 41d3004..0d9d79a 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -46,7 +46,7 @@ end RSpec.configure do |config| # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures - if Rails::VERSION::MAJOR > 6 + if Rails::VERSION::MAJOR >= 7 && Rails::VERSION::MINOR > 0 config.fixture_paths = [File.join(File.dirname(__FILE__), 'fixtures')] else config.fixture_path = File.join(File.dirname(__FILE__), 'fixtures') diff --git a/spec/requests/maglev/api/assets_spec.rb b/spec/requests/maglev/api/assets_spec.rb index 74f268e..2c85e65 100644 --- a/spec/requests/maglev/api/assets_spec.rb +++ b/spec/requests/maglev/api/assets_spec.rb @@ -67,7 +67,7 @@ let(:params) do { asset: { - file: fixture_file_upload('asset.jpg', 'image/jpg', true) + file: fixture_file_upload('asset.jpg', 'image/jpeg', true) } } end diff --git a/spec/requests/maglev/page_preview_spec.rb b/spec/requests/maglev/page_preview_spec.rb index f972788..ac5c85e 100644 --- a/spec/requests/maglev/page_preview_spec.rb +++ b/spec/requests/maglev/page_preview_spec.rb @@ -129,7 +129,7 @@ context 'requesting a non HTML resource' do it 'lets Rails handle this' do expect do - get '/maglev/preview/unkown-image.jpg', headers: { "Content-Type": 'image/jpg' } + get '/maglev/preview/unkown-image.jpg', headers: { "Content-Type": 'image/jpeg' } end.to raise_error(ActionController::RoutingError) end end