Skip to content

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
merged 5 commits into from
Nov 15, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ sudo: false
# original `cache: bundler` is a better option.
cache: bundler

bundler_args: "--binstubs --without documentation --path ../bundle --retry=3 --jobs=3"
bundler_args: "--binstubs --path ../bundle --retry=3 --jobs=3"

before_install:
- script/clone_all_rspec_repos
Expand Down
13 changes: 7 additions & 6 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ RSpec::Core::RakeTask.new(:spec) do |t|
end

Cucumber::Rake::Task.new(:cucumber) do |t|
version = ENV.fetch("RAILS_VERSION", "~> 4.2.0")
version = ENV.fetch("RAILS_VERSION", "~> 4.2.0")[/\d[\.-]\d/]
tags = []

if version.to_f >= 5.1
Expand Down Expand Up @@ -60,12 +60,12 @@ namespace :generate do

# Rails 4 cannot use a `rails` binstub generated by Bundler
sh "rm -f #{bindir}/rails"
sh "bundle exec rails new ./tmp/example_app --skip-javascript --skip-sprockets --skip-git --skip-test-unit --skip-listen --skip-bundle --template=example_app_generator/generate_app.rb"
sh "bundle exec rails new ./tmp/example_app --no-rc --skip-javascript --skip-sprockets --skip-git --skip-test-unit --skip-listen --skip-bundle --template=example_app_generator/generate_app.rb"

in_example_app do
sh "./travis_retry_bundle_install.sh 2>&1"
# Rails 4 cannot use a `rails` binstub generated by Bundler
sh "bundle binstubs rspec-core rake --force"
sh "bundle binstubs bundler rspec-core rake --force"
sh "bundle binstubs railties" unless File.exist?("bin/rails")

application_file = File.read("config/application.rb")
Expand Down Expand Up @@ -93,7 +93,8 @@ def in_example_app(*command_opts)
app_dir = opts.fetch(:app_dir, app_dir)
end
Dir.chdir(app_dir) do
Bundler.with_clean_env do
Bundler.with_original_env do
ENV["BUNDLE_GEMFILE"] = "Gemfile"
sh *command_opts unless command_opts.empty?
yield if block_given?
end
Expand Down Expand Up @@ -182,12 +183,12 @@ namespace :no_active_record do

# Rails 4 cannot use a `rails` binstub generated by Bundler
sh "rm -f #{bindir}/rails"
sh "bundle exec rails new #{example_app_dir} --skip-active-record --skip-javascript --skip-sprockets --skip-git --skip-test-unit --skip-listen --skip-bundle --template=example_app_generator/generate_app.rb"
sh "bundle exec rails new #{example_app_dir} --no-rc --skip-active-record --skip-javascript --skip-sprockets --skip-git --skip-test-unit --skip-listen --skip-bundle --template=example_app_generator/generate_app.rb"

in_example_app(:app_dir => example_app_dir) do
sh "./travis_retry_bundle_install.sh 2>&1"
# Rails 4 cannot use a `rails` binstub generated by Bundler
sh "bundle binstubs rspec-core rake --force"
sh "bundle binstubs bundler rspec-core rake --force"
sh "bundle binstubs railties" unless File.exist?("bin/rails")

application_file = File.read("config/application.rb")
Expand Down
2 changes: 1 addition & 1 deletion lib/rspec/rails/example/system_example_group.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def app
dependency on a webserver and `capybara`, please add capybara to
your Gemfile and configure a webserver (e.g. `Capybara.server =
:webrick`) before attempting to use system tests.
""".gsub(/\s+/,' ').strip
""".gsub(/\s+/, ' ').strip
end

original_after_teardown =
Expand Down