leanback 0.2.8 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Changelog.rdoc +12 -0
- data/Gemfile +1 -0
- data/Gemfile.lock +10 -0
- data/README.md +39 -0
- data/VERSION +1 -1
- data/leanback.gemspec +21 -9
- data/lib/leanback.rb +156 -54
- data/spec/admin_party/database_spec.rb +190 -0
- data/spec/no_admin_party/database_spec.rb +268 -0
- data/spec/no_admin_party/non_admin_user_spec.rb +52 -0
- data/spec/spec_base.rb +2 -0
- data/test/main.rb +154 -0
- data/test/test_leanback.rb +63 -19
- metadata +28 -31
- data/README.rdoc +0 -393
@@ -0,0 +1,190 @@
|
|
1
|
+
require 'spec_base.rb'
|
2
|
+
#ain't no party like an admin party
|
3
|
+
|
4
|
+
|
5
|
+
describe "CouchDB admin party " do
|
6
|
+
|
7
|
+
it "should create and delete a database" do
|
8
|
+
hash = Couchdb.create('staff')
|
9
|
+
hash.to_s.should == '{"ok"=>true}'
|
10
|
+
hash = Couchdb.all
|
11
|
+
hash.include?("staff").should == true
|
12
|
+
hash = Couchdb.delete 'staff'
|
13
|
+
hash.include?("staff").should == false
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should create a database add a finder method to it and then delete the database" do
|
17
|
+
Couchdb.create('mobsters')
|
18
|
+
hash = Couchdb.add_finder({:database => 'mobsters', :key => 'email'})
|
19
|
+
hash.include?("_design/email_finder").should == true
|
20
|
+
hash.include?("true").should == true
|
21
|
+
hash.include?("rev").should == true
|
22
|
+
|
23
|
+
doc = {:database => 'mobsters', :doc_id => '_design/email_finder'}
|
24
|
+
hash = Couchdb.view doc
|
25
|
+
hash["_id"].should == '_design/email_finder'
|
26
|
+
Couchdb.delete 'mobsters'
|
27
|
+
end
|
28
|
+
|
29
|
+
it "find items by key" do
|
30
|
+
docs = Couchdb.find_by({:database => 'contacts', :lastname => 'winner'})
|
31
|
+
d = docs[0]
|
32
|
+
d["lastname"].should == "winner"
|
33
|
+
Couchdb.delete_doc({:database => 'contacts', :doc_id => '_design/lastname_finder'})
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should create and view document doc" do
|
37
|
+
data = {:firstname => 'John',
|
38
|
+
:lastname =>'smith',
|
39
|
+
:phone => '202-234-1234',
|
40
|
+
:email =>'james@mail.com',
|
41
|
+
:age =>'34',
|
42
|
+
:gender =>'male'}
|
43
|
+
doc = {:database => 'contacts', :doc_id => 'john', :data => data}
|
44
|
+
Couchdb.create_doc doc
|
45
|
+
|
46
|
+
doc = {:database => 'contacts', :doc_id => 'john'}
|
47
|
+
hash = Couchdb.view doc
|
48
|
+
hash["_id"].should == 'john'
|
49
|
+
end
|
50
|
+
|
51
|
+
it "should query a permanent view that doesn't exist and handle exception" do
|
52
|
+
begin
|
53
|
+
view = { :database => "contacts", :design_doc => 'more_views', :view => 'get_user_email'}
|
54
|
+
Couchdb.find view
|
55
|
+
rescue CouchdbException => e
|
56
|
+
e.to_s.should == "CouchDB: Error - not_found. Reason - deleted"
|
57
|
+
e.error.should == "not_found"
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
it "should query a permanent view and create the view on the fly, if it doesn't already exist" do
|
62
|
+
view = {:database => 'contacts',
|
63
|
+
:design_doc => 'my_views',
|
64
|
+
:view => 'get_emails',
|
65
|
+
:json_doc => '/home/obi/bin/my_views.json'}
|
66
|
+
|
67
|
+
docs = Couchdb.find_on_fly(view)
|
68
|
+
docs[0].include?("Email").should == true
|
69
|
+
docs[0].include?("Name").should == true
|
70
|
+
#verify that the view was created
|
71
|
+
doc = {:database => 'contacts', :doc_id => '_design/my_views'}
|
72
|
+
hash = Couchdb.view doc
|
73
|
+
hash["_id"].should == '_design/my_views'
|
74
|
+
Couchdb.delete_doc({:database => 'contacts', :doc_id => '_design/my_views'})
|
75
|
+
end
|
76
|
+
|
77
|
+
it "should query a permanent view by key and create the view on the fly, if it doesn't already exist" do
|
78
|
+
view = { :database => 'contacts',
|
79
|
+
:design_doc => 'the_view',
|
80
|
+
:view => 'age',
|
81
|
+
:json_doc => '/home/obi/bin/view_age.json'}
|
82
|
+
|
83
|
+
age = '36'
|
84
|
+
docs = Couchdb.find_on_fly(view,"",key = age)
|
85
|
+
docs[0].include?("age").should == true
|
86
|
+
d = docs[0]
|
87
|
+
d["age"].should == '36'
|
88
|
+
#verify that the view was created
|
89
|
+
doc = {:database => 'contacts', :doc_id => '_design/the_view'}
|
90
|
+
hash = Couchdb.view doc
|
91
|
+
hash["_id"].should == '_design/the_view'
|
92
|
+
Couchdb.delete_doc({:database => 'contacts', :doc_id => '_design/the_view'})
|
93
|
+
end
|
94
|
+
|
95
|
+
it "should create a design doc/permanent view and query it" do
|
96
|
+
doc = { :database => 'contacts', :design_doc => 'more_views', :json_doc => '/home/obi/bin/leanback/test/my_views.json' }
|
97
|
+
hash = Couchdb.create_design doc
|
98
|
+
hash["id"].should == '_design/more_views'
|
99
|
+
hash["ok"].should == true
|
100
|
+
|
101
|
+
view = { :database => "contacts", :design_doc => 'more_views', :view => 'get_email'}
|
102
|
+
hash = Couchdb.find view
|
103
|
+
hash[0].has_key?("Firstname").should == true
|
104
|
+
hash[0].has_key?("Lastname").should == true
|
105
|
+
hash[0].has_key?("Email").should == true
|
106
|
+
|
107
|
+
doc = {:database => 'contacts', :doc_id => '_design/more_views'}
|
108
|
+
hash = Couchdb.view doc
|
109
|
+
hash["_id"].should == '_design/more_views'
|
110
|
+
Couchdb.delete_doc({:database => 'contacts', :doc_id => '_design/more_views'})
|
111
|
+
end
|
112
|
+
|
113
|
+
it "should return a list of all databases in the system" do
|
114
|
+
databases = Couchdb.all
|
115
|
+
databases.include?("contacts").should == true
|
116
|
+
end
|
117
|
+
|
118
|
+
it "should create a document" do
|
119
|
+
data = {:firstname => 'Nancy', :lastname =>'Lee', :phone => '347-808-3734',:email =>'nancy@mail.com',:gender => 'female'}
|
120
|
+
doc = {:database => 'contacts', :doc_id => 'Nancy', :data => data}
|
121
|
+
hash = Couchdb.create_doc doc
|
122
|
+
hash["id"].should == 'Nancy'
|
123
|
+
hash["ok"].should == true
|
124
|
+
|
125
|
+
doc = {:database => 'contacts', :doc_id => 'Nancy'}
|
126
|
+
hash = Couchdb.view doc
|
127
|
+
hash["_id"].should == 'Nancy'
|
128
|
+
hash["firstname"].should == 'Nancy'
|
129
|
+
hash["lastname"].should == 'Lee'
|
130
|
+
hash["phone"].should == '347-808-3734'
|
131
|
+
Couchdb.delete_doc({:database => 'contacts', :doc_id => 'Nancy'})
|
132
|
+
end
|
133
|
+
|
134
|
+
it "should update the document" do
|
135
|
+
data = {:age => "41", :lastname => "Stevens" }
|
136
|
+
doc = { :database => 'contacts', :doc_id => 'john', :data => data}
|
137
|
+
hash = Couchdb.update_doc doc
|
138
|
+
hash["id"].should == 'john'
|
139
|
+
hash["ok"].should == true
|
140
|
+
|
141
|
+
doc = {:database => 'contacts', :doc_id => 'john'}
|
142
|
+
hash = Couchdb.view doc
|
143
|
+
hash["_id"].should == 'john'
|
144
|
+
hash["age"].should == '41'
|
145
|
+
hash["lastname"].should == 'Stevens'
|
146
|
+
Couchdb.delete_doc({:database => 'contacts', :doc_id => 'john'})
|
147
|
+
end
|
148
|
+
|
149
|
+
|
150
|
+
it "should delete a document after creating it" do
|
151
|
+
data = {:firstname => 'Sun',
|
152
|
+
:lastname =>'Nova',
|
153
|
+
:phone => '212-234-1234',
|
154
|
+
:email =>'james@mail.com'}
|
155
|
+
|
156
|
+
doc = {:database => 'contacts', :doc_id => 'Sun', :data => data}
|
157
|
+
Couchdb.create_doc doc
|
158
|
+
|
159
|
+
doc = {:database => 'contacts', :doc_id => 'Sun'}
|
160
|
+
hash = Couchdb.delete_doc doc
|
161
|
+
hash["id"].should == 'Sun'
|
162
|
+
hash["ok"].should == true
|
163
|
+
begin
|
164
|
+
doc = {:database => 'contacts', :doc_id => 'Sun'}
|
165
|
+
Couchdb.view doc
|
166
|
+
rescue CouchdbException => e
|
167
|
+
e.to_s.should == "CouchDB: Error - not_found. Reason - deleted"
|
168
|
+
e.error.should == "not_found"
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
#database: administration tasks
|
173
|
+
|
174
|
+
it "should set a config section, retrieve it and delete it" do
|
175
|
+
data = {:section => "sample_config_section",
|
176
|
+
:key => "sample_key",
|
177
|
+
:value => "sample_value"}
|
178
|
+
Couchdb.set_config data
|
179
|
+
|
180
|
+
data = {:section => "sample_config_section",
|
181
|
+
:key => "sample_key"}
|
182
|
+
|
183
|
+
Couchdb.get_config(data).should == "sample_value"
|
184
|
+
|
185
|
+
Couchdb.delete_config(data).should == "sample_value"
|
186
|
+
|
187
|
+
lambda {Couchdb.get_config(data)}.should raise_error(CouchdbException,"CouchDB: Error - not_found. Reason - unknown_config_value")
|
188
|
+
end
|
189
|
+
|
190
|
+
end
|
@@ -0,0 +1,268 @@
|
|
1
|
+
require 'spec_base.rb'
|
2
|
+
|
3
|
+
#a day in the life of a CouchDB admin user
|
4
|
+
hash = Couchdb.login(username = 'obi',password ='trusted')
|
5
|
+
@@auth_session = hash["AuthSession"]
|
6
|
+
|
7
|
+
data = {:section => "httpd",
|
8
|
+
:key => "port",
|
9
|
+
:value => "6980" }
|
10
|
+
Couchdb.set_config(data,@@auth_session)
|
11
|
+
|
12
|
+
Couchdb.port = "6980"
|
13
|
+
|
14
|
+
|
15
|
+
describe "CouchDB " do
|
16
|
+
|
17
|
+
it "should create and delete a database" do
|
18
|
+
hash = Couchdb.create('staff',@@auth_session)
|
19
|
+
hash.to_s.should == '{"ok"=>true}'
|
20
|
+
hash = Couchdb.all
|
21
|
+
hash.include?("staff").should == true
|
22
|
+
hash = Couchdb.delete 'staff',@@auth_session
|
23
|
+
hash.include?("staff").should == false
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should create a database add a finder method to it and then delete the database" do
|
27
|
+
Couchdb.create('mobsters',@@auth_session)
|
28
|
+
hash = Couchdb.add_finder({:database => 'mobsters', :key => 'email'},@@auth_session)
|
29
|
+
hash.include?("_design/email_finder").should == true
|
30
|
+
hash.include?("true").should == true
|
31
|
+
hash.include?("rev").should == true
|
32
|
+
|
33
|
+
doc = {:database => 'mobsters', :doc_id => '_design/email_finder'}
|
34
|
+
hash = Couchdb.view doc
|
35
|
+
hash["_id"].should == '_design/email_finder'
|
36
|
+
Couchdb.delete 'mobsters',@@auth_session
|
37
|
+
end
|
38
|
+
|
39
|
+
it "find items by key" do
|
40
|
+
docs = Couchdb.find_by({:database => 'contacts', :lastname => 'winner'},@@auth_session)
|
41
|
+
d = docs[0]
|
42
|
+
d["lastname"].should == "winner"
|
43
|
+
Couchdb.delete_doc({:database => 'contacts', :doc_id => '_design/lastname_finder'},@@auth_session)
|
44
|
+
end
|
45
|
+
|
46
|
+
it "should create and view document doc" do
|
47
|
+
data = {:firstname => 'John',
|
48
|
+
:lastname =>'smith',
|
49
|
+
:phone => '202-234-1234',
|
50
|
+
:email =>'james@mail.com',
|
51
|
+
:age =>'34',
|
52
|
+
:gender =>'male'}
|
53
|
+
doc = {:database => 'contacts', :doc_id => 'john', :data => data}
|
54
|
+
Couchdb.create_doc doc,@@auth_session
|
55
|
+
|
56
|
+
doc = {:database => 'contacts', :doc_id => 'john'}
|
57
|
+
hash = Couchdb.view doc,@@auth_session
|
58
|
+
hash["_id"].should == 'john'
|
59
|
+
end
|
60
|
+
|
61
|
+
it "should query a permanent view that doesn't exist and handle exception" do
|
62
|
+
begin
|
63
|
+
view = { :database => "contacts", :design_doc => 'more_views', :view => 'get_user_email'}
|
64
|
+
Couchdb.find view,@@auth_session
|
65
|
+
rescue CouchdbException => e
|
66
|
+
e.to_s.should == "CouchDB: Error - not_found. Reason - deleted"
|
67
|
+
e.error.should == "not_found"
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
it "should query a permanent view and create the view on the fly, if it doesn't already exist" do
|
72
|
+
view = {:database => 'contacts',
|
73
|
+
:design_doc => 'my_views',
|
74
|
+
:view => 'get_emails',
|
75
|
+
:json_doc => '/home/obi/bin/my_views.json'}
|
76
|
+
|
77
|
+
docs = Couchdb.find_on_fly(view,@@auth_session)
|
78
|
+
docs[0].include?("Email").should == true
|
79
|
+
docs[0].include?("Name").should == true
|
80
|
+
#verify that the view was created
|
81
|
+
doc = {:database => 'contacts', :doc_id => '_design/my_views'}
|
82
|
+
hash = Couchdb.view doc,@@auth_session
|
83
|
+
hash["_id"].should == '_design/my_views'
|
84
|
+
Couchdb.delete_doc({:database => 'contacts', :doc_id => '_design/my_views'},@@auth_session)
|
85
|
+
end
|
86
|
+
|
87
|
+
it "should query a permanent view by key and create the view on the fly, if it doesn't already exist" do
|
88
|
+
view = { :database => 'contacts',
|
89
|
+
:design_doc => 'the_view',
|
90
|
+
:view => 'age',
|
91
|
+
:json_doc => '/home/obi/bin/view_age.json'}
|
92
|
+
|
93
|
+
age = '36'
|
94
|
+
docs = Couchdb.find_on_fly(view,@@auth_session,key = age)
|
95
|
+
docs[0].include?("age").should == true
|
96
|
+
d = docs[0]
|
97
|
+
d["age"].should == '36'
|
98
|
+
#verify that the view was created
|
99
|
+
doc = {:database => 'contacts', :doc_id => '_design/the_view'}
|
100
|
+
hash = Couchdb.view doc,@@auth_session
|
101
|
+
hash["_id"].should == '_design/the_view'
|
102
|
+
Couchdb.delete_doc({:database => 'contacts', :doc_id => '_design/the_view'},@@auth_session)
|
103
|
+
end
|
104
|
+
|
105
|
+
it "should create a design doc/permanent view and query it" do
|
106
|
+
doc = { :database => 'contacts', :design_doc => 'more_views', :json_doc => '/home/obi/bin/leanback/test/my_views.json' }
|
107
|
+
hash = Couchdb.create_design doc,@@auth_session
|
108
|
+
hash["id"].should == '_design/more_views'
|
109
|
+
hash["ok"].should == true
|
110
|
+
|
111
|
+
view = { :database => "contacts", :design_doc => 'more_views', :view => 'get_email'}
|
112
|
+
hash = Couchdb.find view,@@auth_session
|
113
|
+
hash[0].has_key?("Firstname").should == true
|
114
|
+
hash[0].has_key?("Lastname").should == true
|
115
|
+
hash[0].has_key?("Email").should == true
|
116
|
+
|
117
|
+
doc = {:database => 'contacts', :doc_id => '_design/more_views'}
|
118
|
+
hash = Couchdb.view doc,@@auth_session
|
119
|
+
hash["_id"].should == '_design/more_views'
|
120
|
+
Couchdb.delete_doc({:database => 'contacts', :doc_id => '_design/more_views'},@@auth_session)
|
121
|
+
end
|
122
|
+
|
123
|
+
it "should return a list of all databases in the system" do
|
124
|
+
databases = Couchdb.all
|
125
|
+
databases.include?("contacts").should == true
|
126
|
+
end
|
127
|
+
|
128
|
+
it "should create a document" do
|
129
|
+
data = {:firstname => 'Nancy', :lastname =>'Lee', :phone => '347-808-3734',:email =>'nancy@mail.com',:gender => 'female'}
|
130
|
+
doc = {:database => 'contacts', :doc_id => 'Nancy', :data => data}
|
131
|
+
hash = Couchdb.create_doc doc,@@auth_session
|
132
|
+
hash["id"].should == 'Nancy'
|
133
|
+
hash["ok"].should == true
|
134
|
+
|
135
|
+
doc = {:database => 'contacts', :doc_id => 'Nancy'}
|
136
|
+
hash = Couchdb.view doc,@@auth_session
|
137
|
+
hash["_id"].should == 'Nancy'
|
138
|
+
hash["firstname"].should == 'Nancy'
|
139
|
+
hash["lastname"].should == 'Lee'
|
140
|
+
hash["phone"].should == '347-808-3734'
|
141
|
+
Couchdb.delete_doc({:database => 'contacts', :doc_id => 'Nancy'},@@auth_session)
|
142
|
+
end
|
143
|
+
|
144
|
+
it "should update the document" do
|
145
|
+
data = {:age => "41", :lastname => "Stevens" }
|
146
|
+
doc = { :database => 'contacts', :doc_id => 'john', :data => data}
|
147
|
+
hash = Couchdb.update_doc doc,@@auth_session
|
148
|
+
hash["id"].should == 'john'
|
149
|
+
hash["ok"].should == true
|
150
|
+
|
151
|
+
doc = {:database => 'contacts', :doc_id => 'john'}
|
152
|
+
hash = Couchdb.view doc,@@auth_session
|
153
|
+
hash["_id"].should == 'john'
|
154
|
+
hash["age"].should == '41'
|
155
|
+
hash["lastname"].should == 'Stevens'
|
156
|
+
Couchdb.delete_doc({:database => 'contacts', :doc_id => 'john'},@@auth_session)
|
157
|
+
end
|
158
|
+
|
159
|
+
|
160
|
+
it "should delete a document after creating it" do
|
161
|
+
data = {:firstname => 'Sun',
|
162
|
+
:lastname =>'Nova',
|
163
|
+
:phone => '212-234-1234',
|
164
|
+
:email =>'james@mail.com'}
|
165
|
+
|
166
|
+
doc = {:database => 'contacts', :doc_id => 'Sun', :data => data}
|
167
|
+
Couchdb.create_doc doc,@@auth_session
|
168
|
+
|
169
|
+
doc = {:database => 'contacts', :doc_id => 'Sun'}
|
170
|
+
hash = Couchdb.delete_doc doc,@@auth_session
|
171
|
+
hash["id"].should == 'Sun'
|
172
|
+
hash["ok"].should == true
|
173
|
+
begin
|
174
|
+
doc = {:database => 'contacts', :doc_id => 'Sun'}
|
175
|
+
Couchdb.view doc,@@auth_session
|
176
|
+
rescue CouchdbException => e
|
177
|
+
e.to_s.should == "CouchDB: Error - not_found. Reason - deleted"
|
178
|
+
e.error.should == "not_found"
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
182
|
+
#database: administration tasks
|
183
|
+
|
184
|
+
it "should set a config section, retrieve it and delete it" do
|
185
|
+
data = {:section => "sample_config_section",
|
186
|
+
:key => "sample_key",
|
187
|
+
:value => "sample_value"}
|
188
|
+
Couchdb.set_config data,@@auth_session
|
189
|
+
|
190
|
+
data = {:section => "sample_config_section",
|
191
|
+
:key => "sample_key"}
|
192
|
+
|
193
|
+
Couchdb.get_config(data,@@auth_session).should == "sample_value"
|
194
|
+
|
195
|
+
Couchdb.delete_config(data,@@auth_session).should == "sample_value"
|
196
|
+
|
197
|
+
lambda {Couchdb.get_config(data,@@auth_session)}.should raise_error(CouchdbException,"CouchDB: Error - not_found. Reason - unknown_config_value")
|
198
|
+
end
|
199
|
+
|
200
|
+
it "should create an admin user and delete the admin user" do
|
201
|
+
data = {:section => "admins",
|
202
|
+
:key => "sample_admin",
|
203
|
+
:value => "trusted"}
|
204
|
+
Couchdb.set_config data,@@auth_session
|
205
|
+
|
206
|
+
data = {:section => "admins",
|
207
|
+
:key => "sample_admin"}
|
208
|
+
|
209
|
+
Couchdb.delete_config(data,@@auth_session)
|
210
|
+
lambda {Couchdb.get_config(data,@@auth_session)}.should raise_error(CouchdbException,"CouchDB: Error - not_found. Reason - unknown_config_value")
|
211
|
+
end
|
212
|
+
|
213
|
+
it "should set security object on a database, retrieve it and reset it back to original" do
|
214
|
+
data = { :admins => {"names" => ["obi"], "roles" => ["admin"]},
|
215
|
+
:readers => {"names" => ["obi"],"roles" => ["admin"]}
|
216
|
+
}
|
217
|
+
|
218
|
+
hash = Couchdb.set_security("contacts",data,@@auth_session)
|
219
|
+
hash["ok"].should == true
|
220
|
+
|
221
|
+
hash = Couchdb.get_security("contacts",@@auth_session)
|
222
|
+
hash["admins"].should == {"names"=>["obi"], "roles"=>["admin"]}
|
223
|
+
hash["readers"].should == {"names"=>["obi"], "roles"=>["admin"]}
|
224
|
+
|
225
|
+
data = { :admins => {"names" => [], "roles" => []},
|
226
|
+
:readers => {"names" => [],"roles" => []}
|
227
|
+
}
|
228
|
+
|
229
|
+
hash = Couchdb.set_security("contacts",data,@@auth_session)
|
230
|
+
hash["ok"].should == true
|
231
|
+
|
232
|
+
hash = Couchdb.get_security("contacts",@@auth_session)
|
233
|
+
hash["admins"].should == {"names"=>[], "roles"=>[]}
|
234
|
+
hash["readers"].should == {"names"=>[], "roles"=>[]}
|
235
|
+
end
|
236
|
+
|
237
|
+
it "create a new non-admin user, login user, retrieve user and delete the user" do
|
238
|
+
user = { :username => "sample_user", :password => "trusted", :roles => []}
|
239
|
+
hash = Couchdb.add_user(user)
|
240
|
+
hash["ok"].should == true
|
241
|
+
hash["id"].should == 'org.couchdb.user:sample_user'
|
242
|
+
|
243
|
+
hash = Couchdb.login(username = 'sample_user',password ='trusted')
|
244
|
+
hash.has_key?("AuthSession").should == true
|
245
|
+
|
246
|
+
doc = {:database => '_users', :doc_id => 'org.couchdb.user:sample_user'}
|
247
|
+
hash = Couchdb.view doc,@@auth_session
|
248
|
+
hash["_id"].should == 'org.couchdb.user:sample_user'
|
249
|
+
|
250
|
+
hash = Couchdb.delete_doc doc,@@auth_session
|
251
|
+
hash["id"].should == 'org.couchdb.user:sample_user'
|
252
|
+
hash["ok"].should == true
|
253
|
+
|
254
|
+
lambda {Couchdb.view(doc,@@auth_session)}.should raise_error(CouchdbException,"CouchDB: Error - not_found. Reason - deleted")
|
255
|
+
end
|
256
|
+
|
257
|
+
|
258
|
+
it "should switch to default bind address" do
|
259
|
+
data = {:section => "httpd",
|
260
|
+
:key => "port",
|
261
|
+
:value => "5984" }
|
262
|
+
Couchdb.set_config(data,@@auth_session)
|
263
|
+
#Couchdb.address = nil
|
264
|
+
#Couchdb.port = nil
|
265
|
+
#Couchdb.all @@auth_session
|
266
|
+
end
|
267
|
+
|
268
|
+
end
|