Skip to content

Commit

Permalink
Merge pull request #2087 from samvera/hyrax-5-upgrade-redis-end-point…
Browse files Browse the repository at this point in the history
…-fix

🤖 Fix stub methods to pass tests
  • Loading branch information
jeremyf authored Dec 20, 2023
2 parents 754013a + 73359b6 commit 87ce1dc
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions spec/models/redis_endpoint_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,23 @@
let(:namespace) { 'foobar' }

describe '.options' do
subject { described_class.new namespace: }
subject { described_class.new(namespace:) }

it 'uses the configured application settings' do
expect(subject.options[:namespace]).to eq namespace
end
end

describe '#ping' do
let(:faux_redis_instance) { double(Hyrax::RedisEventStore, ping: 'PONG') }
it 'checks if the service is up' do
allow(Hyrax::RedisEventStore.instance).to receive(:ping).and_return('PONG')
allow(subject).to receive(:redis_instance).and_return(faux_redis_instance)
expect(subject.ping).to be_truthy
end

it 'is false if the service is down' do
allow(Hyrax::RedisEventStore.instance).to receive(:ping).and_raise(RuntimeError)
allow(faux_redis_instance).to receive(:ping).and_raise(RuntimeError)
allow(subject).to receive(:redis_instance).and_return(faux_redis_instance)
expect(subject.ping).to eq false
end
end
Expand Down

0 comments on commit 87ce1dc

Please sign in to comment.