Sha256: 0ee1a4c36da1adbc7504e6d5072126adc097a36fcd89d643b201bf31fec25707

Contents?: true

Size: 913 Bytes

Versions: 6

Compression:

Stored size: 913 Bytes

Contents

require "spec_helper"

shared_examples "a ResponseEnvelope" do
  let(:response) do
    described_class.from_json(
      {
        :responseEnvelope => {
          :ack           => "Success",
          :build         => "123456",
          :timestamp     => "2011-09-21T00:00:00+00:00",
          :correlationId => "1234"
        }
      }.to_json
    )
  end

  it "maps ['responseEnvelope']['ack'] to #ack_code" do # 
    response.ack_code.should == "Success"
  end

  it "maps ['responseEnvelope']['build'] to #build" do
    response.build.should == "123456"
  end

  it "maps ['responseEnvelope']['timestamp'] to #time" do
    response.time.should == DateTime.new(2011, 9, 21)
  end

  it "maps ['responseEnvelope']['correlationId'] to #correlation_id" do
    response.correlation_id.should == "1234"
  end

  it "provides predicate methods for the ack code" do
    response.success?.should be_true
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
pp-adaptive-1.0.0 spec/shared/a_response_envelope.rb
pp-adaptive-0.0.6 spec/shared/a_response_envelope.rb
pp-adaptive-0.0.5 spec/shared/a_response_envelope.rb
pp-adaptive-0.0.4 spec/shared/a_response_envelope.rb
pp-adaptive-0.0.3 spec/shared/a_response_envelope.rb
pp-adaptive-0.0.2 spec/shared/a_response_envelope.rb