From dcf51ebeafa8d9094dd4bd89741f246edf693b96 Mon Sep 17 00:00:00 2001 From: Johny Ho Date: Sat, 6 Jan 2024 19:36:49 -0500 Subject: [PATCH] Update supported ruby and rails versions --- .github/workflows/build.yml | 4 ++-- gemfiles/rails7.0.gemfile | 2 +- gemfiles/rails7.1.gemfile | 8 ++++++++ spec/log_subscriber_spec.rb | 11 ++++++++--- 4 files changed, 19 insertions(+), 6 deletions(-) create mode 100644 gemfiles/rails7.1.gemfile diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6b9225b..666c9aa 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,8 +9,8 @@ jobs: strategy: fail-fast: false matrix: - ruby: ['3.2', '3.1', '2.7'] - rails: ['7.0'] + ruby: ['3.3', '3.2', '3.1'] + rails: ['7.0', '7.1'] runs-on: 'ubuntu-latest' env: diff --git a/gemfiles/rails7.0.gemfile b/gemfiles/rails7.0.gemfile index 4377414..ca597a7 100644 --- a/gemfiles/rails7.0.gemfile +++ b/gemfiles/rails7.0.gemfile @@ -5,4 +5,4 @@ gemspec name: "humid", path: "../" gem "rake" gem "rspec" gem "byebug" -gem 'rails', '~> 7.0' +gem 'rails', '~> 7.0.0' diff --git a/gemfiles/rails7.1.gemfile b/gemfiles/rails7.1.gemfile new file mode 100644 index 0000000..6c40b1f --- /dev/null +++ b/gemfiles/rails7.1.gemfile @@ -0,0 +1,8 @@ +source 'https://rubygems.org' + +gemspec name: "humid", path: "../" + +gem "rake" +gem "rspec" +gem "byebug" +gem 'rails', '~> 7.1.0' diff --git a/spec/log_subscriber_spec.rb b/spec/log_subscriber_spec.rb index 9f42964..9147b51 100644 --- a/spec/log_subscriber_spec.rb +++ b/spec/log_subscriber_spec.rb @@ -17,10 +17,17 @@ def current Thread.current.active_support_execution_state end + def key + if Rails.version >= "7.1" + "attr_humid_runtime_#{Humid::LogSubscriber.object_id}" + else + "attr_Humid::LogSubscriber_humid_runtime" + end + end + context ".runtime" do it "is returns the runtime from the thread local" do expect(Humid::LogSubscriber.runtime).to eql 0 - key = "attr_Humid::LogSubscriber_humid_runtime" current[key] = 3 expect(Humid::LogSubscriber.runtime).to eql 3 end @@ -30,7 +37,6 @@ def current it "sets the runtime in a thread-safe manner" do expect(Humid::LogSubscriber.runtime).to eql 0 Humid::LogSubscriber.runtime = 3 - key = "attr_Humid::LogSubscriber_humid_runtime" expect(current[key]).to eql 3 end end @@ -38,7 +44,6 @@ def current context ".reset_runtime" do it "resets the runtime" do Humid::LogSubscriber.runtime = 3 - key = "attr_Humid::LogSubscriber_humid_runtime" expect(current[key]).to eql 3 Humid::LogSubscriber.reset_runtime