Sha256: 26142dad3750a3759623fb917579a875209a93d3d95ea1f701bf727252d570ad
Contents?: true
Size: 1.49 KB
Versions: 3
Compression:
Stored size: 1.49 KB
Contents
# frozen_string_literal: true require 'rails_helper' RSpec.describe(OkComputer::PusherCheck) do let(:client) do Pusher::Client.new({ app_id: '20', key: '12345678900000001', secret: '12345678900000001', host: 'api.pusherapp.com', port: 80, }) end let(:response) { { status: 200, body: MultiJson.encode({}) } } subject(:check) { described_class.new(client: client) } before { stub_request(:get, %r{/apps/20/channels}).to_return(response) } context('when successful') do let(:response) do { status: 200, body: MultiJson.encode(channels: { channel1: {}, channel2: {} }), } end it { is_expected.to(be_successful_check) } it { is_expected.to(have_message('Channels check successful')) } context('when not client') do subject(:check) do described_class.new( app_id: '20', app_key: '12345678900000001', app_secret: '12345678900000001' ) end it { is_expected.to(be_successful_check) } end end context('when 401 fails') do let(:response) { { status: 401, body: MultiJson.encode({}) } } it { is_expected.not_to(be_successful_check) } it { is_expected.to(have_message("Error: '{}'")) } end context('when 403 fails') do let(:response) { { status: 403, body: MultiJson.encode({}) } } it { is_expected.not_to(be_successful_check) } it { is_expected.to(have_message("Error: 'Unknown error (status code 403): {}'")) } end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
okcomputer-checks-1.1.1 | spec/ok_computer/pusher_check_spec.rb |
okcomputer-checks-1.1.0 | spec/ok_computer/pusher_check_spec.rb |
okcomputer-checks-1.0.0 | spec/ok_computer/pusher_check_spec.rb |