fixed a hash bug
This commit is contained in:
parent
3f908acce5
commit
b37f6a326b
|
@ -213,10 +213,9 @@ module CouchRest
|
||||||
myfield = fields
|
myfield = fields
|
||||||
while farray.length > 1
|
while farray.length > 1
|
||||||
front = farray.shift
|
front = farray.shift
|
||||||
myfield[front] = {}
|
myfield[front] ||= {}
|
||||||
myfield = myfield[front]
|
myfield = myfield[front]
|
||||||
end
|
end
|
||||||
# todo: json
|
|
||||||
fname, fext = farray.shift.split('.')
|
fname, fext = farray.shift.split('.')
|
||||||
fguts = File.open(file).read
|
fguts = File.open(file).read
|
||||||
if fext == 'json'
|
if fext == 'json'
|
||||||
|
@ -227,7 +226,6 @@ module CouchRest
|
||||||
end
|
end
|
||||||
if File.exists?("#{appdir}/doc.json")
|
if File.exists?("#{appdir}/doc.json")
|
||||||
default_json = JSON.parse(File.open("#{appdir}/doc.json").read)
|
default_json = JSON.parse(File.open("#{appdir}/doc.json").read)
|
||||||
|
|
||||||
end
|
end
|
||||||
design = @db.get(docid) rescue {}
|
design = @db.get(docid) rescue {}
|
||||||
design.merge!(fields)
|
design.merge!(fields)
|
||||||
|
|
|
@ -82,10 +82,15 @@ describe CouchRest::FileManager, "pushing an app" do
|
||||||
doc = @db.get("_design/couchapp")
|
doc = @db.get("_design/couchapp")
|
||||||
doc['_attachments']['index.html']["content_type"].should == 'text/html'
|
doc['_attachments']['index.html']["content_type"].should == 'text/html'
|
||||||
end
|
end
|
||||||
it "should push bar.txt" do
|
it "should push bar.txt and pals" do
|
||||||
|
File.open("#{@appdir}/foo/test.json",'w') do |f|
|
||||||
|
f.write("[1,2,3,4]")
|
||||||
|
end
|
||||||
|
r = @fm.push_app(@appdir, "couchapp")
|
||||||
doc = @db.get("_design/couchapp")
|
doc = @db.get("_design/couchapp")
|
||||||
doc["foo"].should_not be_nil
|
doc["foo"].should_not be_nil
|
||||||
doc["foo"]["bar"].should include("Couchapp will")
|
doc["foo"]["bar"].should include("Couchapp will")
|
||||||
|
doc["foo"]["test"].should == [1,2,3,4]
|
||||||
end
|
end
|
||||||
it "should push json as json" do
|
it "should push json as json" do
|
||||||
File.open("#{@appdir}/test.json",'w') do |f|
|
File.open("#{@appdir}/test.json",'w') do |f|
|
||||||
|
|
Loading…
Reference in a new issue