From 461cfe01d5de86849ae0f836012cd646c78d818b Mon Sep 17 00:00:00 2001 From: Avin Hurry Date: Thu, 15 Aug 2024 20:36:25 +0100 Subject: [PATCH 1/7] We are getting the following error: NoMethodError: undefined method `migration_context' for # 7.1 + ActiveRecord::Base.with_connection do |connection| + raise ActiveRecord::PendingMigrationError if connection.pool.migration_context.needs_migration? + end + elsif ActiveRecord::Base.connection.migration_context.needs_migration? + raise ActiveRecord::PendingMigrationError + end DfE::Analytics::Fields.check! diff --git a/spec/dfe/analytics_spec.rb b/spec/dfe/analytics_spec.rb index 5013ab28..df796006 100644 --- a/spec/dfe/analytics_spec.rb +++ b/spec/dfe/analytics_spec.rb @@ -23,8 +23,12 @@ end describe 'when no database connection is available' do + before do + allow(Rails).to receive(:version).and_return('7.2') + allow(ActiveRecord::Base).to receive(:with_connection).and_raise(ActiveRecord::ConnectionNotEstablished) + end + it 'recovers and logs' do - allow(ActiveRecord::Base).to receive(:connection).and_raise(ActiveRecord::ConnectionNotEstablished) expect(Rails.logger).to receive(:info).with(/No database connection/) expect { DfE::Analytics.initialize! }.not_to raise_error end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 997028db..505e5891 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -38,7 +38,14 @@ def name; end config.disable_monkey_patching! config.around do |example| - ActiveRecord::Base.connection.migration_context.migrate + if Rails.version.to_f > 7.1 + ActiveRecord::Base.with_connection do |connection| + connection.pool.migration_context.migrate + end + else + ActiveRecord::Base.connection.migration_context.migrate + end + DfE::Analytics::InitialisationEvents.initialisation_events_sent = true example.run end From 22358f6335d96f8a77c4930cd88b3c04791276f1 Mon Sep 17 00:00:00 2001 From: Avin Hurry Date: Thu, 15 Aug 2024 21:25:30 +0100 Subject: [PATCH 2/7] Add rails 7.2 appraise --- Appraisals | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Appraisals b/Appraisals index 7dfbc118..61947190 100644 --- a/Appraisals +++ b/Appraisals @@ -10,3 +10,7 @@ end appraise "rails-7" do gem "rails", "7.0.4" end + +appraise "rails-7.2" do + gem "rails", "7.2" +end From ff03415ccb325bf655ec6777bd9a06693e1b4814 Mon Sep 17 00:00:00 2001 From: Avin Hurry Date: Thu, 15 Aug 2024 21:25:59 +0100 Subject: [PATCH 3/7] Add CI test for rails 7.2 --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c1bea1f6..9dd797bc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,7 +13,7 @@ jobs: strategy: matrix: ruby-version: ['2.7', '3.1'] - rails-version: ['rails-6', 'rails-6.1', 'rails-7'] + rails-version: ['rails-6', 'rails-6.1', 'rails-7', 'rails-7.2'] env: BUNDLE_WITHOUT: release steps: From 1239ad2e90f83d977b90558f25fdd5c6e43541d9 Mon Sep 17 00:00:00 2001 From: Avin Hurry Date: Thu, 15 Aug 2024 21:26:50 +0100 Subject: [PATCH 4/7] appraisal install --- gemfiles/rails_6.1.gemfile.lock | 60 +++-- gemfiles/rails_6.gemfile.lock | 60 +++-- gemfiles/rails_7.2.gemfile | 12 + gemfiles/rails_7.2.gemfile.lock | 439 ++++++++++++++++++++++++++++++++ gemfiles/rails_7.gemfile.lock | 60 +++-- 5 files changed, 562 insertions(+), 69 deletions(-) create mode 100644 gemfiles/rails_7.2.gemfile create mode 100644 gemfiles/rails_7.2.gemfile.lock diff --git a/gemfiles/rails_6.1.gemfile.lock b/gemfiles/rails_6.1.gemfile.lock index 4f82b609..add50d4f 100644 --- a/gemfiles/rails_6.1.gemfile.lock +++ b/gemfiles/rails_6.1.gemfile.lock @@ -1,8 +1,10 @@ PATH remote: .. specs: - dfe-analytics (1.10.0) + dfe-analytics (1.14.0) google-cloud-bigquery (~> 1.38) + httparty (~> 0.21) + multi_xml (~> 0.6.0) request_store_rails (~> 2) GEM @@ -95,7 +97,9 @@ GEM async-pool (0.4.0) async (>= 1.25) backport (1.2.0) + base64 (0.2.0) benchmark (0.2.1) + bigdecimal (3.1.8) builder (3.2.4) coderay (1.1.3) concurrent-ruby (1.2.2) @@ -105,6 +109,7 @@ GEM crack (0.4.5) rexml crass (1.0.6) + csv (3.3.0) date (3.3.3) debug (1.8.0) irb (>= 1.5.0) @@ -133,37 +138,42 @@ GEM rake (>= 10.0) globalid (1.1.0) activesupport (>= 5.0) - google-apis-bigquery_v2 (0.55.0) - google-apis-core (>= 0.11.0, < 2.a) - google-apis-core (0.11.0) + google-apis-bigquery_v2 (0.75.0) + google-apis-core (>= 0.15.0, < 2.a) + google-apis-core (0.15.1) addressable (~> 2.5, >= 2.5.1) - googleauth (>= 0.16.2, < 2.a) - httpclient (>= 2.8.1, < 3.a) + googleauth (~> 1.9) + httpclient (>= 2.8.3, < 3.a) mini_mime (~> 1.0) + mutex_m representable (~> 3.0) retriable (>= 2.0, < 4.a) - rexml - webrick - google-cloud-bigquery (1.43.1) + google-cloud-bigquery (1.50.0) + bigdecimal (~> 3.0) concurrent-ruby (~> 1.0) - google-apis-bigquery_v2 (~> 0.1) + google-apis-bigquery_v2 (~> 0.71) + google-apis-core (~> 0.13) google-cloud-core (~> 1.6) - googleauth (>= 0.16.2, < 2.a) + googleauth (~> 1.9) mini_mime (~> 1.0) - google-cloud-core (1.6.0) - google-cloud-env (~> 1.0) + google-cloud-core (1.7.1) + google-cloud-env (>= 1.0, < 3.a) google-cloud-errors (~> 1.0) - google-cloud-env (1.6.0) - faraday (>= 0.17.3, < 3.0) - google-cloud-errors (1.3.1) - googleauth (1.6.0) - faraday (>= 0.17.3, < 3.a) + google-cloud-env (2.1.1) + faraday (>= 1.0, < 3.a) + google-cloud-errors (1.4.0) + googleauth (1.11.0) + faraday (>= 1.0, < 3.a) + google-cloud-env (~> 2.1) jwt (>= 1.4, < 3.0) - memoist (~> 0.16) multi_json (~> 1.11) os (>= 0.9, < 2.0) signet (>= 0.16, < 2.a) hashdiff (1.0.1) + httparty (0.22.0) + csv + mini_mime (>= 1.0.0) + multi_xml (>= 0.5.2) httpclient (2.8.3) i18n (1.14.1) concurrent-ruby (~> 1.0) @@ -175,7 +185,8 @@ GEM json (2.6.3) json-schema (2.8.1) addressable (>= 2.4) - jwt (2.7.1) + jwt (2.8.2) + base64 kramdown (2.4.0) rexml kramdown-parser-gfm (1.1.0) @@ -190,11 +201,12 @@ GEM net-pop net-smtp marcel (1.0.2) - memoist (0.16.2) method_source (1.0.0) mini_mime (1.1.2) minitest (5.18.1) multi_json (1.15.0) + multi_xml (0.6.0) + mutex_m (0.2.0) net-imap (0.3.6) date net-protocol @@ -319,7 +331,7 @@ GEM sawyer (0.9.2) addressable (>= 2.3.5) faraday (>= 0.17.3, < 3) - signet (0.17.0) + signet (0.19.0) addressable (~> 2.8) faraday (>= 0.17.5, < 3.a) jwt (>= 1.5, < 3.0) @@ -351,6 +363,7 @@ GEM sqlite3 (1.6.3-x86_64-darwin) thor (1.2.2) tilt (2.2.0) + timecop (0.9.10) timeout (0.4.0) timers (4.3.5) traces (0.11.1) @@ -363,7 +376,6 @@ GEM addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) - webrick (1.8.1) websocket-driver (0.7.5) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) @@ -374,6 +386,7 @@ GEM PLATFORMS arm64-darwin-21 + arm64-darwin-23 x86_64-darwin-22 DEPENDENCIES @@ -390,6 +403,7 @@ DEPENDENCIES rubocop-rspec (~> 2.22) solargraph sqlite3 + timecop webmock (~> 3.14) with_model diff --git a/gemfiles/rails_6.gemfile.lock b/gemfiles/rails_6.gemfile.lock index c30e3b3e..d34d021d 100644 --- a/gemfiles/rails_6.gemfile.lock +++ b/gemfiles/rails_6.gemfile.lock @@ -1,8 +1,10 @@ PATH remote: .. specs: - dfe-analytics (1.10.0) + dfe-analytics (1.14.0) google-cloud-bigquery (~> 1.38) + httparty (~> 0.21) + multi_xml (~> 0.6.0) request_store_rails (~> 2) GEM @@ -91,7 +93,9 @@ GEM async-pool (0.4.0) async (>= 1.25) backport (1.2.0) + base64 (0.2.0) benchmark (0.2.1) + bigdecimal (3.1.8) builder (3.2.4) coderay (1.1.3) concurrent-ruby (1.2.2) @@ -101,6 +105,7 @@ GEM crack (0.4.5) rexml crass (1.0.6) + csv (3.3.0) date (3.3.3) debug (1.8.0) irb (>= 1.5.0) @@ -129,37 +134,42 @@ GEM rake (>= 10.0) globalid (1.1.0) activesupport (>= 5.0) - google-apis-bigquery_v2 (0.55.0) - google-apis-core (>= 0.11.0, < 2.a) - google-apis-core (0.11.0) + google-apis-bigquery_v2 (0.75.0) + google-apis-core (>= 0.15.0, < 2.a) + google-apis-core (0.15.1) addressable (~> 2.5, >= 2.5.1) - googleauth (>= 0.16.2, < 2.a) - httpclient (>= 2.8.1, < 3.a) + googleauth (~> 1.9) + httpclient (>= 2.8.3, < 3.a) mini_mime (~> 1.0) + mutex_m representable (~> 3.0) retriable (>= 2.0, < 4.a) - rexml - webrick - google-cloud-bigquery (1.43.1) + google-cloud-bigquery (1.50.0) + bigdecimal (~> 3.0) concurrent-ruby (~> 1.0) - google-apis-bigquery_v2 (~> 0.1) + google-apis-bigquery_v2 (~> 0.71) + google-apis-core (~> 0.13) google-cloud-core (~> 1.6) - googleauth (>= 0.16.2, < 2.a) + googleauth (~> 1.9) mini_mime (~> 1.0) - google-cloud-core (1.6.0) - google-cloud-env (~> 1.0) + google-cloud-core (1.7.1) + google-cloud-env (>= 1.0, < 3.a) google-cloud-errors (~> 1.0) - google-cloud-env (1.6.0) - faraday (>= 0.17.3, < 3.0) - google-cloud-errors (1.3.1) - googleauth (1.6.0) - faraday (>= 0.17.3, < 3.a) + google-cloud-env (2.1.1) + faraday (>= 1.0, < 3.a) + google-cloud-errors (1.4.0) + googleauth (1.11.0) + faraday (>= 1.0, < 3.a) + google-cloud-env (~> 2.1) jwt (>= 1.4, < 3.0) - memoist (~> 0.16) multi_json (~> 1.11) os (>= 0.9, < 2.0) signet (>= 0.16, < 2.a) hashdiff (1.0.1) + httparty (0.22.0) + csv + mini_mime (>= 1.0.0) + multi_xml (>= 0.5.2) httpclient (2.8.3) i18n (1.14.1) concurrent-ruby (~> 1.0) @@ -171,7 +181,8 @@ GEM json (2.6.3) json-schema (2.8.1) addressable (>= 2.4) - jwt (2.7.1) + jwt (2.8.2) + base64 kramdown (2.4.0) rexml kramdown-parser-gfm (1.1.0) @@ -186,11 +197,12 @@ GEM net-pop net-smtp marcel (1.0.2) - memoist (0.16.2) method_source (1.0.0) mini_mime (1.1.2) minitest (5.18.1) multi_json (1.15.0) + multi_xml (0.6.0) + mutex_m (0.2.0) net-imap (0.3.6) date net-protocol @@ -316,7 +328,7 @@ GEM sawyer (0.9.2) addressable (>= 2.3.5) faraday (>= 0.17.3, < 3) - signet (0.17.0) + signet (0.19.0) addressable (~> 2.8) faraday (>= 0.17.5, < 3.a) jwt (>= 1.5, < 3.0) @@ -349,6 +361,7 @@ GEM thor (1.2.2) thread_safe (0.3.6) tilt (2.2.0) + timecop (0.9.10) timeout (0.4.0) timers (4.3.5) traces (0.11.1) @@ -361,7 +374,6 @@ GEM addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) - webrick (1.8.1) websocket-driver (0.7.5) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) @@ -372,6 +384,7 @@ GEM PLATFORMS arm64-darwin-21 + arm64-darwin-23 x86_64-darwin-22 DEPENDENCIES @@ -389,6 +402,7 @@ DEPENDENCIES rubocop-rspec (~> 2.22) solargraph sqlite3 + timecop webmock (~> 3.14) with_model diff --git a/gemfiles/rails_7.2.gemfile b/gemfiles/rails_7.2.gemfile new file mode 100644 index 00000000..6fabdf87 --- /dev/null +++ b/gemfiles/rails_7.2.gemfile @@ -0,0 +1,12 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "rails", "7.2" + +group :release do + gem "gem-release", require: false + gem "github_changelog_generator", require: false +end + +gemspec path: "../" diff --git a/gemfiles/rails_7.2.gemfile.lock b/gemfiles/rails_7.2.gemfile.lock new file mode 100644 index 00000000..8f623ef6 --- /dev/null +++ b/gemfiles/rails_7.2.gemfile.lock @@ -0,0 +1,439 @@ +PATH + remote: .. + specs: + dfe-analytics (1.14.0) + google-cloud-bigquery (~> 1.38) + httparty (~> 0.21) + multi_xml (~> 0.6.0) + request_store_rails (~> 2) + +GEM + remote: https://rubygems.org/ + specs: + actioncable (7.2.0) + actionpack (= 7.2.0) + activesupport (= 7.2.0) + nio4r (~> 2.0) + websocket-driver (>= 0.6.1) + zeitwerk (~> 2.6) + actionmailbox (7.2.0) + actionpack (= 7.2.0) + activejob (= 7.2.0) + activerecord (= 7.2.0) + activestorage (= 7.2.0) + activesupport (= 7.2.0) + mail (>= 2.8.0) + actionmailer (7.2.0) + actionpack (= 7.2.0) + actionview (= 7.2.0) + activejob (= 7.2.0) + activesupport (= 7.2.0) + mail (>= 2.8.0) + rails-dom-testing (~> 2.2) + actionpack (7.2.0) + actionview (= 7.2.0) + activesupport (= 7.2.0) + nokogiri (>= 1.8.5) + racc + rack (>= 2.2.4, < 3.2) + rack-session (>= 1.0.1) + rack-test (>= 0.6.3) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) + useragent (~> 0.16) + actiontext (7.2.0) + actionpack (= 7.2.0) + activerecord (= 7.2.0) + activestorage (= 7.2.0) + activesupport (= 7.2.0) + globalid (>= 0.6.0) + nokogiri (>= 1.8.5) + actionview (7.2.0) + activesupport (= 7.2.0) + builder (~> 3.1) + erubi (~> 1.11) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) + activejob (7.2.0) + activesupport (= 7.2.0) + globalid (>= 0.3.6) + activemodel (7.2.0) + activesupport (= 7.2.0) + activerecord (7.2.0) + activemodel (= 7.2.0) + activesupport (= 7.2.0) + timeout (>= 0.4.0) + activestorage (7.2.0) + actionpack (= 7.2.0) + activejob (= 7.2.0) + activerecord (= 7.2.0) + activesupport (= 7.2.0) + marcel (~> 1.0) + activesupport (7.2.0) + base64 + bigdecimal + concurrent-ruby (~> 1.0, >= 1.3.1) + connection_pool (>= 2.2.5) + drb + i18n (>= 1.6, < 2) + logger (>= 1.4.2) + minitest (>= 5.1) + securerandom (>= 0.3) + tzinfo (~> 2.0, >= 2.0.5) + addressable (2.8.7) + public_suffix (>= 2.0.2, < 7.0) + appraisal (2.5.0) + bundler + rake + thor (>= 0.14.0) + ast (2.4.2) + async (2.15.3) + console (~> 1.26) + fiber-annotation + io-event (~> 1.6, >= 1.6.5) + async-http (0.70.0) + async (>= 2.10.2) + async-pool (~> 0.7) + io-endpoint (~> 0.11) + io-stream (~> 0.4) + protocol-http (~> 0.28) + protocol-http1 (~> 0.19) + protocol-http2 (~> 0.18) + traces (>= 0.10) + async-http-faraday (0.17.0) + async-http (~> 0.42) + faraday + async-pool (0.8.0) + async (>= 1.25) + backport (1.2.0) + base64 (0.2.0) + benchmark (0.3.0) + bigdecimal (3.1.8) + builder (3.3.0) + coderay (1.1.3) + concurrent-ruby (1.3.4) + connection_pool (2.4.1) + console (1.27.0) + fiber-annotation + fiber-local (~> 1.1) + json + crack (1.0.0) + bigdecimal + rexml + crass (1.0.6) + csv (3.3.0) + date (3.3.4) + debug (1.9.2) + irb (~> 1.10) + reline (>= 0.3.8) + declarative (0.0.20) + diff-lcs (1.5.1) + drb (2.2.1) + e2mmap (0.1.0) + erubi (1.13.0) + faraday (2.10.1) + faraday-net_http (>= 2.0, < 3.2) + logger + faraday-http-cache (2.5.1) + faraday (>= 0.8) + faraday-net_http (3.1.1) + net-http + fiber-annotation (0.2.0) + fiber-local (1.1.0) + fiber-storage + fiber-storage (1.0.0) + gem-release (2.2.2) + github_changelog_generator (1.16.4) + activesupport + async (>= 1.25.0) + async-http-faraday + faraday-http-cache + multi_json + octokit (~> 4.6) + rainbow (>= 2.2.1) + rake (>= 10.0) + globalid (1.2.1) + activesupport (>= 6.1) + google-apis-bigquery_v2 (0.75.0) + google-apis-core (>= 0.15.0, < 2.a) + google-apis-core (0.15.1) + addressable (~> 2.5, >= 2.5.1) + googleauth (~> 1.9) + httpclient (>= 2.8.3, < 3.a) + mini_mime (~> 1.0) + mutex_m + representable (~> 3.0) + retriable (>= 2.0, < 4.a) + google-cloud-bigquery (1.50.0) + bigdecimal (~> 3.0) + concurrent-ruby (~> 1.0) + google-apis-bigquery_v2 (~> 0.71) + google-apis-core (~> 0.13) + google-cloud-core (~> 1.6) + googleauth (~> 1.9) + mini_mime (~> 1.0) + google-cloud-core (1.7.1) + google-cloud-env (>= 1.0, < 3.a) + google-cloud-errors (~> 1.0) + google-cloud-env (2.1.1) + faraday (>= 1.0, < 3.a) + google-cloud-errors (1.4.0) + googleauth (1.11.0) + faraday (>= 1.0, < 3.a) + google-cloud-env (~> 2.1) + jwt (>= 1.4, < 3.0) + multi_json (~> 1.11) + os (>= 0.9, < 2.0) + signet (>= 0.16, < 2.a) + hashdiff (1.1.1) + httparty (0.22.0) + csv + mini_mime (>= 1.0.0) + multi_xml (>= 0.5.2) + httpclient (2.8.3) + i18n (1.14.5) + concurrent-ruby (~> 1.0) + io-console (0.7.2) + io-endpoint (0.13.0) + io-event (1.6.5) + io-stream (0.4.0) + irb (1.14.0) + rdoc (>= 4.0.0) + reline (>= 0.4.2) + jaro_winkler (1.6.0) + json (2.7.2) + json-schema (2.8.1) + addressable (>= 2.4) + jwt (2.8.2) + base64 + kramdown (2.4.0) + rexml + kramdown-parser-gfm (1.1.0) + kramdown (~> 2.0) + language_server-protocol (3.17.0.3) + logger (1.6.0) + loofah (2.22.0) + crass (~> 1.0.2) + nokogiri (>= 1.12.0) + mail (2.8.1) + mini_mime (>= 0.1.1) + net-imap + net-pop + net-smtp + marcel (1.0.4) + method_source (1.1.0) + mini_mime (1.1.5) + minitest (5.25.0) + multi_json (1.15.0) + multi_xml (0.6.0) + mutex_m (0.2.0) + net-http (0.4.1) + uri + net-imap (0.4.14) + date + net-protocol + net-pop (0.1.2) + net-protocol + net-protocol (0.2.2) + timeout + net-smtp (0.5.0) + net-protocol + nio4r (2.7.3) + nokogiri (1.16.7-arm64-darwin) + racc (~> 1.4) + octokit (4.25.1) + faraday (>= 1, < 3) + sawyer (~> 0.9) + os (1.1.4) + parallel (1.26.2) + parser (3.3.4.2) + ast (~> 2.4.1) + racc + protocol-hpack (1.5.0) + protocol-http (0.28.1) + protocol-http1 (0.19.1) + protocol-http (~> 0.22) + protocol-http2 (0.18.0) + protocol-hpack (~> 1.4) + protocol-http (~> 0.18) + pry (0.14.2) + coderay (~> 1.1) + method_source (~> 1.0) + psych (5.1.2) + stringio + public_suffix (6.0.1) + racc (1.8.1) + rack (3.1.7) + rack-session (2.0.0) + rack (>= 3.0.0) + rack-test (2.1.0) + rack (>= 1.3) + rackup (2.1.0) + rack (>= 3) + webrick (~> 1.8) + rails (7.2.0) + actioncable (= 7.2.0) + actionmailbox (= 7.2.0) + actionmailer (= 7.2.0) + actionpack (= 7.2.0) + actiontext (= 7.2.0) + actionview (= 7.2.0) + activejob (= 7.2.0) + activemodel (= 7.2.0) + activerecord (= 7.2.0) + activestorage (= 7.2.0) + activesupport (= 7.2.0) + bundler (>= 1.15.0) + railties (= 7.2.0) + rails-dom-testing (2.2.0) + activesupport (>= 5.0.0) + minitest + nokogiri (>= 1.6) + rails-html-sanitizer (1.6.0) + loofah (~> 2.21) + nokogiri (~> 1.14) + railties (7.2.0) + actionpack (= 7.2.0) + activesupport (= 7.2.0) + irb (~> 1.13) + rackup (>= 1.0.0) + rake (>= 12.2) + thor (~> 1.0, >= 1.2.2) + zeitwerk (~> 2.6) + rainbow (3.1.1) + rake (13.2.1) + rbs (2.8.4) + rdoc (6.7.0) + psych (>= 4.0.0) + regexp_parser (2.9.2) + reline (0.5.9) + io-console (~> 0.5) + representable (3.2.0) + declarative (< 0.1.0) + trailblazer-option (>= 0.1.1, < 0.2.0) + uber (< 0.2.0) + request_store_rails (2.0.0) + concurrent-ruby (~> 1.0) + retriable (3.1.2) + reverse_markdown (2.1.1) + nokogiri + rexml (3.3.5) + strscan + rspec-core (3.13.0) + rspec-support (~> 3.13.0) + rspec-expectations (3.13.1) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.13.0) + rspec-mocks (3.13.1) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.13.0) + rspec-rails (5.1.2) + actionpack (>= 5.2) + activesupport (>= 5.2) + railties (>= 5.2) + rspec-core (~> 3.10) + rspec-expectations (~> 3.10) + rspec-mocks (~> 3.10) + rspec-support (~> 3.10) + rspec-support (3.13.1) + rubocop (1.65.1) + json (~> 2.3) + language_server-protocol (>= 3.17.0) + parallel (~> 1.10) + parser (>= 3.3.0.2) + rainbow (>= 2.2.2, < 4.0) + regexp_parser (>= 2.4, < 3.0) + rexml (>= 3.2.5, < 4.0) + rubocop-ast (>= 1.31.1, < 2.0) + ruby-progressbar (~> 1.7) + unicode-display_width (>= 2.4.0, < 3.0) + rubocop-ast (1.32.0) + parser (>= 3.3.1.0) + rubocop-capybara (2.21.0) + rubocop (~> 1.41) + rubocop-factory_bot (2.26.1) + rubocop (~> 1.61) + rubocop-rspec (2.31.0) + rubocop (~> 1.40) + rubocop-capybara (~> 2.17) + rubocop-factory_bot (~> 2.22) + rubocop-rspec_rails (~> 2.28) + rubocop-rspec_rails (2.29.1) + rubocop (~> 1.61) + ruby-progressbar (1.13.0) + sawyer (0.9.2) + addressable (>= 2.3.5) + faraday (>= 0.17.3, < 3) + securerandom (0.3.1) + signet (0.19.0) + addressable (~> 2.8) + faraday (>= 0.17.5, < 3.a) + jwt (>= 1.5, < 3.0) + multi_json (~> 1.10) + solargraph (0.50.0) + backport (~> 1.2) + benchmark + bundler (~> 2.0) + diff-lcs (~> 1.4) + e2mmap + jaro_winkler (~> 1.5) + kramdown (~> 2.3) + kramdown-parser-gfm (~> 1.1) + parser (~> 3.0) + rbs (~> 2.0) + reverse_markdown (~> 2.0) + rubocop (~> 1.38) + thor (~> 1.0) + tilt (~> 2.0) + yard (~> 0.9, >= 0.9.24) + sqlite3 (2.0.4-arm64-darwin) + stringio (3.1.1) + strscan (3.1.0) + thor (1.3.1) + tilt (2.4.0) + timecop (0.9.10) + timeout (0.4.1) + traces (0.11.1) + trailblazer-option (0.1.2) + tzinfo (2.0.6) + concurrent-ruby (~> 1.0) + uber (0.1.0) + unicode-display_width (2.5.0) + uri (0.13.0) + useragent (0.16.10) + webmock (3.23.1) + addressable (>= 2.8.0) + crack (>= 0.3.2) + hashdiff (>= 0.4.0, < 2.0.0) + webrick (1.8.1) + websocket-driver (0.7.6) + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.5) + with_model (2.1.7) + activerecord (>= 6.0) + yard (0.9.36) + zeitwerk (2.6.17) + +PLATFORMS + arm64-darwin-23 + +DEPENDENCIES + appraisal + debug (>= 1.0.0) + dfe-analytics! + gem-release + github_changelog_generator + json-schema (~> 2.8) + pry (~> 0) + rails (= 7.2) + rspec-rails (~> 5.0) + rubocop (~> 1.54) + rubocop-rspec (~> 2.22) + solargraph + sqlite3 + timecop + webmock (~> 3.14) + with_model + +BUNDLED WITH + 2.3.13 diff --git a/gemfiles/rails_7.gemfile.lock b/gemfiles/rails_7.gemfile.lock index 31ca6c89..0938f539 100644 --- a/gemfiles/rails_7.gemfile.lock +++ b/gemfiles/rails_7.gemfile.lock @@ -1,8 +1,10 @@ PATH remote: .. specs: - dfe-analytics (1.10.0) + dfe-analytics (1.14.0) google-cloud-bigquery (~> 1.38) + httparty (~> 0.21) + multi_xml (~> 0.6.0) request_store_rails (~> 2) GEM @@ -101,7 +103,9 @@ GEM async-pool (0.4.0) async (>= 1.25) backport (1.2.0) + base64 (0.2.0) benchmark (0.2.1) + bigdecimal (3.1.8) builder (3.2.4) coderay (1.1.3) concurrent-ruby (1.2.2) @@ -111,6 +115,7 @@ GEM crack (0.4.5) rexml crass (1.0.6) + csv (3.3.0) date (3.3.3) debug (1.8.0) irb (>= 1.5.0) @@ -139,37 +144,42 @@ GEM rake (>= 10.0) globalid (1.1.0) activesupport (>= 5.0) - google-apis-bigquery_v2 (0.55.0) - google-apis-core (>= 0.11.0, < 2.a) - google-apis-core (0.11.0) + google-apis-bigquery_v2 (0.75.0) + google-apis-core (>= 0.15.0, < 2.a) + google-apis-core (0.15.1) addressable (~> 2.5, >= 2.5.1) - googleauth (>= 0.16.2, < 2.a) - httpclient (>= 2.8.1, < 3.a) + googleauth (~> 1.9) + httpclient (>= 2.8.3, < 3.a) mini_mime (~> 1.0) + mutex_m representable (~> 3.0) retriable (>= 2.0, < 4.a) - rexml - webrick - google-cloud-bigquery (1.43.1) + google-cloud-bigquery (1.50.0) + bigdecimal (~> 3.0) concurrent-ruby (~> 1.0) - google-apis-bigquery_v2 (~> 0.1) + google-apis-bigquery_v2 (~> 0.71) + google-apis-core (~> 0.13) google-cloud-core (~> 1.6) - googleauth (>= 0.16.2, < 2.a) + googleauth (~> 1.9) mini_mime (~> 1.0) - google-cloud-core (1.6.0) - google-cloud-env (~> 1.0) + google-cloud-core (1.7.1) + google-cloud-env (>= 1.0, < 3.a) google-cloud-errors (~> 1.0) - google-cloud-env (1.6.0) - faraday (>= 0.17.3, < 3.0) - google-cloud-errors (1.3.1) - googleauth (1.6.0) - faraday (>= 0.17.3, < 3.a) + google-cloud-env (2.1.1) + faraday (>= 1.0, < 3.a) + google-cloud-errors (1.4.0) + googleauth (1.11.0) + faraday (>= 1.0, < 3.a) + google-cloud-env (~> 2.1) jwt (>= 1.4, < 3.0) - memoist (~> 0.16) multi_json (~> 1.11) os (>= 0.9, < 2.0) signet (>= 0.16, < 2.a) hashdiff (1.0.1) + httparty (0.22.0) + csv + mini_mime (>= 1.0.0) + multi_xml (>= 0.5.2) httpclient (2.8.3) i18n (1.14.1) concurrent-ruby (~> 1.0) @@ -181,7 +191,8 @@ GEM json (2.6.3) json-schema (2.8.1) addressable (>= 2.4) - jwt (2.7.1) + jwt (2.8.2) + base64 kramdown (2.4.0) rexml kramdown-parser-gfm (1.1.0) @@ -196,11 +207,12 @@ GEM net-pop net-smtp marcel (1.0.2) - memoist (0.16.2) method_source (1.0.0) mini_mime (1.1.2) minitest (5.18.1) multi_json (1.15.0) + multi_xml (0.6.0) + mutex_m (0.2.0) net-imap (0.3.6) date net-protocol @@ -325,7 +337,7 @@ GEM sawyer (0.9.2) addressable (>= 2.3.5) faraday (>= 0.17.3, < 3) - signet (0.17.0) + signet (0.19.0) addressable (~> 2.8) faraday (>= 0.17.5, < 3.a) jwt (>= 1.5, < 3.0) @@ -350,6 +362,7 @@ GEM sqlite3 (1.6.3-x86_64-darwin) thor (1.2.2) tilt (2.2.0) + timecop (0.9.10) timeout (0.4.0) timers (4.3.5) traces (0.11.1) @@ -362,7 +375,6 @@ GEM addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) - webrick (1.8.1) websocket-driver (0.7.5) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) @@ -373,6 +385,7 @@ GEM PLATFORMS arm64-darwin-21 + arm64-darwin-23 x86_64-darwin-22 DEPENDENCIES @@ -389,6 +402,7 @@ DEPENDENCIES rubocop-rspec (~> 2.22) solargraph sqlite3 + timecop webmock (~> 3.14) with_model From c0a9e8c4da3a742ac922edbd86179ab3fa8aafb1 Mon Sep 17 00:00:00 2001 From: Avin Hurry Date: Thu, 15 Aug 2024 21:48:16 +0100 Subject: [PATCH 5/7] Fixture path is deprecated https://github.com/rspec/rspec-rails/issues/2661 --- Appraisals | 1 + Gemfile.lock | 2 +- dfe-analytics.gemspec | 2 +- gemfiles/rails_6.1.gemfile.lock | 2 +- gemfiles/rails_6.gemfile.lock | 2 +- gemfiles/rails_7.2.gemfile | 1 + gemfiles/rails_7.2.gemfile.lock | 18 +++++++++--------- gemfiles/rails_7.gemfile.lock | 2 +- 8 files changed, 16 insertions(+), 14 deletions(-) diff --git a/Appraisals b/Appraisals index 61947190..73ed7d91 100644 --- a/Appraisals +++ b/Appraisals @@ -13,4 +13,5 @@ end appraise "rails-7.2" do gem "rails", "7.2" + gem "rspec-rails", "6.1.3" end diff --git a/Gemfile.lock b/Gemfile.lock index d1c7ac9a..84b9a144 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -402,7 +402,7 @@ DEPENDENCIES json-schema (~> 2.8) pry (~> 0) rails (>= 6) - rspec-rails (~> 5.0) + rspec-rails rubocop (~> 1.54) rubocop-rspec (~> 2.22) solargraph diff --git a/dfe-analytics.gemspec b/dfe-analytics.gemspec index 413e4b02..6b82a339 100644 --- a/dfe-analytics.gemspec +++ b/dfe-analytics.gemspec @@ -35,7 +35,7 @@ Gem::Specification.new do |spec| spec.add_development_dependency 'json-schema', '~> 2.8' spec.add_development_dependency 'pry', '~> 0' spec.add_development_dependency 'rails', '>= 6' - spec.add_development_dependency 'rspec-rails', '~> 5.0' + spec.add_development_dependency 'rspec-rails' spec.add_development_dependency 'rubocop', '~> 1.54' spec.add_development_dependency 'rubocop-rspec', '~> 2.22' spec.add_development_dependency 'solargraph' diff --git a/gemfiles/rails_6.1.gemfile.lock b/gemfiles/rails_6.1.gemfile.lock index add50d4f..ac3e89ef 100644 --- a/gemfiles/rails_6.1.gemfile.lock +++ b/gemfiles/rails_6.1.gemfile.lock @@ -398,7 +398,7 @@ DEPENDENCIES json-schema (~> 2.8) pry (~> 0) rails (= 6.1.7) - rspec-rails (~> 5.0) + rspec-rails rubocop (~> 1.54) rubocop-rspec (~> 2.22) solargraph diff --git a/gemfiles/rails_6.gemfile.lock b/gemfiles/rails_6.gemfile.lock index d34d021d..ee54f8de 100644 --- a/gemfiles/rails_6.gemfile.lock +++ b/gemfiles/rails_6.gemfile.lock @@ -397,7 +397,7 @@ DEPENDENCIES pry (~> 0) psych (< 4) rails (= 6.0.6) - rspec-rails (~> 5.0) + rspec-rails rubocop (~> 1.54) rubocop-rspec (~> 2.22) solargraph diff --git a/gemfiles/rails_7.2.gemfile b/gemfiles/rails_7.2.gemfile index 6fabdf87..08752a42 100644 --- a/gemfiles/rails_7.2.gemfile +++ b/gemfiles/rails_7.2.gemfile @@ -3,6 +3,7 @@ source "https://rubygems.org" gem "rails", "7.2" +gem "rspec-rails", "6.1.3" group :release do gem "gem-release", require: false diff --git a/gemfiles/rails_7.2.gemfile.lock b/gemfiles/rails_7.2.gemfile.lock index 8f623ef6..8ae7a25e 100644 --- a/gemfiles/rails_7.2.gemfile.lock +++ b/gemfiles/rails_7.2.gemfile.lock @@ -327,14 +327,14 @@ GEM rspec-mocks (3.13.1) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) - rspec-rails (5.1.2) - actionpack (>= 5.2) - activesupport (>= 5.2) - railties (>= 5.2) - rspec-core (~> 3.10) - rspec-expectations (~> 3.10) - rspec-mocks (~> 3.10) - rspec-support (~> 3.10) + rspec-rails (6.1.3) + actionpack (>= 6.1) + activesupport (>= 6.1) + railties (>= 6.1) + rspec-core (~> 3.13) + rspec-expectations (~> 3.13) + rspec-mocks (~> 3.13) + rspec-support (~> 3.13) rspec-support (3.13.1) rubocop (1.65.1) json (~> 2.3) @@ -426,7 +426,7 @@ DEPENDENCIES json-schema (~> 2.8) pry (~> 0) rails (= 7.2) - rspec-rails (~> 5.0) + rspec-rails (= 6.1.3) rubocop (~> 1.54) rubocop-rspec (~> 2.22) solargraph diff --git a/gemfiles/rails_7.gemfile.lock b/gemfiles/rails_7.gemfile.lock index 0938f539..02266177 100644 --- a/gemfiles/rails_7.gemfile.lock +++ b/gemfiles/rails_7.gemfile.lock @@ -397,7 +397,7 @@ DEPENDENCIES json-schema (~> 2.8) pry (~> 0) rails (= 7.0.4) - rspec-rails (~> 5.0) + rspec-rails rubocop (~> 1.54) rubocop-rspec (~> 2.22) solargraph From 32dc3b965e328729a13ac94a2b9f4487d101872a Mon Sep 17 00:00:00 2001 From: Avin Hurry Date: Thu, 15 Aug 2024 22:38:12 +0100 Subject: [PATCH 6/7] Remove ruby 2.7 tests Ruby 2.7 reached its EOL on 2023-03-31 --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9dd797bc..d382770c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,7 +12,7 @@ jobs: name: Run specs strategy: matrix: - ruby-version: ['2.7', '3.1'] + ruby-version: ['3.1'] rails-version: ['rails-6', 'rails-6.1', 'rails-7', 'rails-7.2'] env: BUNDLE_WITHOUT: release From d19d9aa8073ea6f250692576f3f56a25cf1c150e Mon Sep 17 00:00:00 2001 From: Avin Hurry Date: Thu, 15 Aug 2024 22:52:37 +0100 Subject: [PATCH 7/7] Add test for rails 7.1 or lower To maintain test coverage --- spec/dfe/analytics_spec.rb | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/spec/dfe/analytics_spec.rb b/spec/dfe/analytics_spec.rb index df796006..5f5fcd50 100644 --- a/spec/dfe/analytics_spec.rb +++ b/spec/dfe/analytics_spec.rb @@ -22,7 +22,7 @@ end end - describe 'when no database connection is available' do + describe 'when no database connection is available on rails 7.2 or higher' do before do allow(Rails).to receive(:version).and_return('7.2') allow(ActiveRecord::Base).to receive(:with_connection).and_raise(ActiveRecord::ConnectionNotEstablished) @@ -34,6 +34,18 @@ end end + describe 'when no database connection is available on rails 7.1 or lower' do + before do + allow(Rails).to receive(:version).and_return('7.1') + allow(ActiveRecord::Base).to receive(:connection).and_raise(ActiveRecord::ConnectionNotEstablished) + end + + it 'recovers and logs' do + expect(Rails.logger).to receive(:info).with(/No database connection/) + expect { DfE::Analytics.initialize! }.not_to raise_error + end + end + describe 'when migrations are pending' do it 'recovers and logs' do allow(DfE::Analytics::Fields).to receive(:check!).and_raise(ActiveRecord::PendingMigrationError)