Sha256: 7e21f33c25ecaae9d87388c76cb1aaf08afc52bda8a1a5859bb0f2d1ef5da0d5

Contents?: true

Size: 1.1 KB

Versions: 2

Compression:

Stored size: 1.1 KB

Contents

require 'spec_helper'

describe GovDelivery::TMS::CommandTypes do
  context "loading command types" do
    let(:client) do
      double('client')
    end
    before do
      @command_types = GovDelivery::TMS::CommandTypes.new(client, '/command_types')
    end
    it 'should GET ok' do
      body = [{"name"=>"dcm_unsubscribe",
               "string_fields"=>[],
               "array_fields"=>["dcm_account_codes"]},
              {"name"=>"dcm_subscribe",
               "string_fields"=>["dcm_account_code"],
               "array_fields"=>["dcm_topic_codes"]},
              {"name"=>"forward",
               "string_fields"=>["http_method", "username", "password", "url"],
               "array_fields"=>[]}] 
      expect(@command_types.client).to receive(:get).and_return(double('response', body: body, status: 200, headers: {}))
      @command_types.get
      expect(@command_types.collection.length).to eq(3)
      ct = @command_types.collection.find{|c| c.name == "dcm_subscribe"}
      expect(ct.array_fields).to eq(["dcm_topic_codes"])
      expect(ct.string_fields).to eq(["dcm_account_code"])
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
govdelivery-tms-0.8.2 spec/command_types_spec.rb
govdelivery-tms-0.8.1 spec/command_types_spec.rb