view blocks flow
This commit is contained in:
parent
54a0afdf8e
commit
254eb20161
11 changed files with 124 additions and 28 deletions
23
spec/couchrest/helpers/streamer_spec.rb
Normal file
23
spec/couchrest/helpers/streamer_spec.rb
Normal file
|
@ -0,0 +1,23 @@
|
|||
require File.dirname(__FILE__) + '/../../spec_helper'
|
||||
|
||||
describe CouchRest::Streamer do
|
||||
before(:all) do
|
||||
@cr = CouchRest.new(COUCHHOST)
|
||||
@db = @cr.database(TESTDB)
|
||||
@db.delete! rescue nil
|
||||
@db = @cr.create_db(TESTDB) rescue nil
|
||||
@streamer = CouchRest::Streamer.new(@db)
|
||||
@docs = (1..1000).collect{|i| {:integer => i, :string => i.to_s}}
|
||||
@db.bulk_save(@docs)
|
||||
end
|
||||
|
||||
it "should yield each row in a view" do
|
||||
count = 0
|
||||
sum = 0
|
||||
@streamer.view("_all_docs") do |row|
|
||||
count += 1
|
||||
end
|
||||
count.should == 1001
|
||||
end
|
||||
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue