Sha256: 16a699a76d82402ff6410c05995b685b43636e4d838bfca5479bd9b9030319de

Contents?: true

Size: 979 Bytes

Versions: 16

Compression:

Stored size: 979 Bytes

Contents

require File.dirname(__FILE__) + '/../../spec_helper.rb'

module Spec
  module Mocks
    describe HashIncludingConstraint do
      
      it "should match the same hash" do
        hash_including(:a => 1).matches?(:a => 1).should be_true
      end
      
      it "should not match a non-hash" do
        hash_including(:a => 1).matches?(1).should_not be_true
      end

      it "should match a hash with extra stuff" do
        hash_including(:a => 1).matches?(:a => 1, :b => 2).should be_true
      end
      
      it "should not match a hash with a missing key" do
        hash_including(:a => 1).matches?(:b => 2).should_not be_true
      end

      it "should not match a hash with an incorrect value" do
        hash_including(:a => 1, :b => 2).matches?(:a => 1, :b => 3).should_not be_true
      end

      it "should describe itself properly" do
        HashIncludingConstraint.new(:a => 1).description.should == "hash_including(:a=>1)"
      end      
    end
 end
end

Version data entries

16 entries across 16 versions & 4 rubygems

Version Path
jnstq-acts_as_sms-0.1.0 test/vendor/plugins/rspec/spec/spec/mocks/hash_including_matcher_spec.rb
jnstq-acts_as_sms-0.1.1 test/vendor/plugins/rspec/spec/spec/mocks/hash_including_matcher_spec.rb
jnstq-acts_as_sms-0.1.3 test/vendor/plugins/rspec/spec/spec/mocks/hash_including_matcher_spec.rb
jnstq-acts_as_sms-0.1.4 test/vendor/plugins/rspec/spec/spec/mocks/hash_including_matcher_spec.rb
radiant-0.6.5.1 vendor/plugins/rspec/spec/spec/mocks/hash_including_matcher_spec.rb
radiant-0.6.5 vendor/plugins/rspec/spec/spec/mocks/hash_including_matcher_spec.rb
radiant-0.6.6 vendor/plugins/rspec/spec/spec/mocks/hash_including_matcher_spec.rb
radiant-0.6.7 vendor/plugins/rspec/spec/spec/mocks/hash_including_matcher_spec.rb
radiant-0.6.9 vendor/plugins/rspec/spec/spec/mocks/hash_including_matcher_spec.rb
radiant-0.6.8 vendor/plugins/rspec/spec/spec/mocks/hash_including_matcher_spec.rb
rspec-0.0.10 spec/spec/mocks/hash_including_matcher_spec.rb
rspec-1.1.4 spec/spec/mocks/hash_including_matcher_spec.rb
spree-0.4.1 vendor/plugins/rspec/spec/spec/mocks/hash_including_matcher_spec.rb
spree-0.4.0 vendor/plugins/rspec/spec/spec/mocks/hash_including_matcher_spec.rb
spree-0.5.0 vendor/plugins/rspec/spec/spec/mocks/hash_including_matcher_spec.rb
spree-0.5.1 vendor/plugins/rspec/spec/spec/mocks/hash_including_matcher_spec.rb