Fixing URI issue for design docs
This commit is contained in:
parent
5805f6e27b
commit
3764d1cd5c
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue