Skip to content

Commit 628d631

Browse files
committed
[DigitalOcean] Stack level too deep issue
1 parent ec9d9be commit 628d631

File tree

7 files changed

+42
-12
lines changed

7 files changed

+42
-12
lines changed

Gemfile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,16 @@ gemspec
1616
# This Rails version will be the one used when running `bundle exec rake test` locally
1717
# Uncomment the line then run `bundle install`
1818
# gem "rails", "7.1.2"
19-
# gem 'sqlite3', '~> 1.7'
20-
# gem 'nokogiri', '~> 1.16', '>= 1.16.7'
19+
# gem "sqlite3", "~> 1.7"
20+
# gem "nokogiri", "~> 1.16", ">= 1.16.7"
2121

2222
group :development, :test do
2323
# To use a debugger:
2424
# gem 'byebug'
2525

26+
# To test S3 services
27+
# gem "aws-sdk-s3", require: false
28+
2629
# Linters
2730
gem "rubocop", "~> 1.71", ">= 1.71.1", require: false
2831
gem "rubocop-performance", "~> 1.23", ">= 1.23.1", require: false

Gemfile.lock

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -209,14 +209,11 @@ GEM
209209
simplecov_json_formatter (~> 0.1)
210210
simplecov-html (0.13.1)
211211
simplecov_json_formatter (0.1.4)
212-
sqlite3 (2.5.0-aarch64-linux-gnu)
213-
sqlite3 (2.5.0-aarch64-linux-musl)
214-
sqlite3 (2.5.0-arm-linux-gnu)
215-
sqlite3 (2.5.0-arm-linux-musl)
216-
sqlite3 (2.5.0-arm64-darwin)
217-
sqlite3 (2.5.0-x86_64-darwin)
218-
sqlite3 (2.5.0-x86_64-linux-gnu)
219-
sqlite3 (2.5.0-x86_64-linux-musl)
212+
sqlite3 (1.7.3-aarch64-linux)
213+
sqlite3 (1.7.3-arm-linux)
214+
sqlite3 (1.7.3-arm64-darwin)
215+
sqlite3 (1.7.3-x86_64-darwin)
216+
sqlite3 (1.7.3-x86_64-linux)
220217
stringio (3.1.2)
221218
thor (1.3.2)
222219
timeout (0.4.3)

lib/active_storage_validations/railtie.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ module ActiveStorageValidations
44
class Railtie < ::Rails::Railtie
55
initializer "active_storage_validations.configure", after: :load_config_initializers do
66
ActiveSupport.on_load(:active_record) do
7-
send :include, ActiveStorageValidations
7+
include ActiveStorageValidations unless included_modules.include?(ActiveStorageValidations)
88
end
99
end
1010

1111
initializer "active_storage_validations.extend_active_storage_blob" do
1212
ActiveSupport.on_load(:active_storage_blob) do
13-
include(ActiveStorageValidations::ASVBlobMetadatable)
13+
include ActiveStorageValidations::ASVBlobMetadatable
1414
end
1515
end
1616
end

test/dummy/app/models/active_storage_validations/check.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,9 @@ class ActiveStorageValidations::Check < ApplicationRecord
2020
# its own custom mime types
2121
has_one_attached :asv_test
2222
validates :asv_test, content_type: "application/asv_test"
23+
24+
# This validator is related to a test that we can download files from a
25+
# service
26+
has_one_attached :digitalocean
27+
validates :digitalocean, content_type: "image/png"
2328
end

test/dummy/config/storage.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
11
test:
22
service: Disk
33
root: <%= Rails.root.join('tmp/storage') %>
4+
5+
digitalocean:
6+
service: S3
7+
endpoint: https://nyc3.digitaloceanspaces.com
8+
access_key_id: xxxx
9+
secret_access_key: xxx
10+
bucket: active_storage_validations_test
11+
region: eu-west-1

test/global/active_storage_validations_test.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,16 @@
3030
assert_equal(Marcel::MimeType.for(declared_type: "application/asv_test"), "application/asv_test")
3131
end
3232
end
33+
34+
describe "services" do
35+
# Uncomment this after having uncommented the S3 service in test_helper.rb
36+
#
37+
# describe "digitalocean" do
38+
# subject { instance }
39+
40+
# it "works fine with the digitalocean service" do
41+
# subject.digitalocean.attach(png_file)
42+
# end
43+
# end
44+
end
3345
end

test/test_helper.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@
1313
Combustion.path = "test/dummy"
1414
Combustion.initialize! :active_record, :active_storage, :active_job do
1515
config.active_storage.variant_processor = ENV["IMAGE_PROCESSOR"]&.to_sym
16+
17+
# Uncomment this to test S3 services
18+
# require "aws-sdk-s3"
19+
# config.active_storage.service = :digitalocean
20+
1621
config.active_job.queue_adapter = :inline
1722
end
1823

0 commit comments

Comments
 (0)