rubyatscale/packs-rails

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

bioform opened this issue · 2 comments

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"

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 }

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