Sha256: b49beab8be8e43ca28b170196d0afb240b5b36286aebf17c52c0125d9e382331

Contents?: true

Size: 1023 Bytes

Versions: 9

Compression:

Stored size: 1023 Bytes

Contents

module Pacto
  module Extensions
    describe HashSubsetOf do
      describe '#subset_of?' do
        context 'when the other hash is the same' do
          it 'should return true' do
            {:a => 'a'}.should be_subset_of({:a => 'a'})
          end
        end

        context 'when the other hash is a subset' do
          it 'should return true' do
            {:a => 'a'}.should be_subset_of({:a => 'a', :b => 'b'})
          end
        end

        context 'when the other hash is not a subset' do
          it 'should return false' do
            {:a => 'a'}.subset_of?({:a => 'b'}).should be_false
          end
        end
      end

      describe '#normalize_keys' do
        it 'should turn keys into downcased strings' do
          {:A => 'a'}.normalize_keys.should == {'a' => 'a'}
          {:a => 'a'}.normalize_keys.should == {'a' => 'a'}
          {'A' => 'a'}.normalize_keys.should == {'a' => 'a'}
          {'a' => 'a'}.normalize_keys.should == {'a' => 'a'}
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
pacto-0.2.5 spec/unit/pacto/extensions_spec.rb
pacto-0.2.4 spec/unit/pacto/extensions_spec.rb
pacto-0.2.3 spec/unit/pacto/extensions_spec.rb
pacto-0.2.2 spec/unit/pacto/extensions_spec.rb
pacto-0.2.1 spec/unit/pacto/extensions_spec.rb
pacto-0.2.0 spec/pacto/extensions_spec.rb
pacto-0.1.1 spec/pacto/extensions_spec.rb
pacto-0.1.0 spec/pacto/extensions_spec.rb
pacto-0.0.1 spec/pacto/extensions_spec.rb