Sha256: df0d9941ed4914652a0410675e8cf87677b971e8e51a1a829cd2f9ccbac81ac7

Contents?: true

Size: 927 Bytes

Versions: 1

Compression:

Stored size: 927 Bytes

Contents

require "spec_helper"

describe "Fog::WhitelistKeys" do
  describe ".whitelist" do
    describe "when other keys are present" do
      it "returns Hash with only allowed keys" do
        input = { name: "name", type: "type", size: 80 }
        valid_keys = %w(name size)

        output = Fog::WhitelistKeys.whitelist(input, valid_keys)

        expected = { "name" => "name", "size" => 80 }
        assert_equal(expected, output)
      end
    end

    describe "when key is a Symbol" do
      it "returns a String" do
        input = { name: "name" }
        valid_keys = %w(name)

        output = Fog::WhitelistKeys.whitelist(input, valid_keys)

        expected = { "name" => "name" }
        assert(expected, output)
      end
    end

    describe "when Hash is empty" do
      it "returns empty Hash" do
        output = Fog::WhitelistKeys.whitelist({}, [])
        assert_equal({}, output)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fog-core-2.4.0 spec/core/whitelist_keys_spec.rb