Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update redis gem to support secure connections on Heroku #1

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@
# In the test, we wait for the subscriber to make the test more predictable
let(:logger) { ActiveSupport::TaggedLogging.new(Logger.new(STDOUT)) }
let!(:subscriber) { SyncedMemoryStore::Subscriber.instance().tap {|i| i.configure(logger: logger).start(wait: true)} }
let!(:redis) { Redis.new(url: ENV['REDIS_URL']).tap { |r| r.flushdb }.client }
let!(:redis) { Redis.new.tap { |r| r.flushdb }.client }
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're never setting REDIS_URL in specs so by not configuring it we just rely on the default URL

before(:each) { subscriber.reset! }

context "using two isolated instances with a redis underlying cache" do
let(:cache_1) { ActiveSupport::Cache::RedisStore.new(ENV.fetch('REDIS_URL')) }
let(:cache_2) { ActiveSupport::Cache::RedisStore.new(ENV.fetch('REDIS_URL')) }
let(:cache_1) { ActiveSupport::Cache::RedisStore.new }
let(:cache_2) { ActiveSupport::Cache::RedisStore.new }
let!(:instance_1) { SyncedMemoryStore::Store.new(cache: cache_1, redis: redis, subscriber: subscriber) }
let!(:instance_2) { SyncedMemoryStore::Store.new(cache: cache_2, redis: redis, subscriber: subscriber) }

it "Should add to instance 2 when a new key is added to instance 1" do
instance_1.write("key_1", "key_1 value")
wait_for { instance_2.fetch("key_1") }.to eq("key_1 value")
Expand Down Expand Up @@ -127,4 +128,4 @@
expect(values).to eql("key_1" => "correct_value_for_key_1", "key_2" => "correct_value_for_key_2")
end
end
end
end
4 changes: 2 additions & 2 deletions synced_memory_store.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ Gem::Specification.new do |spec|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]

spec.add_development_dependency "bundler", "~> 1.14"
spec.add_development_dependency "bundler", "~> 2.0"
spec.add_development_dependency "rake", "~> 10.0"
spec.add_development_dependency "rspec", "~> 3.0"
spec.add_development_dependency "rspec-wait", "~> 0.0"
spec.add_development_dependency "redis-activesupport", " ~> 5.0"
spec.add_dependency "redis", "~> 3.3"
spec.add_dependency "redis", "~> 4.1"
spec.add_dependency "activesupport", "~> 5"
end