Skip to content

Commit

Permalink
test: add coverage for generator templates
Browse files Browse the repository at this point in the history
and matrix across Rails 7.2, 8.0, and main
  • Loading branch information
flavorjones committed Oct 1, 2024
1 parent 4fe7139 commit bed38c6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
9 changes: 4 additions & 5 deletions .github/workflows/upstream.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ on:
types: [opened, synchronize]
branches:
- '*'
paths:
- .github/workflows/upstream.yml # this file

jobs:
tests:
Expand All @@ -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
Expand Down
13 changes: 12 additions & 1 deletion test/integration/user_journey_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,13 @@ bundle add rails --skip-install ${RAILSOPTS:-}
bundle add tailwindcss-rails --path="../.."
bundle install
bundle show --paths
bundle binstubs --all

# install tailwindcss
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 <<EOF >> Rakefile
Expand All @@ -47,3 +48,13 @@ 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
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

0 comments on commit bed38c6

Please sign in to comment.