Open
Conversation
- Boot Rails from knapsack rails_helper (after ENV) then require only webapp spec_helper - Set ENV to mirror hyrax-webapp test env; keep HYRAX_FLEXIBLE default false - Use config.fixture_paths (plural); add Hyrax + webapp factory paths - Set Hyrax Valkyrie test config; add DatabaseCleaner, Devise, Warden, ActiveJob includes Made-with: Cursor
The shim was accidentally placed inside the RSpec.configure block between config.before and config.after. Move it after the configure block where it belongs as a top-level method definition.
…elper spec_helper now loads hyrax-webapp/spec/spec_helper.rb which requires Rails to already be initialized. Any spec file that touches Rails must require rails_helper (which boots Rails first) rather than spec_helper.
laritakr
approved these changes
Mar 6, 2026
laritakr
left a comment
There was a problem hiding this comment.
What about the work resource generator? Should we also update the generators so new works are generated correctly?
Contributor
Author
orangewolf
approved these changes
Mar 11, 2026
- rails_helper: also load Rails.root/spec/support/**/*.rb so knapsacks can add their own support files (WebMock, etc.) without patching the helper - .gitignore: add pry_history, CLAUDE.md, settings.local.json Ported from notch8/palni_palci_knapsack#561. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Respect Hyku’s default: HYRAX_FLEXIBLE is off unless set by the app (e.g. .env, docker-compose). Set before engine is required so that it takes effect before other models are loaded.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Contributes back upstream from upgrading to Hyku7 downstream (hyku up knapsack)
Summary
spec_helper.rbto loadhyrax-webapp/spec/spec_helper.rbinstead of itsrails_helper.rb, which caused double-boot and circular require issues.spec/rails_helper.rbfor Hyku 7 / Rails 7.2 compatibility: set required ENV vars before booting Rails, boot Rails before requiringspec_helper, configure Valkyrie models, expand FactoryBot paths to include Hyrax shared spec factories and hyrax-webapp factories, add DatabaseCleaner with transaction strategy, and add standard RSpec helper includes (Devise, Warden, FactoryBot, ActiveJob, etc.).RoleMapper.addshim: Hyku 7 removed this method; the shim delegates to Rolify so shared specs that call it continue to work.schema_loader_config_search_pathsprepend in bothconfig/initializers/hyrax.rbandlib/hyku_knapsack/engine.rb: Rails 7 config arrays may be frozen, so use reassignment (= [root] + Array(paths)) instead ofunshift.Ticket Number
Expected Behavior
it_behaves_like "a Hyrax::Work") resolve factories correctly.schema_loader_config_search_pathsprepend does not raiseFrozenErrorunder Rails 7.