0
@@ -4,34 +4,51 @@ module Spec
0
module ArgumentConstraints
0
describe HashIncludingConstraint do
0
- it "should match the same hash" do
0
- hash_including(:a => 1).should == {:a => 1}
0
- it "should not match a non-hash" do
0
- hash_including(:a => 1).should_not == 1
0
+ it "should describe itself properly" do
0
+ HashIncludingConstraint.new(:a => 1).description.should == "hash_including(:a=>1)"
0
- it "should match a hash with extra stuff" do
0
- hash_including(:a => 1).should == {:a => 1, :b => 2}
0
- it "should not match a hash with a missing key" do
0
- hash_including(:a => 1).should_not == {:b => 2}
0
+ it "should match the same hash" do
0
+ hash_including(:a => 1).should == {:a => 1}
0
+ it "should match a hash with extra stuff" do
0
+ hash_including(:a => 1).should == {:a => 1, :b => 2}
0
+ describe "when matching against other constraints" do
0
+ it "should match an int against anything()" do
0
+ hash_including(:a => anything, :b => 2).should == {:a => 1, :b => 2}
0
- it "should not match a hash with an incorrect value" do
0
- hash_including(:a => 1, :b => 2).should_not == {:a => 1, :b => 3}
0
+ it "should match a string against anything()" do
0
+ pending("fix to http://rspec.lighthouseapp.com/projects/5645/tickets/501") do
0
+ hash_including(:a => anything, :b => 2).should == {:a => "1", :b => 2}
0
- it "should not match when values are nil but keys are different" do
0
- hash_including(:a => nil).should_not == {:b => nil}
0
+ it "should not match a non-hash" do
0
+ hash_including(:a => 1).should_not == 1
0
- it "should describe itself properly" do
0
- HashIncludingConstraint.new(:a => 1).description.should == "hash_including(:a=>1)"
0
+ it "should not match a hash with a missing key" do
0
+ hash_including(:a => 1).should_not == {:b => 2}
0
+ it "should not match a hash with an incorrect value" do
0
+ hash_including(:a => 1, :b => 2).should_not == {:a => 1, :b => 3}
0
+ it "should not match when values are nil but keys are different" do
0
+ hash_including(:a => nil).should_not == {:b => nil}