Permalink
Browse files

Added uuid spec.

  • Loading branch information...
paulcarey committed May 4, 2010
1 parent d06daac commit 304776b07e0e5ff62d346d02f7f83ea3c1b6dd8a
Showing with 34 additions and 0 deletions.
  1. +34 −0 spec/uuid_generator_spec.rb
@@ -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.