Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added uuid spec.

  • Loading branch information...
commit 304776b07e0e5ff62d346d02f7f83ea3c1b6dd8a 1 parent d06daac
@paulcarey authored
Showing with 34 additions and 0 deletions.
  1. +34 −0 spec/uuid_generator_spec.rb
View
34 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
Please sign in to comment.
Something went wrong with that request. Please try again.