Sha256: 600c9de265bfae3d9a4f0b83f04e6a4179fd5c5ff424f2e82f12def5577944d7

Contents?: true

Size: 1.02 KB

Versions: 3

Compression:

Stored size: 1.02 KB

Contents

require "spec_helper"

describe Fog::Core::Utils do
  describe "prepare_service_settings" do
    it "changes String keys to be Symbols" do
      settings = { "a" => 3 }
      expected = { :a => 3 }
      assert_equal expected, Fog::Core::Utils.prepare_service_settings(settings)
    end

    it "leaves Symbol keys unchanged" do
      settings = { :something => 2 }
      expected = { :something => 2 }
      assert_equal expected, Fog::Core::Utils.prepare_service_settings(settings)
    end

    it "changes nested String keys to Symbols" do
      settings = { "connection_options" => { "val" => 5 } }
      expected = { :connection_options => { :val => 5 } }
      assert_equal expected, Fog::Core::Utils.prepare_service_settings(settings)
    end

    it "does not change the :header key or contents" do
      settings = { :headers => { 'User-Agent' => "my user agent" } }
      expected = { :headers => { 'User-Agent' => "my user agent" } }
      assert_equal expected, Fog::Core::Utils.prepare_service_settings(settings)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fog-core-1.24.0 spec/utils_spec.rb
fog-core-1.23.0 spec/utils_spec.rb
fog-core-1.22.0 spec/utils_spec.rb