Skip to content

Commit e7fe45e

Browse files
authored
Merge pull request #1258 from seanpdoyle/rails-engine-test-coverage
`action_text-trix`: Add test coverage for Engine
2 parents 50bac54 + 4293d34 commit e7fe45e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+1999
-0
lines changed

.github/workflows/ci.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,59 @@ jobs:
5353
run: |
5454
cd rails/actiontext
5555
bundle exec rake test test:system
56+
action_text-trix:
57+
name: Action Text tests
58+
runs-on: ubuntu-latest
59+
strategy:
60+
fail-fast: false
61+
matrix:
62+
include:
63+
- ruby: "3.2"
64+
rails_branch: 7-2-stable
65+
- ruby: "3.3"
66+
rails_branch: 7-2-stable
67+
- ruby: "3.4"
68+
rails_branch: 7-2-stable
69+
70+
- ruby: "3.2"
71+
rails_branch: 8-0-stable
72+
- ruby: "3.3"
73+
rails_branch: 8-0-stable
74+
- ruby: "3.4"
75+
rails_branch: 8-0-stable
76+
77+
- ruby: "3.2"
78+
rails_branch: main
79+
experimental: true
80+
- ruby: "3.3"
81+
rails_branch: main
82+
experimental: true
83+
- ruby: "3.4"
84+
rails_branch: main
85+
experimental: true
86+
87+
- ruby: head
88+
rails_branch: main
89+
experimental: true
90+
steps:
91+
- uses: actions/checkout@v4
92+
- uses: actions/setup-node@v3
93+
with:
94+
node-version: 18
95+
cache: "yarn"
96+
- uses: ruby/setup-ruby@v1
97+
env:
98+
RAILS_BRANCH: ${{ matrix.rails_branch }}
99+
with:
100+
working-directory: "./action_text-trix"
101+
ruby-version: ${{ matrix.ruby }}
102+
bundler-cache: true
103+
- name: Run tests
104+
env:
105+
RAILS_BRANCH: ${{ matrix.rails_branch }}
106+
continue-on-error: ${{ matrix.experimental }}
107+
working-directory: "./action_text-trix"
108+
run: bin/rails test:all
56109

57110
env:
58111
SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }}

action_text-trix/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
11
Gemfile.lock
22
pkg
3+
tmp/
4+
log/
5+
storage/
6+
vendor/

action_text-trix/Gemfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,14 @@ source "https://rubygems.org"
22

33
# Specify your gem's dependencies in trix.gemspec.
44
gemspec
5+
6+
branch = ENV.fetch("RAILS_BRANCH", "main")
7+
gem "rails", github: "rails/rails", branch: branch
8+
gem "importmap-rails"
9+
gem "propshaft"
10+
gem "puma"
11+
gem "sqlite3"
12+
13+
group :test do
14+
gem "cuprite", require: "capybara/cuprite"
15+
end

action_text-trix/Rakefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
require "bundler/gem_tasks"
22
require "rake/clean"
33

4+
if defined?(Rails)
5+
APP_RAKEFILE = File.expand_path("test/dummy/Rakefile", __dir__)
6+
load "rails/tasks/engine.rake"
7+
end
8+
49
task :sync do
510
require "json"
611

action_text-trix/bin/rails

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/env ruby
2+
# This command will automatically be run when you run "rails" with Rails gems
3+
# installed from the root of your application.
4+
5+
ENGINE_ROOT = File.expand_path('..', __dir__)
6+
ENGINE_PATH = File.expand_path('../lib/action_text/trix/engine.rb', __dir__)
7+
APP_PATH = File.expand_path('../test/dummy/config/application', __dir__)
8+
9+
# Set up gems listed in the Gemfile.
10+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
11+
require "bundler/setup" if File.exist?(ENV["BUNDLE_GEMFILE"])
12+
13+
require "rails/all"
14+
require "rails/test_unit/railtie"
15+
require "rails/engine/commands"
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# frozen_string_literal: true
2+
3+
require "test_helper"
4+
5+
class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
6+
driven_by :cuprite, using: :chrome, options: {
7+
js_errors: true,
8+
headless: ENV["HEADLESS"] != "0"
9+
}
10+
end
11+
12+
Capybara.server = :puma, { Silent: true }
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

action_text-trix/test/dummy/app/assets/images/.keep

Whitespace-only changes.

action_text-trix/test/dummy/app/assets/stylesheets/actiontext.css

Lines changed: 440 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/*
2+
* This is a manifest file that'll be compiled into application.css, which will include all the files
3+
* listed below.
4+
*
5+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6+
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7+
*
8+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
9+
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
10+
* files in this directory. Styles in this file should be added after the last require_* statement.
11+
* It is generally better to create a new file per style scope.
12+
*
13+
*= require_tree .
14+
*= require_self
15+
*/

0 commit comments

Comments
 (0)