diff --git a/lib/couchrest/model/design_doc.rb b/lib/couchrest/model/design_doc.rb index 94ad6c2..edcb043 100644 --- a/lib/couchrest/model/design_doc.rb +++ b/lib/couchrest/model/design_doc.rb @@ -18,8 +18,8 @@ module CouchRest self.to_s end - def design_doc_full_url(db = database) - "#{db.uri}/#{design_doc_id}" + def design_doc_uri(db = database) + "#{db.root}/#{design_doc_id}" end # Retreive the latest version of the design document directly @@ -54,10 +54,10 @@ module CouchRest Thread.current[:couchrest_design_cache] ||= {} end def design_doc_cache_checksum(db) - design_doc_cache[design_doc_full_url(db)] + design_doc_cache[design_doc_uri(db)] end def set_design_doc_cache_checksum(db, checksum) - design_doc_cache[design_doc_full_url(db)] = checksum + design_doc_cache[design_doc_uri(db)] = checksum end # Writes out a design_doc to a given database if forced diff --git a/spec/couchrest/design_doc_spec.rb b/spec/couchrest/design_doc_spec.rb index 6673d4d..1602342 100644 --- a/spec/couchrest/design_doc_spec.rb +++ b/spec/couchrest/design_doc_spec.rb @@ -50,14 +50,14 @@ describe "Design Documents" do end end - describe ".design_doc_full_url" do + describe ".design_doc_uri" do it "should provide complete url" do - Article.design_doc_full_url.should eql("#{DB.uri}/_design/Article") + Article.design_doc_uri.should eql("#{COUCHHOST}/#{TESTDB}/_design/Article") end it "should provide complete url for new DB" do db = mock("Database") - db.should_receive(:uri).and_return('db') - Article.design_doc_full_url(db).should eql("db/_design/Article") + db.should_receive(:root).and_return('db') + Article.design_doc_uri(db).should eql("db/_design/Article") end end