Sha256: 61bb642282f0c86c1b9a6b5e05d5175930b20e909ac9fa209acd0fa0abaa60e0

Contents?: true

Size: 967 Bytes

Versions: 10

Compression:

Stored size: 967 Bytes

Contents

require "spec_helper"

describe Object do

  describe "blank?" do
    it "returns true for Objects perceived to be blank" do
      ["", false, nil, [], {}].each do |object|
        object.should be_blank
      end
    end

    it "returns false for every other Object" do
      ["!blank", true, [:a], {:a => "b"}].each do |object|
        object.should_not be_blank
      end
    end
  end

  describe "to_soap_key" do
    it "calls to_s for every Object" do
      Object.to_soap_key.should == Object.to_s
    end
  end

  describe "to_soap_value" do
    it "returns an xs:dateTime compliant String for Objects responding to to_datetime" do
      singleton = Object.new
      def singleton.to_datetime
        DateTime.new(2012, 03, 22, 16, 22, 33)
      end

      singleton.to_soap_value.should == "2012-03-22T16:22:33Z"
    end

    it "calls to_s unless the Object responds to to_datetime" do
      "value".to_soap_value.should == "value".to_s
    end
  end

end

Version data entries

10 entries across 10 versions & 3 rubygems

Version Path
johnreitano-savon-0.7.7.5 spec/savon/core_ext/object_spec.rb
johnreitano-savon-0.7.7.4 spec/savon/core_ext/object_spec.rb
johnreitano-savon-0.7.7.3 spec/savon/core_ext/object_spec.rb
johnreitano-savon-0.7.7.2 spec/savon/core_ext/object_spec.rb
johnreitano-savon-0.7.7.1 spec/savon/core_ext/object_spec.rb
hoopla-savon-0.7.6 spec/savon/core_ext/object_spec.rb
savon-0.7.6 spec/savon/core_ext/object_spec.rb
savon-0.7.5 spec/savon/core_ext/object_spec.rb
savon-0.7.4 spec/savon/core_ext/object_spec.rb
savon-0.7.3 spec/savon/core_ext/object_spec.rb