Skip to content

Commit

Permalink
Update supported ruby and rails versions (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
jho406 committed Jan 7, 2024
1 parent c1d0e3d commit 64308eb
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion gemfiles/rails7.0.gemfile
Expand Up @@ -5,4 +5,4 @@ gemspec name: "humid", path: "../"
gem "rake"
gem "rspec"
gem "byebug"
gem 'rails', '~> 7.0'
gem 'rails', '~> 7.0.0'
8 changes: 8 additions & 0 deletions 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'
11 changes: 8 additions & 3 deletions spec/log_subscriber_spec.rb
Expand Up @@ -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
Expand All @@ -30,15 +37,13 @@ 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

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
Expand Down

0 comments on commit 64308eb

Please sign in to comment.