Sha256: 6a6eac622ed440ee528d23d463cd6eb52367910f690d776642625ec63e415b9a

Contents?: true

Size: 1.02 KB

Versions: 46

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

46 entries across 43 versions & 3 rubygems

Version Path
fog-core-2.3.0 spec/utils_spec.rb
fog-core-2.2.4 spec/utils_spec.rb
fog-core-2.2.3 spec/utils_spec.rb
fog-core-2.2.2 spec/utils_spec.rb
fog-core-2.2.1 spec/utils_spec.rb
fog-core-2.2.0 spec/utils_spec.rb
fog-core-2.1.2 spec/utils_spec.rb
fog-core-2.1.1 spec/utils_spec.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/fog-core-1.45.0/spec/utils_spec.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-core-1.45.0/spec/utils_spec.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-core-2.1.0/spec/utils_spec.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/fog-core-1.45.0/spec/utils_spec.rb
fog-core-2.1.0 spec/utils_spec.rb
fog-core-2.0.0 spec/utils_spec.rb
fog-core-1.45.0 spec/utils_spec.rb
fog-core-1.44.3 spec/utils_spec.rb
fog-core-1.44.2 spec/utils_spec.rb
fog-core-1.44.1 spec/utils_spec.rb
fog-core-1.44.0 spec/utils_spec.rb
fog-core-1.43.0 spec/utils_spec.rb