Sha256: 49a454244492b1cc014ceabc78b192ace6de926c4cd8ba71d3dee74f1a0aafef

Contents?: true

Size: 1.61 KB

Versions: 1

Compression:

Stored size: 1.61 KB

Contents

require 'spec_helper'

describe Xcal::Parktronic::ApiClient do

  let(:api_http_client)   { Xcal::Parktronic::ApiClient.new(endpoint: 'http://api.mock', access_token: 'access_token') }
  let(:api_invalid_client){ Xcal::Parktronic::ApiClient.new(endpoint: 'http://api.mock') }

  context 'events route' do
    describe '#get_event' do
      it 'should get event by id' do
        expect{ api_http_client.get_event(1) }.not_to raise_error

        event = api_http_client.get_event(1)
        expect(event.service_impacted).to eql('Redis Hitrate')
      end
    end

    describe '#update_event' do
      it 'should update event by id' do
        expect{ api_http_client.update_event() }.to raise_error
        expect{ api_http_client.update_event(1, service_impacted: 'test') }.not_to raise_error
      end
    end

    describe '#get_event_tags' do
      it 'should get tags of event' do
        expect{ api_http_client.get_event_tags(1) }.not_to raise_error
      end
    end

    describe '#search_events' do
      it 'responds to search_events' do
        events = nil
        expect { events = api_http_client.search_events }.not_to raise_error
        expect(events).to be_a Array
      end
    end

    describe '#status_update_events' do
      let(:status_update_params) { {incident_sor: 'tp', incident_id: ['IFS-1', 'IFS-2'], incident_status: 'Resolved'} }
      it 'responds to status_update_events' do
        events_message = nil
        expect { events_message = api_http_client.status_update_events(status_update_params) }.not_to raise_error
        expect(events_message.message).to match(/10 events updated/)
      end
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
xcal-parktronic-1.3.0 spec/lib/xcal/parktronic/routes/events_route_spec.rb