-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Fix "uninitialized constant Gem" and other Travis errors #1914
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
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
❤️ |
Getting close! 🤞 |
This commit fixes Travis failures due to the recent introduction of Bundler 1.16.0. Both are related to the new style of binstubs that are generated by 1.16.0. First, add `bundler` to the list of binstubs that we explicitly generate when creating the test Rails app. The `bin/bundle` binstub that ships as part of `rails new` is in the pre-1.16 format, and conflicts with the 1.16 format binstubs that are generated for rake and rspec. Fix this by replacing the default `bin/bundle` with a fresh one generated by `bundle binstubs bundler --force`. Second, the `Bundle.with_clean_env` wrapper seems to remove some important information from the environment that causes binstubs to fail with errors like `uninitialized constant Gem (NameError)`. Fix this by using `Bundle.with_original_env` instead (which is what the Bundler documentation recommends). Because Travis also sets its own `BUNDLER_GEMFILE` variable, I had to also reset that one manually.
The rspec-rails acceptance tests use `rails new` to generate a sample app for running tests. If a developer running the rspec-rails test suite has a `.railsrc` file, this will affect the app that is generated, causing specs to fail. This commit fixes this by passing the `--no-rc` flag so that `rails new` ignores the developer's local `.railsrc`.
65ac605
to
cf7cd10
Compare
Zomg amazing :) Thanks! ❤️ |
JonRowe
pushed a commit
that referenced
this pull request
Nov 20, 2017
* Fix RuboCop violation * Update test harness for Bundler 1.16 compatibility This commit fixes Travis failures due to the recent introduction of Bundler 1.16.0. Both are related to the new style of binstubs that are generated by 1.16.0. First, add `bundler` to the list of binstubs that we explicitly generate when creating the test Rails app. The `bin/bundle` binstub that ships as part of `rails new` is in the pre-1.16 format, and conflicts with the 1.16 format binstubs that are generated for rake and rspec. Fix this by replacing the default `bin/bundle` with a fresh one generated by `bundle binstubs bundler --force`. Second, the `Bundle.with_clean_env` wrapper seems to remove some important information from the environment that causes binstubs to fail with errors like `uninitialized constant Gem (NameError)`. Fix this by using `Bundle.with_original_env` instead (which is what the Bundler documentation recommends). Because Travis also sets its own `BUNDLER_GEMFILE` variable, I had to also reset that one manually. * Choose cuke tags based on correct RAILS_VERSION * Travis needs doc gems in order to run bin/yard * Add --no-rc flag for more reliable local testing The rspec-rails acceptance tests use `rails new` to generate a sample app for running tests. If a developer running the rspec-rails test suite has a `.railsrc` file, this will affect the app that is generated, causing specs to fail. This commit fixes this by passing the `--no-rc` flag so that `rails new` ignores the developer's local `.railsrc`.
This was referenced Mar 20, 2018
sebjacobs
pushed a commit
to futurelearn/rspec-rails
that referenced
this pull request
Mar 15, 2019
* Fix RuboCop violation * Update test harness for Bundler 1.16 compatibility This commit fixes Travis failures due to the recent introduction of Bundler 1.16.0. Both are related to the new style of binstubs that are generated by 1.16.0. First, add `bundler` to the list of binstubs that we explicitly generate when creating the test Rails app. The `bin/bundle` binstub that ships as part of `rails new` is in the pre-1.16 format, and conflicts with the 1.16 format binstubs that are generated for rake and rspec. Fix this by replacing the default `bin/bundle` with a fresh one generated by `bundle binstubs bundler --force`. Second, the `Bundle.with_clean_env` wrapper seems to remove some important information from the environment that causes binstubs to fail with errors like `uninitialized constant Gem (NameError)`. Fix this by using `Bundle.with_original_env` instead (which is what the Bundler documentation recommends). Because Travis also sets its own `BUNDLER_GEMFILE` variable, I had to also reset that one manually. * Choose cuke tags based on correct RAILS_VERSION * Travis needs doc gems in order to run bin/yard * Add --no-rc flag for more reliable local testing The rspec-rails acceptance tests use `rails new` to generate a sample app for running tests. If a developer running the rspec-rails test suite has a `.railsrc` file, this will affect the app that is generated, causing specs to fail. This commit fixes this by passing the `--no-rc` flag so that `rails new` ignores the developer's local `.railsrc`.
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.
The Travis builds have been failing for the past couple weeks. This PR makes them green again ✅
It seems that the trigger for the failures was the recent release of Bundler 1.16.0, which brings some subtly different behavior regarding environment variables and binstubs. Here are the changes I made in this PR to get Travis working:
bundler
to the list of binstubs that we explicitly generate when creating the test Rails app. Thebin/bundle
binstub that ships as part ofrails new
is in the pre-1.16 format, and conflicts with the 1.16 format binstubs that are generated for rake and rspec (see 1.16.0 is intercepting binstub arguments and throwing 'unknown switches' error rubygems/bundler#6149). Fix this by replacing the defaultbin/bundle
with a fresh one generated bybundle binstubs bundler --force
.Bundle.with_clean_env
wrapper seems to remove some important information from the environment that causes binstubs to fail with errors likeuninitialized constant Gem (NameError)
. Fix this by usingBundle.with_original_env
instead (which is what the Bundler documentation recommends). Because Travis also sets its ownBUNDLER_GEMFILE
variable, I had to also reset that one manually.RAILS_VERSION
variable was not being parsed correctly, causing incorrect Cucumber tags to be used. Fixed by using a regex to extract the version number.bin/yard doc
. This was failing because gems where missing. Fix by removing--without documentation
from the bundler command.Along the way I also added
--no-rc
to the sample app setup command to fix conflicts in my local development environment.