Sha256: 7b7dcb578beaa0efe5d4c89f6d7a6c03186d18f2ed45bc3d5ee065a27a035cae

Contents?: true

Size: 986 Bytes

Versions: 17

Compression:

Stored size: 986 Bytes

Contents

require 'spec_helper'

describe RSpecCandy do
  describe 'matchers' do
    describe 'include_hash' do

      it 'should match if all pairs in the given hash exist in the receiver' do
        { :foo => 'a', :bar => 'b' , :bam => 'c'}.should include_hash(:foo => 'a', :bam => 'c')
      end

      it 'should not match if the given hash has keys that do not exist in the receiver' do
        { :foo => 'a', :bar => 'b' , :bam => 'c'}.should_not include_hash(:foo => 'a', :baz => 'd')
      end

      it 'should not match if the given hash has values that are different in the receiver' do
        { :foo => 'a', :bar => 'b' , :bam => 'c'}.should_not include_hash(:foo => 'a', :bam => 'different-value')
      end

      it 'should not crash and not match if the receiver is nil' do
        nil.should_not include_hash(:foo => 'a')
      end

      it 'should match if the receiver is empty and the given hash is empty' do
        {}.should include_hash({})
      end

    end
  end

end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
rspec_candy-0.5.1 spec/rspec_candy/matchers/include_hash_spec.rb
rspec_candy-0.5.0 spec/rspec_candy/matchers/include_hash_spec.rb
rspec_candy-0.4.1 spec/rspec_candy/matchers/include_hash_spec.rb
rspec_candy-0.4.0 spec/rspec_candy/matchers/include_hash_spec.rb
rspec_candy-0.3.1 spec/shared/rspec_candy/matchers/include_hash_spec.rb
rspec_candy-0.3.0 spec/shared/rspec_candy/matchers/include_hash_spec.rb
rspec_candy-0.2.10 spec/shared/rspec_candy/matchers/include_hash_spec.rb
rspec_candy-0.2.9 spec/shared/rspec_candy/matchers/include_hash_spec.rb
rspec_candy-0.2.8 spec/shared/rspec_candy/matchers/include_hash_spec.rb
rspec_candy-0.2.7 spec/shared/rspec_candy/matchers/include_hash_spec.rb
rspec_candy-0.2.6 spec/shared/rspec_candy/matchers/include_hash_spec.rb
rspec_candy-0.2.5 spec/shared/rspec_candy/matchers/include_hash_spec.rb
rspec_candy-0.2.4 spec/shared/rspec_candy/matchers/include_hash_spec.rb
rspec_candy-0.2.3 spec/shared/rspec_candy/matchers/include_hash_spec.rb
rspec_candy-0.2.2 spec/shared/rspec_candy/matchers/include_hash_spec.rb
rspec_candy-0.2.1 spec/shared/rspec_candy/matchers/include_hash_spec.rb
rspec_candy-0.2.0 spec/shared/rspec_candy/matchers/include_hash_spec.rb