Unable to run the tests when trying to contribute
neilwilliamsdvla opened this issue · 5 comments
Hello,
I wanted to make a small change to allow Rails to configure the 'environment' used, instead of basing it on the RAILS_ENV (https://github.com/rubyconfig/config/blob/master/lib/config/integrations/rails/railtie.rb#L12).
It's a very small change, but on running the tests by following the contribution instructions, I'm getting lots of errors.
I'm using ruby 2.6.0, bundler 1.17.3.
Example error - this same error appears for each spec:
appraisal rspec
Bundler version 1.17.2
Bundler version 1.17.2
Bundler version 1.17.2
true
>> BUNDLE_GEMFILE=/Users/<user>/Sites/config/gemfiles/rails_4.2.gemfile bundle exec rspec
RUBY_ENGINE: ruby
RUBY_VERSION: 2.6.0
An error occurred while loading ./spec/config_env_spec.rb. - Did you mean?
rspec ./spec/config_spec.rb
Failure/Error: require 'bootsnap/setup' # Speed up boot time by caching expensive operations.
LoadError:
cannot load such file -- bootsnap/setup
# ./spec/app/rails_6.0/config/boot.rb:4:in `require'
# ./spec/app/rails_6.0/config/boot.rb:4:in `<top (required)>'
# ./spec/app/rails_6.0/config/application.rb:1:in `require_relative'
# ./spec/app/rails_6.0/config/application.rb:1:in `<top (required)>'
# ./spec/app/rails_6.0/config/environment.rb:2:in `require_relative'
# ./spec/app/rails_6.0/config/environment.rb:2:in `<top (required)>'
# ./spec/spec_helper.rb:36:in `require'
# ./spec/spec_helper.rb:36:in `<top (required)>'
# ./spec/config_env_spec.rb:1:in `require'
# ./spec/config_env_spec.rb:1:in `<top (required)>'
RUBY_ENGINE: ruby
RUBY_VERSION: 2.6.0
Does anyone know what I need to do get these to run? The latest master build has passed, so I'm not sure why I'd be missing additional dependencies?
There's currently an issue when running:
bundle exec rspec
too. When you just want to run rspec against the latest rails.
it complains that sqlite isn't installed.
I've fixed this by changing the gemspec to use:
# Default RSpec run will test against latest Rails app
unless ENV['APPRAISAL_INITIALIZED'] || ENV['GITHUB_ACTIONS']
gems_to_install = /gem "(.*?)", "(.*?)"(, platform: \:(.*))?/
File.read(Dir['gemfiles/rails*.gemfile'].sort.last).scan(gems_to_install) do |name, version, _, platform|
if platform.nil?
s.add_development_dependency name, version
else
if platform.to_s == RUBY_ENGINE
s.add_development_dependency name, version
end
end
end
end
if you're happy with that, I'll include it in my PR I'm putting together.
Sure, why not! Can yu fire uo PR pls?
@pkuczynski I've put the PR in (#285), let me know what you think.
@neilwilliams Can you put that piece in a separate PR? It's unrelated to your feature PR and will likely get merged sooner than the rest of the feature PR.
I agree with @Fryguy. @neilwilliams could you separate this change in gemspec into a separate PR please?