Sha256: 4073a5df9a00b71bef5fec3e20cf1dd1dde0c451e720a244d15053219a7859a2

Contents?: true

Size: 922 Bytes

Versions: 1

Compression:

Stored size: 922 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
require 'builder'

describe "Response" do
  before(:each) do
    @xml = <<EOXML
<?xml version="1.0" encoding="utf-8"?>
<SmsReturn xmlns="http://ws.cdyne.com/SmsWS/">
  <StatusCode>1</StatusCode>
  <StatusText>Success</StatusText>
  <Completed>1</Completed>
  <TextID>12345678</TextID>
  <Demo>0</Demo>
  <ScheduledTime></ScheduledTime>
  <Responded>0</Responded>
</SmsReturn>
EOXML
  end
  
  after(:each) do
    @xml = ''
  end

  it "should convert an xml response body into a hash" do
    @response_hash = {
      "sms_return" => {
        :status_code=>"1",
        :status_text=>"Success",
        :completed=>"1",
        :text_id=>"12345678",
        :demo=>"0",
        :scheduled_time=>nil,
        :responded=>"0",
        :xmlns=>"http://ws.cdyne.com/SmsWS/"
      }
    }
    SmsNotify::Response.parse(@xml).should == @response_hash
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cdyne-sms-notify-0.8.1 spec/response_spec.rb