fixed all the specs so we are back to green
This commit is contained in:
parent
2d52225a25
commit
e48a6c8866
8 changed files with 36 additions and 18 deletions
|
@ -142,8 +142,14 @@ module CouchRest
|
|||
bulk_save
|
||||
end
|
||||
result = if doc['_id']
|
||||
slug = escape_docid(doc['_id'])
|
||||
CouchRest.put "#{@uri}/#{slug}", doc
|
||||
slug = escape_docid(doc['_id'])
|
||||
begin
|
||||
CouchRest.put "#{@uri}/#{slug}", doc
|
||||
rescue RestClient::ResourceNotFound
|
||||
p "resource not found when saving even tho an id was passed"
|
||||
slug = doc['_id'] = @server.next_uuid
|
||||
CouchRest.put "#{@uri}/#{slug}", doc
|
||||
end
|
||||
else
|
||||
begin
|
||||
slug = doc['_id'] = @server.next_uuid
|
||||
|
|
|
@ -67,9 +67,13 @@ module CouchRest
|
|||
private
|
||||
|
||||
def reset_design_doc
|
||||
design_doc['_id'] = design_doc_id
|
||||
design_doc.delete('_rev')
|
||||
#design_doc.database = nil
|
||||
current = self.database.get(design_doc_id) rescue nil
|
||||
design_doc['_id'] = design_doc_id
|
||||
if current.nil?
|
||||
design_doc.delete('_rev')
|
||||
else
|
||||
design_doc['_rev'] = current['_rev']
|
||||
end
|
||||
self.design_doc_fresh = true
|
||||
end
|
||||
|
||||
|
|
|
@ -92,7 +92,6 @@ module RestClient
|
|||
# establish_connection(uri)
|
||||
# http = Thread.current[:connection]
|
||||
# require 'ruby-debug'
|
||||
# debugger
|
||||
# req.body_stream = nil
|
||||
#
|
||||
# res = http.request(req, payload)
|
||||
|
|
|
@ -10,11 +10,11 @@ module CouchRest
|
|||
|
||||
def initialize(keys={})
|
||||
raise StandardError unless self.is_a? Hash
|
||||
apply_defaults # defined in CouchRest::Mixins::Properties
|
||||
super()
|
||||
keys.each do |k,v|
|
||||
self[k.to_s] = v
|
||||
end if keys
|
||||
apply_defaults # defined in CouchRest::Mixins::Properties
|
||||
cast_keys # defined in CouchRest::Mixins::Properties
|
||||
end
|
||||
|
||||
|
|
|
@ -16,8 +16,6 @@ module CouchRest
|
|||
# # This feature is still not fully ported over,
|
||||
# # test are lacking, so please use with caution
|
||||
# def auto_validate!
|
||||
# require 'ruby-debug'
|
||||
# debugger
|
||||
# auto_validation = true
|
||||
# end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue