Sha256: 1076e807550c3b55d283752e79c2939c0807b5da92e2ae412980e14d52a1e29a

Contents?: true

Size: 1.59 KB

Versions: 46

Compression:

Stored size: 1.59 KB

Contents

require 'spec_helper'

module GoTransverseTractApi

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

    let(:response) { {a: 'b', c: 'd'} }
    let(:event) {
      {
        start_time: '2015-11-25T10:10:10',
        service_resource_id: 'quote6',
        usage_uom: 'COUNT',
        usage_amount: '1200.00',
        description: 'Testing',
        service_resource_type: 'GENERICSRVCRESOURCE'
      }
    }

    context ".simulate" do
      it "simulates a usage event" do
        elem = { number01: '100', text01: 'PC_FC' }

        data = event.merge!(elem)

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

    context ".create_usage_event" do
      it "creates a usage event" do
        elem = { number01: '90', text01: 'PC_FC' }
        data = event.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

46 entries across 46 versions & 1 rubygems

Version Path
gotransverse-tract-api-0.6.5 spec/gotransverse-tract-api/usage/usage_event_spec.rb
gotransverse-tract-api-0.6.4 spec/gotransverse-tract-api/usage/usage_event_spec.rb
gotransverse-tract-api-0.6.3 spec/gotransverse-tract-api/usage/usage_event_spec.rb
gotransverse-tract-api-0.6.2 spec/gotransverse-tract-api/usage/usage_event_spec.rb
gotransverse-tract-api-0.6.1 spec/gotransverse-tract-api/usage/usage_event_spec.rb
gotransverse-tract-api-0.6.0 spec/gotransverse-tract-api/usage/usage_event_spec.rb