Skip to content

Commit

Permalink
Integration test for Rails 5
Browse files Browse the repository at this point in the history
This is the extra work required to get our simple integration test
running in Rails 5.

It boils down to remove the assumed reliance on Chrome for system tests
that we do not use anyway.
  • Loading branch information
mec committed Apr 5, 2024
1 parent 6310eda commit 3f03851
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 1 deletion.
27 changes: 27 additions & 0 deletions .github/workflows/rails-integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,33 @@ on:
- v2

jobs:
rails-5:
name: Rails 5 mailer previews
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Build and cache
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
build-args: |
RAILS_VERSION=5.2.8.1
MAIL_NOTIFY_BRANCH=${{ github.ref }}
push: false
load: true
tags: mail-notify-integration-rails-6:latest
cache-from: type=gha
cache-to: type=gha,mode=min
-
name: Run integration tests
run: docker run --rm -e "NOTIFY_API_KEY=${{ secrets.NOTIFY_API_KEY }}" mail-notify-integration-rails-5:latest
rails-6:
name: Rails 6 mailer previews
runs-on: ubuntu-latest
Expand Down
7 changes: 6 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ WORKDIR mail-notify-integration
# install the gems into the bundle
RUN bundle install

# remove gems that will not work in Rails 5
RUN bundle remove selenium-webdriver chromedriver-helper

# Final stage for app image
FROM base

Expand All @@ -49,7 +52,9 @@ RUN echo "gem 'mail-notify', git: 'https://github.com/dxw/mail-notify', branch:
RUN bundle install

# Copy over intergration test files
COPY test/ test/
COPY test/mailers/ test/mailers/
COPY test/system/ test/system/
COPY test/application_system_test_case.rb /test/application_system_test_case.rb
COPY test/app/mailers/ app/mailers/
COPY test/app/views/ app/views/

Expand Down
4 changes: 4 additions & 0 deletions test/application_system_test_case.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
require "test_helper"

class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
end

0 comments on commit 3f03851

Please sign in to comment.