Skip to content

Commit

Permalink
Added uuid spec.
Browse files Browse the repository at this point in the history
  • Loading branch information
paulcarey committed May 4, 2010
1 parent d06daac commit 304776b
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions spec/uuid_generator_spec.rb
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,34 @@
require File.dirname(__FILE__) + '/spec_helper.rb'
require File.dirname(__FILE__) + '/spec_models.rb'

describe RelaxDB::UuidGenerator do

before(:all) do
setup_test_db
@ug = RelaxDB::UuidGenerator
end

before(:each) do
@ug.reset
end

it "should retrieve UUIDs from CouchDB" do
RelaxDB.db.reset_req_count
@ug.uuid
RelaxDB.db.get_count.should == 1
end

it "should retrieve count number of UUIDs" do
RelaxDB.db.reset_req_count
@ug.count = 1
3.times { @ug.uuid }
RelaxDB.db.get_count.should == 3
end

it "should retrieve n UUIDs from CouchDB in a single request" do
RelaxDB.db.reset_req_count
100.times { @ug.uuid }
RelaxDB.db.get_count.should == 1
end

end

0 comments on commit 304776b

Please sign in to comment.