Skip to content

Commit b8ca827

Browse files
authored
Add Rails 8.1 support (#119)
1 parent 11426c7 commit b8ca827

30 files changed

+441
-3
lines changed

roadie-rails.gemspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ Gem::Specification.new do |spec|
2121
spec.extra_rdoc_files = %w[README.md Changelog.md LICENSE.txt]
2222
spec.require_paths = ["lib"]
2323

24-
spec.add_dependency "railties", ">= 5.1", "< 8.1"
24+
spec.add_dependency "railties", ">= 5.1", "< 8.2"
2525
spec.add_dependency "roadie", "~> 5.0"
2626

2727
spec.add_development_dependency "bundler", "~> 2.2"
28-
spec.add_development_dependency "rails", ">= 5.1", "< 8.1"
28+
spec.add_development_dependency "rails", ">= 5.1", "< 8.2"
2929
spec.add_development_dependency "rspec", "~> 3.10"
3030
spec.add_development_dependency "rspec-collection_matchers"
3131
spec.add_development_dependency "rspec-rails"

spec/integration_spec.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ def parse_html_in_email(mail)
1717
RailsApp.new("Rails 7.0", "rails_70", min_ruby_version: "2.7"),
1818
RailsApp.new("Rails 7.1 with sprockets", "rails_71", min_ruby_version: "2.7"),
1919
RailsApp.new("Rails 7.1 with propshaft", "rails_71_with_propshaft", min_ruby_version: "2.7", asset_pipeline: :propshaft),
20-
RailsApp.new("Rails 8.0 with propshaft", "rails_80_with_propshaft", min_ruby_version: "3.2", asset_pipeline: :propshaft)
20+
RailsApp.new("Rails 8.0 with propshaft", "rails_80_with_propshaft", min_ruby_version: "3.2", asset_pipeline: :propshaft),
21+
RailsApp.new("Rails 8.1 with propshaft", "rails_81_with_propshaft", min_ruby_version: "3.2", asset_pipeline: :propshaft)
2122
]
2223

2324
shared_examples "generates valid email" do |message|
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# frozen_string_literal: true
2+
3+
source "https://rubygems.org"
4+
5+
# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
6+
gem "rails", "~> 8.1.0"
7+
8+
# Reduces boot times through caching; required in config/boot.rb
9+
gem "bootsnap", ">= 1.4.4", require: false
10+
gem "propshaft"
11+
gem "roadie-rails", path: "../../.."
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Add your own tasks in files placed in lib/tasks ending in .rake,
2+
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3+
4+
require_relative "config/application"
5+
6+
Rails.application.load_tasks

spec/railsapps/rails_81_with_propshaft/app/assets/builds/.gitkeep

Whitespace-only changes.
6.49 KB
Loading
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
body { background-color: green; }
2+
.image { background: url("/rails.png"); }
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# frozen_string_literal: true
2+
3+
class AutoMailer < ActionMailer::Base
4+
include Roadie::Rails::Automatic
5+
6+
default from: "john@example.com"
7+
8+
def normal_email
9+
generate_email
10+
end
11+
12+
def disabled_email
13+
generate_email
14+
end
15+
16+
private
17+
18+
def roadie_options
19+
unless /disabled/.match?(action_name)
20+
super.combine(url_options: {protocol: "https"})
21+
end
22+
end
23+
24+
def generate_email
25+
mail(to: "example@example.org", subject: "Notification for you") do |format|
26+
format.html { render :normal_email }
27+
format.text { render :normal_email }
28+
end
29+
end
30+
end
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# frozen_string_literal: true
2+
3+
class Mailer < ActionMailer::Base
4+
include Roadie::Rails::Mailer
5+
6+
default from: "john@example.com"
7+
8+
def normal_email
9+
roadie_mail(to: "example@example.org", subject: "Notification for you") do |format|
10+
format.html
11+
format.text
12+
end
13+
end
14+
15+
private
16+
17+
def roadie_options
18+
super.combine(url_options: {protocol: "https"})
19+
end
20+
end
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta http-equiv="content-type" content="text/html; charset=utf-8">
5+
<%= stylesheet_link_tag "email" %>
6+
</head>
7+
<body>
8+
<h1>Normal email</h1>
9+
<div class="image"></div>
10+
</body>
11+
</html>

0 commit comments

Comments
 (0)