rubyatscale / packs-rails

packs-rails establishes and implements a set of conventions for splitting up large monoliths.
MIT License
268 stars 26 forks source link

`spec/support/shared_examples/` doesn't work #59

Closed bioform closed 1 year ago

bioform commented 1 year ago

If you try to put any spec shared example file to the spec/support/shared_examples/ pack-related folder, it will be unavailable for package-related specs. The resulting error looks like this:

ArgumentError:
  Could not find shared examples "shared example name"
alexevanczuk commented 1 year ago

Hi @bioform, I chatted with the team. Evidently, spec/support is a custom concept that is made “conventional” because rspec-rails adds the code snippet for you in rails_helper.rb, but there’s nothing baked into rspec itself. Therefore, you have to do this yourself (which is what we do at Gusto):

Dir[Rails.root.join('packs/*/spec/support/**/*.rb')].sort.each { |f| require f }
alexevanczuk commented 1 year ago

@bioform Going to close this for now – please let me know if you have any questions/concerns/feedback and we can reopen this.