Skip to content

Commit 235bf5e

Browse files
committed
Test env: fix ActionMailer preview_paths FrozenError and require fast_sqlite early for sqlite3 v2
1 parent 21ed972 commit 235bf5e

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

core/lib/spree/testing_support/dummy_app.rb

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@
33
ENV['RAILS_ENV'] = 'test'
44
ENV['DISABLE_DATABASE_ENVIRONMENT_CHECK'] = '1'
55

6+
# Ensure sqlite3 v2 is supported when running with the default sqlite adapter.
7+
# The `fast_sqlite` gem relaxes ActiveRecord's sqlite3 version constraints.
8+
begin
9+
require 'fast_sqlite'
10+
rescue LoadError
11+
# Gem not available, skip.
12+
end
13+
614
require 'rails'
715
require 'active_record/railtie'
816
require 'action_controller/railtie'
@@ -106,7 +114,10 @@ class Application < ::Rails::Application
106114

107115
# Set the preview path within the dummy app:
108116
if ActionMailer::Base.respond_to? :preview_paths # Rails 7.1+
109-
config.action_mailer.preview_paths << File.expand_path('dummy_app/mailer_previews', __dir__)
117+
# Some Rails versions return a frozen array here; assign a new array
118+
# to avoid FrozenError when augmenting the paths.
119+
existing = Array(config.action_mailer.preview_paths)
120+
config.action_mailer.preview_paths = existing + [File.expand_path('dummy_app/mailer_previews', __dir__)]
110121
else
111122
config.action_mailer.preview_path = File.expand_path('dummy_app/mailer_previews', __dir__)
112123
end

docker-compose.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: '3.7'
1+
version: "3.7"
22

33
services:
44
mysql:
@@ -18,12 +18,12 @@ services:
1818
- postgres:/var/lib/postgresql/data:cached
1919

2020
app:
21-
shm_size: '512mb'
21+
shm_size: "512mb"
2222
build:
2323
context: .dockerdev
2424
dockerfile: Dockerfile
2525
args:
26-
RUBY_VERSION: "3.1"
26+
RUBY_VERSION: "3.4.6"
2727
PG_VERSION: 13
2828
NODE_VERSION: 20
2929
MYSQL_VERSION: "8.0"

0 commit comments

Comments
 (0)