hit a snag with rest-client and query params
This commit is contained in:
parent
420168be70
commit
e7ea12f2ae
|
@ -32,6 +32,11 @@ class CouchRest
|
|||
end
|
||||
end
|
||||
|
||||
def delete doc
|
||||
slug = CGI.escape(doc['_id'])
|
||||
CouchRest.delete "#{@root}/#{slug}?rev=#{doc['_rev']}"
|
||||
end
|
||||
|
||||
def delete!
|
||||
CouchRest.delete @root
|
||||
end
|
||||
|
|
|
@ -69,6 +69,20 @@ describe CouchRest::Database do
|
|||
end
|
||||
end
|
||||
|
||||
describe "DELETE existing document" do
|
||||
before(:each) do
|
||||
@r = @db.save({'lemons' => 'from texas', 'and' => 'spain'})
|
||||
@docid = "http://example.com/stuff.cgi?things=and%20stuff"
|
||||
@db.save({'_id' => @docid, 'will-exist' => 'here'})
|
||||
end
|
||||
it "should work" do
|
||||
doc = @db.get(@r['id'])
|
||||
doc['and'].should == 'spain'
|
||||
@db.delete doc
|
||||
lambda{@db.get @r['id']}.should raise_error
|
||||
end
|
||||
end
|
||||
|
||||
it "should list documents" do
|
||||
5.times do
|
||||
@db.save({'another' => 'doc', 'will-exist' => 'anywhere'})
|
||||
|
@ -98,4 +112,5 @@ describe CouchRest::Database do
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
Loading…
Reference in a new issue