Sha256: 2f4898f50309eb9f3804bdae03ba89e795aed58a04df364946205d884157c1a2

Contents?: true

Size: 437 Bytes

Versions: 5

Compression:

Stored size: 437 Bytes

Contents

require "spec_helper"

describe InputSanitizer::RestrictedHash do
  let(:hash) { InputSanitizer::RestrictedHash.new([:a, :b]) }
  subject { hash }

  it "does not allow bad keys" do
    lambda{hash[:c]}.should raise_error(InputSanitizer::KeyNotAllowedError)
  end

  it "does allow correct keys" do
    hash[:a].should be_nil
  end

  it "returns value for correct key" do
    hash[:a] = 'stuff'
    hash[:a].should == 'stuff'
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
input_sanitizer-0.2.2 spec/restricted_hash_spec.rb
input_sanitizer-0.2.0 spec/restricted_hash_spec.rb
input_sanitizer-0.1.10 spec/restricted_hash_spec.rb
input_sanitizer-0.1.9 spec/restricted_hash_spec.rb
input_sanitizer-0.1.8 spec/restricted_hash_spec.rb