2020-07-15 11:04:12 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require "bundler/inline"
|
|
|
|
|
|
|
|
gemfile(true) do
|
|
|
|
source "https://rubygems.org"
|
|
|
|
|
|
|
|
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
|
|
|
|
|
|
|
|
# Activate the gem you are reporting the issue against.
|
2021-08-07 00:16:52 -04:00
|
|
|
gem "rails", "~> 6.1.0"
|
2020-07-15 11:04:12 -04:00
|
|
|
gem "sqlite3"
|
2021-06-02 10:54:30 -04:00
|
|
|
if RUBY_VERSION >= "3.1"
|
|
|
|
# net-smtp, net-imap and net-pop were removed from default gems in Ruby 3.1, but is used by the `mail` gem.
|
|
|
|
# So we need to add them as dependencies until `mail` is fixed: https://github.com/mikel/mail/pull/1439
|
|
|
|
gem "net-smtp", require: false
|
2021-10-10 11:51:06 -04:00
|
|
|
|
Bump required digest version to 3.1.0.pre for Ruby 3.1
This commit addresses these failures.
- `bundle install` failure
```ruby
$ bundle install
Fetching gem metadata from https://rubygems.org/.........
Could not find gem 'digest (~> 3.0.1.pre)' in rubygems repository https://rubygems.org/ or installed locally.
The source contains the following versions of 'digest': 1.0.0, 3.0.0, 3.1.0.pre0, 3.1.0.pre1, 3.1.0.pre2, 3.1.0.pre2 java
$
```
* Action Mailbox bug report template failures
```ruby
$ cd guides/bug_report_templates
$ ruby -v
ruby 3.1.0dev (2021-10-12T11:53:18Z master 58ae1efb49) [x86_64-linux]
$ ruby action_mailbox_main.rb
Fetching gem metadata from https://rubygems.org/......
/home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/resolver.rb:278:in `block in verify_gemfile_dependencies_are_found!': Could not find gem 'digest (~> 3.0.1.pre)' in rubygems repository https://rubygems.org/ or installed locally. (Bundler::GemNotFound)
The source contains the following versions of 'digest': 1.0.0, 3.0.0, 3.1.0.pre0, 3.1.0.pre1, 3.1.0.pre2, 3.1.0.pre2 java
from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/resolver.rb:253:in `each'
from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/resolver.rb:253:in `verify_gemfile_dependencies_are_found!'
from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/resolver.rb:50:in `start'
from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/resolver.rb:23:in `resolve'
from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/definition.rb:267:in `resolve'
from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/definition.rb:183:in `resolve_remotely!'
from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/installer.rb:280:in `resolve_if_needed'
from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/installer.rb:82:in `block in run'
from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/process_lock.rb:12:in `block in lock'
from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/process_lock.rb:9:in `open'
from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/process_lock.rb:9:in `lock'
from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/installer.rb:71:in `run'
from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/installer.rb:23:in `install'
from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/inline.rb:63:in `block (2 levels) in gemfile'
from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/settings.rb:131:in `temporary'
from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/inline.rb:62:in `block in gemfile'
from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/settings.rb:131:in `temporary'
from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/inline.rb:55:in `gemfile'
from action_mailbox_main.rb:5:in `<main>'
$
```
Refer https://github.com/ruby/ruby/commit/e94bcda02539e1695cdda9550ace45c1890e541c
2021-10-12 08:19:50 -04:00
|
|
|
# digest gem, which is one of the default gems has bumped to 3.1.0.pre for ruby 3.1.0dev.
|
2021-10-10 11:51:06 -04:00
|
|
|
# Also `net-smtp` v0.2.2 adds dependency to digest gem which attempts to install digest 3.0.0.
|
Bump required digest version to 3.1.0.pre for Ruby 3.1
This commit addresses these failures.
- `bundle install` failure
```ruby
$ bundle install
Fetching gem metadata from https://rubygems.org/.........
Could not find gem 'digest (~> 3.0.1.pre)' in rubygems repository https://rubygems.org/ or installed locally.
The source contains the following versions of 'digest': 1.0.0, 3.0.0, 3.1.0.pre0, 3.1.0.pre1, 3.1.0.pre2, 3.1.0.pre2 java
$
```
* Action Mailbox bug report template failures
```ruby
$ cd guides/bug_report_templates
$ ruby -v
ruby 3.1.0dev (2021-10-12T11:53:18Z master 58ae1efb49) [x86_64-linux]
$ ruby action_mailbox_main.rb
Fetching gem metadata from https://rubygems.org/......
/home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/resolver.rb:278:in `block in verify_gemfile_dependencies_are_found!': Could not find gem 'digest (~> 3.0.1.pre)' in rubygems repository https://rubygems.org/ or installed locally. (Bundler::GemNotFound)
The source contains the following versions of 'digest': 1.0.0, 3.0.0, 3.1.0.pre0, 3.1.0.pre1, 3.1.0.pre2, 3.1.0.pre2 java
from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/resolver.rb:253:in `each'
from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/resolver.rb:253:in `verify_gemfile_dependencies_are_found!'
from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/resolver.rb:50:in `start'
from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/resolver.rb:23:in `resolve'
from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/definition.rb:267:in `resolve'
from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/definition.rb:183:in `resolve_remotely!'
from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/installer.rb:280:in `resolve_if_needed'
from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/installer.rb:82:in `block in run'
from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/process_lock.rb:12:in `block in lock'
from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/process_lock.rb:9:in `open'
from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/process_lock.rb:9:in `lock'
from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/installer.rb:71:in `run'
from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/installer.rb:23:in `install'
from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/inline.rb:63:in `block (2 levels) in gemfile'
from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/settings.rb:131:in `temporary'
from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/inline.rb:62:in `block in gemfile'
from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/settings.rb:131:in `temporary'
from /home/yahonda/.rbenv/versions/3.1.0-dev/lib/ruby/3.1.0/bundler/inline.rb:55:in `gemfile'
from action_mailbox_main.rb:5:in `<main>'
$
```
Refer https://github.com/ruby/ruby/commit/e94bcda02539e1695cdda9550ace45c1890e541c
2021-10-12 08:19:50 -04:00
|
|
|
gem "digest", "~> 3.1.0.pre", require: false
|
2021-06-02 10:54:30 -04:00
|
|
|
end
|
2020-07-15 11:04:12 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
require "active_record/railtie"
|
|
|
|
require "active_storage/engine"
|
|
|
|
require "action_mailbox/engine"
|
|
|
|
require "tmpdir"
|
|
|
|
|
|
|
|
class TestApp < Rails::Application
|
|
|
|
config.root = __dir__
|
|
|
|
config.hosts << "example.org"
|
|
|
|
config.eager_load = false
|
|
|
|
config.session_store :cookie_store, key: "cookie_store_key"
|
|
|
|
secrets.secret_key_base = "secret_key_base"
|
|
|
|
|
|
|
|
config.logger = Logger.new($stdout)
|
|
|
|
Rails.logger = config.logger
|
|
|
|
|
|
|
|
config.active_storage.service = :local
|
|
|
|
config.active_storage.service_configurations = {
|
|
|
|
local: {
|
|
|
|
root: Dir.tmpdir,
|
|
|
|
service: "Disk"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
config.action_mailbox.ingress = :relay
|
|
|
|
end
|
|
|
|
|
|
|
|
ENV["DATABASE_URL"] = "sqlite3::memory:"
|
|
|
|
|
|
|
|
Rails.application.initialize!
|
|
|
|
|
|
|
|
require ActiveStorage::Engine.root.join("db/migrate/20170806125915_create_active_storage_tables.rb").to_s
|
|
|
|
require ActionMailbox::Engine.root.join("db/migrate/20180917164000_create_action_mailbox_tables.rb").to_s
|
|
|
|
|
|
|
|
ActiveRecord::Schema.define do
|
|
|
|
CreateActiveStorageTables.new.change
|
|
|
|
CreateActionMailboxTables.new.change
|
|
|
|
end
|
|
|
|
|
|
|
|
class ApplicationMailbox < ActionMailbox::Base
|
|
|
|
routing (/^replies@/i) => :replies
|
|
|
|
end
|
|
|
|
|
|
|
|
class RepliesMailbox < ActionMailbox::Base
|
|
|
|
def process
|
|
|
|
$processed = mail.subject
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
require "minitest/autorun"
|
|
|
|
|
|
|
|
class RepliesMailboxTest < ActionMailbox::TestCase
|
|
|
|
setup do
|
|
|
|
$processed = false
|
|
|
|
@inbound_email = receive_inbound_email_from_mail \
|
|
|
|
to: "replies@example.com", subject: "Here is a reply"
|
|
|
|
end
|
|
|
|
|
|
|
|
test "successful mailbox processing" do
|
|
|
|
assert_equal "Here is a reply", $processed
|
|
|
|
end
|
|
|
|
end
|