fixed ddoc names on get
This commit is contained in:
parent
9c13b003b3
commit
d1f8970c84
3 changed files with 12 additions and 6 deletions
|
@ -75,7 +75,7 @@ module CouchRest
|
|||
|
||||
# GET a document from CouchDB, by id. Returns a Ruby Hash.
|
||||
def get id
|
||||
slug = CGI.escape(id)
|
||||
slug = /^_design\/(.*)/ =~ id ? "_design/#{CGI.escape($1)}" : CGI.escape(id)
|
||||
hash = CouchRest.get("#{@root}/#{slug}")
|
||||
doc = if /^_design/ =~ hash["_id"]
|
||||
Design.new(hash)
|
||||
|
@ -213,6 +213,10 @@ module CouchRest
|
|||
|
||||
private
|
||||
|
||||
def escape_docid id
|
||||
|
||||
end
|
||||
|
||||
def encode_attachments attachments
|
||||
attachments.each do |k,v|
|
||||
next if v['stub']
|
||||
|
|
|
@ -74,7 +74,7 @@ describe CouchRest::Design do
|
|||
@des = @db.get "_design/test"
|
||||
end
|
||||
it "should be a Design" do
|
||||
@des.should be_an_instance_of CouchRest::Design
|
||||
@des.should be_an_instance_of(CouchRest::Design)
|
||||
end
|
||||
it "should have a modifiable name" do
|
||||
@des.name.should == "test"
|
||||
|
|
|
@ -3,11 +3,13 @@ require "spec" # Satisfies Autotest and anyone else not using the Rake tasks
|
|||
|
||||
require File.dirname(__FILE__) + '/../lib/couchrest'
|
||||
|
||||
FIXTURE_PATH = File.dirname(__FILE__) + '/fixtures'
|
||||
SCRATCH_PATH = File.dirname(__FILE__) + '/tmp'
|
||||
unless defined?(FIXTURE_PATH)
|
||||
FIXTURE_PATH = File.dirname(__FILE__) + '/fixtures'
|
||||
SCRATCH_PATH = File.dirname(__FILE__) + '/tmp'
|
||||
|
||||
COUCHHOST = "http://127.0.0.1:5984"
|
||||
TESTDB = 'couchrest-test'
|
||||
COUCHHOST = "http://127.0.0.1:5984"
|
||||
TESTDB = 'couchrest-test'
|
||||
end
|
||||
|
||||
def reset_test_db!
|
||||
cr = CouchRest.new(COUCHHOST)
|
||||
|
|
Loading…
Reference in a new issue