diff --git a/CHANGELOG.md b/CHANGELOG.md index 2bd50a94f..18aae48e9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,9 @@ [Full changelog][unreleased] +- Remove Spring from development +- Switch to the Zeitwerk autoloader + ## Release 153 - 2024-12-02 [Full changelog][153] diff --git a/Gemfile b/Gemfile index 0829c55e2..506b1c9bd 100644 --- a/Gemfile +++ b/Gemfile @@ -67,9 +67,6 @@ group :development do gem "better_errors" gem "html2haml" gem "listen", ">= 3.0.5", "< 3.10" - gem "spring" - gem "spring-commands-rspec" - gem "spring-watcher-listen", "~> 2.1.0" gem "rails_layout" gem "web-console", ">= 3.3.0" end diff --git a/Gemfile.lock b/Gemfile.lock index 8e74ae9b7..e6c958f2f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -479,12 +479,6 @@ GEM slim (4.1.0) temple (>= 0.7.6, < 0.9) tilt (>= 2.0.6, < 2.1) - spring (4.2.1) - spring-commands-rspec (1.0.4) - spring (>= 0.9.1) - spring-watcher-listen (2.1.0) - listen (>= 2.7, < 4.0) - spring (>= 4) sprockets (4.2.1) concurrent-ruby (~> 1.0) rack (>= 2.2.4, < 4) @@ -608,9 +602,6 @@ DEPENDENCIES sidekiq (~> 7) simplecov (~> 0.22.0) simplecov-lcov (~> 0.8.0) - spring - spring-commands-rspec - spring-watcher-listen (~> 2.1.0) standard strip_attributes tzinfo-data diff --git a/bin/rails b/bin/rails index 40b071ea5..073966023 100755 --- a/bin/rails +++ b/bin/rails @@ -1,5 +1,4 @@ #!/usr/bin/env ruby -load File.expand_path("spring", __dir__) APP_PATH = File.expand_path('../config/application', __dir__) require_relative '../config/boot' require 'rails/commands' diff --git a/bin/rake b/bin/rake index 7327f471e..4fbf10b96 100755 --- a/bin/rake +++ b/bin/rake @@ -1,5 +1,4 @@ #!/usr/bin/env ruby -load File.expand_path("spring", __dir__) require_relative "../config/boot" require "rake" Rake.application.run diff --git a/bin/rspec b/bin/rspec index 053bb19a3..caedbbad6 100755 --- a/bin/rspec +++ b/bin/rspec @@ -1,10 +1,5 @@ #!/usr/bin/env ruby # frozen_string_literal: true -begin - load File.expand_path('spring', __dir__) -rescue LoadError => e - raise unless e.message.include?('spring') -end require 'bundler/setup' load Gem.bin_path('rspec-core', 'rspec') diff --git a/bin/spring b/bin/spring deleted file mode 100755 index b4147e843..000000000 --- a/bin/spring +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env ruby -if !defined?(Spring) && [nil, "development", "test"].include?(ENV["RAILS_ENV"]) - gem "bundler" - require "bundler" - - # Load Spring without loading other gems in the Gemfile, for speed. - Bundler.locked_gems&.specs&.find { |spec| spec.name == "spring" }&.tap do |spring| - Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path - gem "spring", spring.version - require "spring/binstub" - rescue Gem::LoadError - # Ignore when Spring is not installed. - end -end diff --git a/config/environments/test.rb b/config/environments/test.rb index 7567499e4..389fb74e0 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -10,14 +10,10 @@ Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. - config.cache_classes = !(defined?(Spring::Env) && Spring::Env.new.server_running?) + config.cache_classes = false config.action_view.cache_template_loading = true - # Prevent 'reloading is disabled' errors from Spring - # https://github.com/rails/spring/issues/598 - config.autoloader = :classic - # 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 # preloads Rails for running tests, you may have to set it to true. diff --git a/config/spring.rb b/config/spring.rb deleted file mode 100644 index 83202c25d..000000000 --- a/config/spring.rb +++ /dev/null @@ -1,16 +0,0 @@ -# frozen_string_literal: true - -Spring.watch( - ".ruby-version", - ".rbenv-vars", - "tmp/restart.txt", - "tmp/caching-dev.txt" -) - -Spring.after_fork do - if Rails.env.test? - RSpec.configure do |config| - config.seed = srand % 0xFFFF unless ARGV.any? { |arg| arg =~ /seed/ } - end - end -end diff --git a/spec/models/guidance_url_spec.rb b/spec/models/guidance_url_spec.rb index cb008cf0c..113acd9e1 100644 --- a/spec/models/guidance_url_spec.rb +++ b/spec/models/guidance_url_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe Activity::GuidanceUrl, type: :model do +RSpec.describe GuidanceUrl, type: :model do describe "#to_s" do it "returns a url if one exists" do url = GuidanceUrl.new(:activity, :programme_status)