Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ new tab in the browser.
To see local email previews, check out http://localhost:3000/rails/mailers

### Running Tests
- run the ruby test suite `bin/rails spec`
- run the ruby test suite `bin/rails spec`. It builds the JS and CSS bundles first; a bare `bundle exec rspec` does not, so run `npm run build` and `npm run build:css` (or `bin/setup`) once before using it
- run the javascript test suite `npm run test`

If you have trouble running tests, check out CI scripts in [`.github/workflows/`](.github/workflows/) for sample commands.
Expand Down
9 changes: 9 additions & 0 deletions spec/rails_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@
abort e.to_s.strip
end

# app/assets/builds/ is gitignored and only populated by `npm run build` and
# `npm run build:css`. Until then any layout that links those bundles fails,
# and for tailwind.css with a misleading AssetNotPrecompiledError that points
# at manifest.js. Fail early with the real fix instead.
missing_assets = %w[application.js all_casa_admin.js tailwind.css].reject { |asset| Rails.root.join("app/assets/builds", asset).exist? }
if missing_assets.any?
abort "Missing built assets: #{missing_assets.join(", ")}. Run `npm run build` and `npm run build:css`, or use `bin/rails spec`, which builds them."
end

ci_environment = (ENV["GITHUB_ACTIONS"] || ENV["CI"]).present?

RSpec.configure do |config|
Expand Down
Loading