public
Description: Behaviour Driven Development framework for Ruby
Homepage: http://rspec.info
Clone URL: git://github.com/dchelimsky/rspec.git
Click here to lend your support to: rspec and make a donation at www.pledgie.com !
add failing example (pending) for [#501]
dchelimsky (author)
Sun Sep 28 09:34:56 -0700 2008
commit  fa494fc9bddfac0fbd2a89ca202e88d7904df1b7
tree    e16de3406ba6ff434af8ee73e0568911e5e68f1b
parent  114d2d40694f4759a6887db34bc924753b9fecf2
...
4
5
6
7
8
9
10
11
12
13
14
 
 
 
 
15
16
17
18
19
20
21
22
 
 
 
 
 
 
 
 
 
 
 
 
 
23
24
25
 
 
 
 
 
 
26
27
28
29
30
 
 
 
 
31
32
33
34
 
 
 
 
 
 
 
 
 
 
 
 
 
35
36
37
...
4
5
6
 
 
 
 
 
 
 
 
7
8
9
10
11
 
 
 
 
 
 
 
12
13
14
15
16
17
18
19
20
21
22
23
24
25
 
 
26
27
28
29
30
31
32
33
 
 
 
34
35
36
37
38
 
 
 
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
0
@@ -4,34 +4,51 @@ module Spec
0
   module Mocks
0
     module ArgumentConstraints
0
       describe HashIncludingConstraint do
0
-      
0
-        it "should match the same hash" do
0
-          hash_including(:a => 1).should == {:a => 1}
0
-        end
0
-      
0
-        it "should not match a non-hash" do
0
-          hash_including(:a => 1).should_not == 1
0
-        end
0
+        
0
+        it "should describe itself properly" do
0
+          HashIncludingConstraint.new(:a => 1).description.should == "hash_including(:a=>1)"
0
+        end      
0
 
0
-        it "should match a hash with extra stuff" do
0
-          hash_including(:a => 1).should == {:a => 1, :b => 2}
0
-        end
0
-      
0
-        it "should not match a hash with a missing key" do
0
-          hash_including(:a => 1).should_not == {:b => 2}
0
-        end
0
+        describe "passing" do
0
+          it "should match the same hash" do
0
+            hash_including(:a => 1).should == {:a => 1}
0
+          end
0
+
0
+          it "should match a hash with extra stuff" do
0
+            hash_including(:a => 1).should == {:a => 1, :b => 2}
0
+          end
0
+          
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
+            end
0
 
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
+              end
0
+            end
0
+          end
0
         end
0
         
0
-        it "should not match when values are nil but keys are different" do
0
-          hash_including(:a => nil).should_not == {:b => nil}
0
-        end
0
+        describe "failing" do
0
+          it "should not match a non-hash" do
0
+            hash_including(:a => 1).should_not == 1
0
+          end
0
 
0
-        it "should describe itself properly" do
0
-          HashIncludingConstraint.new(:a => 1).description.should == "hash_including(:a=>1)"
0
-        end      
0
+
0
+          it "should not match a hash with a missing key" do
0
+            hash_including(:a => 1).should_not == {:b => 2}
0
+          end
0
+
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
+          end
0
+
0
+          it "should not match when values are nil but keys are different" do
0
+            hash_including(:a => nil).should_not == {:b => nil}
0
+          end
0
+        end
0
       end
0
     end
0
   end

Comments