Sha256: 35aa651cda678d34bc1f04b244a9cc369a02e8d2f7b0e7d302e659c2b16a5b6d
Contents?: true
Size: 1.25 KB
Versions: 2
Compression:
Stored size: 1.25 KB
Contents
# frozen_string_literal: true require 'rails_helper' RSpec.describe HeyDoctor::CheckRedisHealthService do describe '.call' do context 'when it is connected' do let(:expected_response) do { success: true, message: 'Redis is connected' } end it 'respond with success' do expect(described_class.call).to eq(expected_response) end end context 'when it is not connected' do let(:expected_response) do { success: false, message: 'Error connecting to redis' } end before do allow(Redis.current).to receive(:get).and_raise(NameError) end it 'respond with success' do expect(described_class.call).to eq(expected_response) end end end describe '.connected?' do context 'when it is connected' do it 'respond with success' do expect(described_class.send(:connected?)).to eq(true) end end context 'when it is not connected' do before do allow(Redis.current).to receive(:get) .and_raise(Redis::CannotConnectError) end it 'respond with success' do expect(described_class.send(:connected?)).to eq(false) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
hey_doctor-1.3.1 | spec/services/hey_doctor/check_redis_health_service_spec.rb |
hey_doctor-1.2.1 | spec/services/hey_doctor/check_redis_health_service_spec.rb |