File: whitelist_keys_spec.rb

package info (click to toggle)
ruby-fog-core 2.3.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 676 kB
  • sloc: ruby: 4,719; makefile: 5
file content (36 lines) | stat: -rw-r--r-- 939 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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