Sha256: a9d6323061e7baacb4feb6e04437216a2c2fa79d1bacd3fa7e2c7bf8a12d336e

Contents?: true

Size: 1.44 KB

Versions: 4

Compression:

Stored size: 1.44 KB

Contents

require 'spec_helper'

module GoTransverseTractApi

  RSpec.describe Usage::UsageEvent do
    before(:each) { http_auth }

    let(:response) { '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' }
    let(:event) {
      {
        :start_time => '20151125T10:10:10',
        :service_resource_id => 'Remax',
        :usage_uom => 'EVENT',
        :usage_amount => '1200.00',
        :description => 'Testing',
        :service_resource_type => 'GENERICSVC'
      }
    }

    context ".create_usage_event" do
      it "creates a usage event" do
        elem = { :number01 => '90' }

        data = event.delete_if do|k,v|
          k.to_s == 'description'
        end

        #described_class.create_usage_event(data.merge!(elem))

        allow(subject).to receive(:create_usage_event).with(data).and_return(response)
        expect(subject.create_usage_event(data)).to eq(response)
      end
    end

    context ".void_event" do
      it "voids a single usage event" do
        data = { eid: '3166788' }

        allow(subject).to receive(:void_event).with(data).and_return(response)
        expect(subject.void_event(data)).to eq(response)
      end
    end
   
    context ".bulk" do
      it "creates multiple usage events in bulk" do
        events = []

        (0..2).each{ |i| events[i] = event }

        allow(subject).to receive(:bulk).with(events).and_return(response)
        expect(subject.bulk(events)).to eq(response)
      end
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
gotransverse-tract-api-0.4.3 spec/gotransverse-tract-api/usage/usage_event_spec.rb
gotransverse-tract-api-0.4.2 spec/gotransverse-tract-api/usage/usage_event_spec.rb
gotransverse-tract-api-0.4.1 spec/gotransverse-tract-api/usage/usage_event_spec.rb
gotransverse-tract-api-0.4.0 spec/gotransverse-tract-api/usage/usage_event_spec.rb