Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test installer commands #149

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

jonathanhefner
Copy link
Member

This PR looks larger than it is because this project currently has no testing infrastructure. The majority of LOC in this PR are from Gemfile and Gemfile.lock files. I have split the PR into multiple commits to further clarify.


This adds test coverage for the css:install:bootstrap, css:install:bulma, css:install:postcss, css:install:sass, and css:install:tailwind commands. The commands are tested against a freshly generated Rails app using the version of Rails that is currently loaded. Thus the installer can be tested with different versions of Rails in CI.

Infrastructure has been added to run tests against Rails 7.0, 7.1, and main branch.

This PR takes a different approach than rails/dartsass-rails#49 — instead of separate appraisals / gemfiles for Sprockets and Propshaft, this PR has tests that target each.

This adds testing infrastructure to test against multiple versions of
Rails, including Rails `main` branch.
This adds test coverage for the shared behavior of the installer
commands.  The commands are tested against a freshly generated Rails app
using the version of Rails that is currently loaded.  Thus the
installers can be tested with different versions of Rails in CI.
This adds test coverage for specific behavior of the
`css:install:bootstrap` command.
This adds test coverage for specific behavior of the `css:install:bulma`
command.
This adds test coverage for specific behavior of the
`css:install:postcss` command.
This adds test coverage for specific behavior of the `css:install:sass`
command.
This adds test coverage for specific behavior of the
`css:install:tailwind` command.
Comment on lines -7 to +9
rails_version = ENV["RAILS_VERSION"] || "6.1.0"
gem "rails", "~> #{rails_version}"

gem "appraisal"
gem "rails", "~> 6.0.0"
gem "sprockets-rails"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file defaulted the Rails version to 6.1, but the gemspec specifies 6.0. Which is correct? (Or do we want to jump to Rails 7.0?)

Comment on lines +8 to +15
ruby-version:
- "3.1"
- "3.2"
- "3.3"
gemfile:
- gemfiles/rails_7_0.gemfile
- gemfiles/rails_7_1.gemfile
- gemfiles/rails_main.gemfile
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This only tests with Rails >= 7.0 and Ruby >= 3.1. I can add entries for Rails 6.0 and 6.1, and older versions of Ruby, but first I wanted to confirm which versions we want to support.

@dhh
Copy link
Member

dhh commented Jan 21, 2024

Let's just test against Rails 7+.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants