Sha256: 4b0f51fd00fc32c0b298ac51566600971b99728fb78fb05e7a30ed077786f65e

Contents?: true

Size: 1.38 KB

Versions: 2

Compression:

Stored size: 1.38 KB

Contents

require "spec_helper"

describe String do

  describe "snakecase" do
    it "converts a lowerCamelCase String to snakecase" do
      "lowerCamelCase".snakecase.should == "lower_camel_case"
    end
  end

  describe "lower_camelcase" do
    it "converts a snakecase String to lowerCamelCase" do
      "lower_camel_case".lower_camelcase.should == "lowerCamelCase"
    end
  end

  describe "strip_namespace" do
    it "strips the namespace from a namespaced String" do
      "ns:customer".strip_namespace.should == "customer"
    end

    it "returns the original String for a String without namespace" do
      "customer".strip_namespace.should == "customer"
    end
  end

  describe "map_soap_response" do
    it "returns a DateTime Object for Strings matching the xs:dateTime format" do
      UserFixture.datetime_string.map_soap_response.should ==
        UserFixture.datetime_object
    end

    it "returns true for Strings matching 'true'" do
      "true".map_soap_response.should be_true
    end

    it "returns false for Strings matching 'false'" do
      "false".map_soap_response.should be_false
    end

    it "defaults to return the original value" do
      "whatever".map_soap_response.should == "whatever"
    end
  end

  describe "to_soap_value" do
    it "calls to_s, bypassing Rails to_datetime extension for Strings" do
      "string".to_soap_value.should == "string".to_s
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
savon-0.5.1 spec/savon/core_ext/string_spec.rb
savon-0.5.0 spec/savon/core_ext/string_spec.rb