juozasg-couchrest 0.10.1 → 0.10.13
Sign up to get free protection for your applications and to get access to all the features.
- metadata +6 -101
- data/Rakefile +0 -86
- data/bin/couchapp +0 -58
- data/bin/couchdir +0 -20
- data/bin/couchview +0 -48
- data/examples/model/example.rb +0 -138
- data/examples/word_count/markov +0 -38
- data/examples/word_count/views/books/chunked-map.js +0 -3
- data/examples/word_count/views/books/united-map.js +0 -1
- data/examples/word_count/views/markov/chain-map.js +0 -6
- data/examples/word_count/views/markov/chain-reduce.js +0 -7
- data/examples/word_count/views/word_count/count-map.js +0 -6
- data/examples/word_count/views/word_count/count-reduce.js +0 -3
- data/examples/word_count/word_count.rb +0 -67
- data/examples/word_count/word_count_query.rb +0 -39
- data/lib/couchrest/commands/generate.rb +0 -71
- data/lib/couchrest/commands/push.rb +0 -103
- data/lib/couchrest/core/database.rb +0 -173
- data/lib/couchrest/core/design.rb +0 -89
- data/lib/couchrest/core/document.rb +0 -60
- data/lib/couchrest/core/model.rb +0 -557
- data/lib/couchrest/core/server.rb +0 -51
- data/lib/couchrest/core/view.rb +0 -4
- data/lib/couchrest/helper/file_manager.rb +0 -317
- data/lib/couchrest/helper/pager.rb +0 -103
- data/lib/couchrest/helper/streamer.rb +0 -44
- data/lib/couchrest/helper/templates/bar.txt +0 -11
- data/lib/couchrest/helper/templates/example-map.js +0 -8
- data/lib/couchrest/helper/templates/example-reduce.js +0 -10
- data/lib/couchrest/helper/templates/index.html +0 -26
- data/lib/couchrest/monkeypatches.rb +0 -24
- data/lib/couchrest.rb +0 -125
- data/spec/couchapp_spec.rb +0 -87
- data/spec/couchrest/core/couchrest_spec.rb +0 -191
- data/spec/couchrest/core/database_spec.rb +0 -478
- data/spec/couchrest/core/design_spec.rb +0 -131
- data/spec/couchrest/core/document_spec.rb +0 -96
- data/spec/couchrest/core/model_spec.rb +0 -660
- data/spec/couchrest/helpers/file_manager_spec.rb +0 -203
- data/spec/couchrest/helpers/pager_spec.rb +0 -122
- data/spec/couchrest/helpers/streamer_spec.rb +0 -23
- data/spec/fixtures/attachments/couchdb.png +0 -0
- data/spec/fixtures/attachments/test.html +0 -11
- data/spec/fixtures/views/lib.js +0 -3
- data/spec/fixtures/views/test_view/lib.js +0 -3
- data/spec/fixtures/views/test_view/only-map.js +0 -4
- data/spec/fixtures/views/test_view/test-map.js +0 -3
- data/spec/fixtures/views/test_view/test-reduce.js +0 -3
- data/spec/spec.opts +0 -6
- data/spec/spec_helper.rb +0 -14
- data/utils/remap.rb +0 -27
@@ -1,96 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/../../spec_helper'
|
2
|
-
|
3
|
-
describe CouchRest::Document, "[]=" do
|
4
|
-
before(:each) do
|
5
|
-
@doc = CouchRest::Document.new
|
6
|
-
end
|
7
|
-
it "should work" do
|
8
|
-
@doc["enamel"].should == nil
|
9
|
-
@doc["enamel"] = "Strong"
|
10
|
-
@doc["enamel"].should == "Strong"
|
11
|
-
end
|
12
|
-
it "[]= should convert to string" do
|
13
|
-
@doc["enamel"].should == nil
|
14
|
-
@doc[:enamel] = "Strong"
|
15
|
-
@doc["enamel"].should == "Strong"
|
16
|
-
end
|
17
|
-
it "should read as a string" do
|
18
|
-
@doc[:enamel] = "Strong"
|
19
|
-
@doc[:enamel].should == "Strong"
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
describe CouchRest::Document, "new" do
|
24
|
-
before(:each) do
|
25
|
-
@doc = CouchRest::Document.new("key" => [1,2,3], :more => "values")
|
26
|
-
end
|
27
|
-
it "should create itself from a Hash" do
|
28
|
-
@doc["key"].should == [1,2,3]
|
29
|
-
@doc["more"].should == "values"
|
30
|
-
end
|
31
|
-
it "should not have rev and id" do
|
32
|
-
@doc.rev.should be_nil
|
33
|
-
@doc.id.should be_nil
|
34
|
-
end
|
35
|
-
it "should freak out when saving without a database" do
|
36
|
-
lambda{@doc.save}.should raise_error(ArgumentError)
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
# move to database spec
|
41
|
-
describe CouchRest::Document, "saving using a database" do
|
42
|
-
before(:all) do
|
43
|
-
@doc = CouchRest::Document.new("key" => [1,2,3], :more => "values")
|
44
|
-
@db = reset_test_db!
|
45
|
-
@resp = @db.save(@doc)
|
46
|
-
end
|
47
|
-
it "should apply the database" do
|
48
|
-
@doc.database.should == @db
|
49
|
-
end
|
50
|
-
it "should get id and rev" do
|
51
|
-
@doc.id.should == @resp["id"]
|
52
|
-
@doc.rev.should == @resp["rev"]
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
describe "getting from a database" do
|
57
|
-
before(:all) do
|
58
|
-
@db = reset_test_db!
|
59
|
-
@resp = @db.save({
|
60
|
-
"key" => "value"
|
61
|
-
})
|
62
|
-
@doc = @db.get @resp['id']
|
63
|
-
end
|
64
|
-
it "should return a document" do
|
65
|
-
@doc.should be_an_instance_of(CouchRest::Document)
|
66
|
-
end
|
67
|
-
it "should have a database" do
|
68
|
-
@doc.database.should == @db
|
69
|
-
end
|
70
|
-
it "should be saveable and resavable" do
|
71
|
-
@doc["more"] = "keys"
|
72
|
-
@doc.save
|
73
|
-
@db.get(@resp['id'])["more"].should == "keys"
|
74
|
-
@doc["more"] = "these keys"
|
75
|
-
@doc.save
|
76
|
-
@db.get(@resp['id'])["more"].should == "these keys"
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
describe "destroying a document from a db" do
|
81
|
-
before(:all) do
|
82
|
-
@db = reset_test_db!
|
83
|
-
@resp = @db.save({
|
84
|
-
"key" => "value"
|
85
|
-
})
|
86
|
-
@doc = @db.get @resp['id']
|
87
|
-
end
|
88
|
-
it "should make it disappear" do
|
89
|
-
@doc.destroy
|
90
|
-
lambda{@db.get @resp['id']}.should raise_error
|
91
|
-
end
|
92
|
-
it "should error when there's no db" do
|
93
|
-
@doc = CouchRest::Document.new("key" => [1,2,3], :more => "values")
|
94
|
-
lambda{@doc.destroy}.should raise_error(ArgumentError)
|
95
|
-
end
|
96
|
-
end
|