From 053d2d8edc59bc43a23e12b1ba576b217613bc8b Mon Sep 17 00:00:00 2001 From: Mike Dalessio Date: Tue, 1 Oct 2024 18:50:52 -0400 Subject: [PATCH] test: add coverage for generator templates and matrix across Rails 7.2, 8.0, and main --- .github/workflows/upstream.yml | 9 ++++----- test/integration/user_journey_test.sh | 13 ++++++++++++- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/.github/workflows/upstream.yml b/.github/workflows/upstream.yml index 0b0f35e..0ba5507 100644 --- a/.github/workflows/upstream.yml +++ b/.github/workflows/upstream.yml @@ -10,8 +10,6 @@ on: types: [opened, synchronize] branches: - '*' - paths: - - .github/workflows/upstream.yml # this file jobs: tests: @@ -37,14 +35,15 @@ jobs: run: bin/test user-journey: - name: "user-journey (rails main)" + name: "user-journey (rails ${{ matrix.ref }})" runs-on: ${{matrix.plat}}-latest strategy: fail-fast: false matrix: - plat: ["ubuntu", "windows", "macos"] + plat: ["ubuntu"] + ref: ["7-2-stable", "v8.0.0.beta1", "main"] env: - RAILSOPTS: --git=https://github.com/rails/rails --branch main + RAILSOPTS: --git=https://github.com/rails/rails --ref=${{ matrix.ref }} steps: - uses: actions/checkout@v4 - uses: ruby/setup-ruby@v1 diff --git a/test/integration/user_journey_test.sh b/test/integration/user_journey_test.sh index 4016ec2..43ad9f0 100755 --- a/test/integration/user_journey_test.sh +++ b/test/integration/user_journey_test.sh @@ -37,7 +37,7 @@ bundle show --paths bin/rails tailwindcss:install # TEST: tailwind was installed correctly -grep tailwind app/views/layouts/application.html.erb +grep -q tailwind app/views/layouts/application.html.erb # TEST: rake tasks don't exec (#188) cat <> Rakefile @@ -47,3 +47,14 @@ end EOF bin/rails tailwindcss:build still_here | grep "Rake process did not exit early" + +if [[ $(rails -v) > "Rails 8.0.0.beta" ]] ; then + # TEST: presence of the generated file + bundle add bcrypt + bin/rails generate authentication + grep -q PasswordsController app/controllers/passwords_controller.rb +fi + +# TEST: presence of the generated file +bin/rails generate scaffold post title:string body:text published:boolean +grep -q "Show this post" app/views/posts/index.html.erb