Use spring gem to speed up dev testing

This commit is contained in:
Jesse C. Fisher 2021-11-06 23:09:16 -07:00
parent 3ca6055f47
commit a74eb11e32
7 changed files with 36 additions and 14 deletions

View File

@ -10,7 +10,8 @@ gem 'jquery-rails'
gem 'turbolinks' gem 'turbolinks'
gem 'jbuilder' #, '~> 2.0' gem 'jbuilder' #, '~> 2.0'
gem 'sdoc', group: :doc #, '~> 0.4.0' gem 'sdoc', group: :doc #, '~> 0.4.0'
# gem 'spring', group: :development gem 'spring', group: :development
gem 'spring-commands-rspec', group: :development
gem 'devise' gem 'devise'
gem 'devise_invitable' gem 'devise_invitable'
gem 'haml-rails' gem 'haml-rails'

View File

@ -379,6 +379,9 @@ GEM
simplecov_json_formatter (~> 0.1) simplecov_json_formatter (~> 0.1)
simplecov-html (0.12.3) simplecov-html (0.12.3)
simplecov_json_formatter (0.1.3) simplecov_json_formatter (0.1.3)
spring (3.0.0)
spring-commands-rspec (1.0.4)
spring (>= 0.9.1)
sprockets (3.7.2) sprockets (3.7.2)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
rack (> 1, < 3) rack (> 1, < 3)
@ -472,6 +475,8 @@ DEPENDENCIES
selenium-webdriver selenium-webdriver
simple_form simple_form
simplecov simplecov
spring
spring-commands-rspec
sprockets (~> 3.7) sprockets (~> 3.7)
turbolinks turbolinks
uglifier uglifier

View File

@ -1,4 +1,9 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
begin
load File.expand_path('../spring', __FILE__)
rescue LoadError => e
raise unless e.message.include?('spring')
end
if ENV['RAILS_ENV'] == 'development' if ENV['RAILS_ENV'] == 'development'
ENV['PORT'] = '9012' ENV['PORT'] = '9012'
end end

View File

@ -1,4 +1,9 @@
#!/usr/bin/env ruby #!/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_relative '../config/boot'
require 'rake' require 'rake'
Rake.application.run Rake.application.run

View File

@ -5,6 +5,11 @@
# The application 'rspec' is installed as part of a gem, and # The application 'rspec' is installed as part of a gem, and
# this file is here to facilitate running it. # this file is here to facilitate running it.
# #
begin
load File.expand_path('../spring', __FILE__)
rescue LoadError => e
raise unless e.message.include?('spring')
end
require 'pathname' require 'pathname'
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile", ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile",

View File

@ -1,16 +1,17 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
#
# 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' # This file loads Spring without using Bundler, in order to be fast.
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile", # It gets overwritten when you run the `spring binstub` command.
Pathname.new(__FILE__).realpath)
require 'rubygems' unless defined?(Spring)
require 'bundler/setup' 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

View File

@ -5,7 +5,7 @@ Rails.application.configure do
# test suite. You never need to work with it otherwise. Remember that # test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped # your test database is "scratch space" for the test suite and is wiped
# and recreated between test runs. Don't rely on the data there! # and recreated between test runs. Don't rely on the data there!
config.cache_classes = true config.cache_classes = false
# Do not eager load code on boot. This avoids loading your whole application # Do not eager load code on boot. This avoids loading your whole application
# just for the purpose of running a single test. If you are using a tool that # just for the purpose of running a single test. If you are using a tool that