diff --git a/bin/rails b/bin/rails index 5191e6927..0138d79b7 100755 --- a/bin/rails +++ b/bin/rails @@ -1,4 +1,9 @@ #!/usr/bin/env ruby +begin + load File.expand_path('../spring', __FILE__) +rescue LoadError => e + raise unless e.message.include?('spring') +end APP_PATH = File.expand_path('../../config/application', __FILE__) require_relative '../config/boot' require 'rails/commands' diff --git a/bin/rake b/bin/rake index 17240489f..d87d5f578 100755 --- a/bin/rake +++ b/bin/rake @@ -1,4 +1,9 @@ #!/usr/bin/env ruby +begin + load File.expand_path('../spring', __FILE__) +rescue LoadError => e + raise unless e.message.include?('spring') +end require_relative '../config/boot' require 'rake' Rake.application.run diff --git a/bin/rspec b/bin/rspec index d738b23c0..b207dde29 100755 --- a/bin/rspec +++ b/bin/rspec @@ -1,4 +1,9 @@ #!/usr/bin/env ruby +begin + load File.expand_path('../spring', __FILE__) +rescue LoadError => e + raise unless e.message.include?('spring') +end # frozen_string_literal: true # # This file was generated by Bundler. diff --git a/bin/spring b/bin/spring index 43731fe82..fb2ec2ebb 100755 --- a/bin/spring +++ b/bin/spring @@ -1,17 +1,17 @@ #!/usr/bin/env ruby -# frozen_string_literal: true -# -# This file was generated by Bundler. -# -# The application 'spring' is installed as part of a gem, and -# this file is here to facilitate running it. -# -require "pathname" -ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", - Pathname.new(__FILE__).realpath) +# This file loads spring without using Bundler, in order to be fast. +# It gets overwritten when you run the `spring binstub` command. -require "rubygems" -require "bundler/setup" +unless defined?(Spring) + require 'rubygems' + require 'bundler' -load Gem.bin_path("spring", "spring") + lockfile = Bundler::LockfileParser.new(Bundler.default_lockfile.read) + spring = lockfile.specs.detect { |spec| spec.name == "spring" } + if spring + Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path + gem 'spring', spring.version + require 'spring/binstub' + end +end diff --git a/spec/features/admin/budgets_spec.rb b/spec/features/admin/budgets_spec.rb index e032daf29..b7efd1d7f 100644 --- a/spec/features/admin/budgets_spec.rb +++ b/spec/features/admin/budgets_spec.rb @@ -319,6 +319,6 @@ feature 'Admin budgets' do end end -def translated_phase_name(phase_kind: phase_kind) +def translated_phase_name(phase_kind: kind) I18n.t("budgets.phase.#{phase_kind}") end diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 74af9d331..9331e8a70 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -1,6 +1,8 @@ -require 'coveralls' -Coveralls.wear!('rails') ENV['RAILS_ENV'] ||= 'test' +if ENV['TRAVIS'] + require 'coveralls' + Coveralls.wear!('rails') +end require File.expand_path('../../config/environment', __FILE__) abort("The Rails environment is running in production mode!") if Rails.env.production? diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index f083cc970..762a5444e 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -92,7 +92,7 @@ RSpec.configure do |config| # Print the 10 slowest examples and example groups at the # end of the spec run, to help surface which specs are running # particularly slow. - config.profile_examples = 10 + # config.profile_examples = 10 # Run specs in random order to surface order dependencies. If you find an # order dependency and want to debug it, you can fix the order by providing