Commit 3d2758f

mo khan <mo@mokhan.ca>
2013-07-21 00:24:17
test each on result set
1 parent 641284b
Changed files (2)
spec/unit/result_set_spec.rb
@@ -6,15 +6,24 @@ describe Humble::ResultSet do
   let(:rows) { [{:id => 1}, {id: 2}] }
 
   before :each do
-    mapper.stub(:map_from).with({:id => 1}).and_return("1")
-    mapper.stub(:map_from).with({:id => 2}).and_return("2")
+    mapper.stub(:map_from).with({:id => 1}).and_return(1)
+    mapper.stub(:map_from).with({:id => 2}).and_return(2)
   end
 
   describe :inspect do
     let(:result) { sut.inspect }
 
     it "should display each row" do
-      result.should == "[\"1\", \"2\"]"
+      result.should == "[1, 2]"
+    end
+  end
+
+  describe :each do
+    it "should visit each mapped item" do
+      collect = []
+      sut.each { |item| collect << item }
+      collect.first.should == 1
+      collect.last.should == 2
     end
   end
 end
Gemfile.lock
@@ -1,7 +1,7 @@
 PATH
   remote: .
   specs:
-    humble (0.0.1374366097)
+    humble (0.0.1374366237)
       sequel
 
 GEM