Skip to content

Commit

Permalink
Adds redis-rb:5.x compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
smarjin committed Dec 8, 2022
1 parent 4a7a0b9 commit 86db6aa
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ coverage
rdoc
pkg
*.gem
gemfiles/*.lock
Gemfile.lock
.rspec_status

## PROJECT::SPECIFIC
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ or even simpler

```ruby
require 'redis'
$rollout = Rollout.new(Redis.current) # Will use REDIS_URL env var or default redis url

redis = Redis.new(host: 'redis', port: 6379, db: 19, reconnect_attempts: [0.05, 0.1, 0.2])

$rollout = Rollout.new(redis) # Will use REDIS_URL env var or default redis url
```


Expand Down
2 changes: 1 addition & 1 deletion lib/rollout/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

class Rollout
VERSION = '2.5.0'
VERSION = '2.5.1'
end
2 changes: 1 addition & 1 deletion rollout.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Gem::Specification.new do |spec|

spec.required_ruby_version = '>= 2.3'

spec.add_dependency 'redis', '~> 4.0'
spec.add_dependency 'redis', '>= 4.0', '< 6.0'

spec.add_development_dependency 'bundler', '>= 1.17'
spec.add_development_dependency 'pry'
Expand Down
2 changes: 1 addition & 1 deletion spec/rollout/feature_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require "spec_helper"

describe "Rollout::Feature" do
let(:rollout) { Rollout.new(Redis.current) }
let(:rollout) { Rollout.new(REDIS_CURRENT) }

describe "#add_user" do
it "ids a user using id_user_by" do
Expand Down
2 changes: 1 addition & 1 deletion spec/rollout/logging_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'spec_helper'

RSpec.describe 'Rollout::Logging' do
let(:rollout) { Rollout.new(Redis.current, logging: logging) }
let(:rollout) { Rollout.new(REDIS_CURRENT, logging: logging) }
let(:logging) { true }
let(:feature) { :foo }

Expand Down
2 changes: 1 addition & 1 deletion spec/rollout_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require "spec_helper"

RSpec.describe "Rollout" do
let(:rollout) { Rollout.new(Redis.current) }
let(:rollout) { Rollout.new(REDIS_CURRENT) }

describe "when a group is activated" do
before do
Expand Down
5 changes: 3 additions & 2 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
require 'redis'
require 'rollout'

Redis.current = Redis.new(
REDIS_CURRENT = Redis.new(
host: ENV.fetch('REDIS_HOST', '127.0.0.1'),
port: ENV.fetch('REDIS_PORT', '6379'),
db: ENV.fetch('REDIS_DB', '7'),
reconnect_attempts: [0.05, 0.1, 0.2]
)

RSpec.configure do |config|
Expand All @@ -23,5 +24,5 @@
c.syntax = :expect
end

config.before { Redis.current.flushdb }
config.before { REDIS_CURRENT.flushdb }
end

0 comments on commit 86db6aa

Please sign in to comment.