Sha256: 19e47f14ee9c5dad0d5cd6c5af603a5606c96f5e00062310b2b1f3524b6c6820

Contents?: true

Size: 1.16 KB

Versions: 6

Compression:

Stored size: 1.16 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 'remote commands routes' do

    it 'is not allowed without access_token' do
      expect{ api_invalid_client.get_paged_command_notifications(page: 1, per_page: 5) }.not_to raise_error
      expect{ api_invalid_client.update_command_notification(1) }.not_to raise_error
    end

    context 'getting' do
      it 'responds with the correct set of remote commands' do
        command_notifications = api_http_client.get_paged_command_notifications(page: 1, per_page: 5)

        expect(command_notifications.first.command_id.to_s).to eql('1')
        expect(command_notifications.last.command_id.to_s).to eql('5')
      end
    end

    context 'setting' do
      it 'should update command notification by id' do
        expect{ api_http_client.update_command_notification() }.to raise_error
        expect{ api_http_client.update_command_notification(1) }.not_to raise_error
      end
    end

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
xcal-parktronic-1.3.0 spec/lib/xcal/parktronic/routes/command_notifications_routes_spec.rb
xcal-parktronic-1.2.0 spec/lib/xcal/parktronic/routes/command_notifications_routes_spec.rb
xcal-parktronic-1.1.1 spec/lib/xcal/parktronic/routes/command_notifications_routes_spec.rb
xcal-parktronic-1.0.2 spec/lib/xcal/parktronic/routes/command_notifications_routes_spec.rb
xcal-parktronic-1.0.1 spec/lib/xcal/parktronic/routes/command_notifications_routes_spec.rb
xcal-parktronic-1.0.0 spec/lib/xcal/parktronic/routes/command_notifications_routes_spec.rb