Sha256: b6d515b5ac2d275543d79a8fc5873cab6cd8f745aa9c86b552164a2fb41b9e99

Contents?: true

Size: 1.55 KB

Versions: 9

Compression:

Stored size: 1.55 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

    it "converts period characters to underscores" do
      "User.GetEmail".snakecase.should == "user_get_email"
    end
  end

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

  describe "starts_with?" do
    it "should return whether it starts with a given suffix" do
      "authenticate".starts_with?("auth").should be_true
      "authenticate".starts_with?("cate").should be_false
    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
      "2012-03-22T16:22:33".map_soap_response.should ==
        DateTime.new(2012, 03, 22, 16, 22, 33)
    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

end

Version data entries

9 entries across 9 versions & 3 rubygems

Version Path
search_biomodel-1.0.0 search_biomodel/ruby/1.8/gems/savon-0.9.2/spec/savon/core_ext/string_spec.rb
savon-0.9.2 spec/savon/core_ext/string_spec.rb
s-savon-0.8.6 spec/savon/core_ext/string_spec.rb
savon-0.9.1 spec/savon/core_ext/string_spec.rb
savon-0.9.0 spec/savon/core_ext/string_spec.rb
savon-0.8.6 spec/savon/core_ext/string_spec.rb
savon-0.8.5 spec/savon/core_ext/string_spec.rb
savon-0.8.4 spec/savon/core_ext/string_spec.rb
savon-0.8.3 spec/savon/core_ext/string_spec.rb