leanback 0.4.2 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +7 -0
  2. data/.travis.yml +10 -0
  3. data/Gemfile +5 -6
  4. data/Gemfile.lock +65 -14
  5. data/README.md +465 -33
  6. data/Rakefile +8 -17
  7. data/VERSION +1 -1
  8. data/leanback.gemspec +26 -85
  9. data/lib/leanback.rb +129 -587
  10. data/spec/leanback_spec.rb +356 -0
  11. metadata +40 -117
  12. data/Changelog.rdoc +0 -146
  13. data/documentation/static/2011/11/20/i-moved-leanback-documentation/index.html +0 -180
  14. data/documentation/static/2011/11/20/index.html +0 -146
  15. data/documentation/static/2011/11/index.html +0 -146
  16. data/documentation/static/2011/index.html +0 -146
  17. data/documentation/static/2013/06/02/index.html +0 -146
  18. data/documentation/static/2013/06/02/released-leanback-v0-3-4/index.html +0 -180
  19. data/documentation/static/2013/06/09/index.html +0 -146
  20. data/documentation/static/2013/06/09/released-leanback-v0-4-0/index.html +0 -179
  21. data/documentation/static/2013/06/index.html +0 -158
  22. data/documentation/static/2013/index.html +0 -158
  23. data/documentation/static/author/admin/index.html +0 -175
  24. data/documentation/static/basic-couchdb-operations/index.html +0 -259
  25. data/documentation/static/category/uncategorized/index.html +0 -170
  26. data/documentation/static/couchdb-configuration/index.html +0 -189
  27. data/documentation/static/couchdb-security/index.html +0 -218
  28. data/documentation/static/count-by-multiple-documents/index.html +0 -221
  29. data/documentation/static/count-documents-by-key/index.html +0 -177
  30. data/documentation/static/css/2c-l-fixed.css +0 -1
  31. data/documentation/static/css/2c-l-fixed.dev.css +0 -62
  32. data/documentation/static/css/2c-r-fixed.css +0 -1
  33. data/documentation/static/css/2c-r-fixed.dev.css +0 -60
  34. data/documentation/static/css/3c-c-fixed.css +0 -1
  35. data/documentation/static/css/3c-c-fixed.dev.css +0 -84
  36. data/documentation/static/css/3c-l-fixed.css +0 -1
  37. data/documentation/static/css/3c-l-fixed.dev.css +0 -61
  38. data/documentation/static/css/3c-r-fixed.css +0 -1
  39. data/documentation/static/css/3c-r-fixed.dev.css +0 -62
  40. data/documentation/static/css/holy-grail-fluid.css +0 -5
  41. data/documentation/static/css/plugins.css +0 -5
  42. data/documentation/static/css/print.css +0 -5
  43. data/documentation/static/css/screen.css +0 -1
  44. data/documentation/static/design-documents-and-permanent-views/index.html +0 -454
  45. data/documentation/static/error-handling/index.html +0 -157
  46. data/documentation/static/find-document-by-multiple-keys/index.html +0 -269
  47. data/documentation/static/find-documents-by-key/index.html +0 -243
  48. data/documentation/static/index.html +0 -161
  49. data/documentation/static/leanback/index.html +0 -130
  50. data/documentation/static/leanback/installation/index.html +0 -119
  51. data/documentation/static/setting-the-bind_address-port/index.html +0 -151
  52. data/documentation/static/style.css +0 -16
  53. data/spec/admin_party/database_spec.rb +0 -400
  54. data/spec/no_admin_party/cloudant_spec.rb +0 -365
  55. data/spec/no_admin_party/database_spec.rb +0 -491
  56. data/spec/no_admin_party/non_admin_user_spec.rb +0 -67
  57. data/test/helper.rb +0 -18
  58. data/test/main.rb +0 -295
  59. data/test/my_view.json +0 -8
  60. data/test/my_views.json +0 -8
  61. data/test/start.json +0 -8
  62. data/test/test_leanback.rb +0 -319
  63. data/test/view_age.json +0 -8
@@ -1,491 +0,0 @@
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('employees',@@auth_session)
19
- hash.to_s.should == '{"ok"=>true}'
20
- hash = Couchdb.all
21
- hash.include?("employees").should == true
22
- hash = Couchdb.delete 'employees',@@auth_session
23
- hash.include?("employees").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('wiseguys',@@auth_session)
28
- hash = Couchdb.add_finder({:database => 'wiseguys', :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 => 'wiseguys', :doc_id => '_design/email_finder'}
34
- hash = Couchdb.view doc
35
- hash["_id"].should == '_design/email_finder'
36
- Couchdb.delete 'wiseguys',@@auth_session
37
- end
38
-
39
- it "should create and view document doc" do
40
- Couchdb.create('contacts',@@auth_session)
41
- data = {:firstname => 'John',
42
- :lastname =>'smith',
43
- :phone => '202-234-1234',
44
- :email =>'james@mail.com',
45
- :age =>'34',
46
- :gender =>'male'}
47
-
48
- doc = {:database => 'contacts', :doc_id => 'john', :data => data}
49
- Couchdb.create_doc doc,@@auth_session
50
-
51
- doc = {:database => 'contacts', :doc_id => 'john'}
52
- hash = Couchdb.view doc,@@auth_session
53
- hash["_id"].should == 'john'
54
-
55
- #view doc and return symbolized keys
56
- doc = {:database => 'contacts', :doc_id => 'john'}
57
- hash = Couchdb.view(doc,@@auth_session, {symbolize_keys: true})
58
- hash.should include(data)
59
- end
60
-
61
- it "should count the lastnames named smith" do
62
- count = Couchdb.count({:database => 'contacts', :lastname => 'smith'},@@auth_session)
63
- count.should == 1
64
- end
65
-
66
- it "should count lastnames named brown" do
67
- count = Couchdb.count({:database => 'contacts', :lastname => 'brown'},@@auth_session)
68
- count.should == 0
69
- end
70
-
71
-
72
- it "find items by key" do
73
- docs = Couchdb.find_by({:database => 'contacts', :lastname => 'smith'},@@auth_session)
74
- d = docs[0]
75
- d["lastname"].should == "smith"
76
- Couchdb.delete_doc({:database => 'contacts', :doc_id => '_design/lastname_finder'},@@auth_session)
77
- end
78
-
79
- it "should find items by multiple keys" do
80
- keys = {:gender => 'male',:age => '34'}
81
- docs = Couchdb.find_by_keys({:database => 'contacts', :keys => keys},@@auth_session)
82
- d = docs[0]
83
- d["age"].should == "34"
84
- end
85
-
86
- it "should find items by multiple keys using a single key" do
87
- keys = {:lastname => 'smith'}
88
- docs = Couchdb.find_by_keys({:database => 'contacts', :keys => keys},@@auth_session)
89
- d = docs[0]
90
- d["lastname"].should == "smith"
91
- end
92
-
93
- it "should find items by multiple keys" do
94
- keys = {:gender => 'male',:age => '40'}
95
- docs = Couchdb.find_by_keys({:database => 'contacts', :keys => keys},@@auth_session)
96
- docs.should == []
97
- end
98
-
99
- it "should count items by multiple keys" do
100
- keys = {:gender => 'male',:age => '34'}
101
- count = Couchdb.count_by_keys({:database => 'contacts', :keys => keys},@@auth_session)
102
- count.should == 1
103
- end
104
-
105
- it "should count items by multiple keys" do
106
- keys = {:gender => 'male',:age => '40'}
107
- count = Couchdb.count_by_keys({:database => 'contacts', :keys => keys},@@auth_session)
108
- count.should == 0
109
- end
110
-
111
-
112
-
113
- it "should query a permanent view that doesn't exist and handle exception" do
114
- begin
115
- view = { :database => "contacts", :design_doc => 'more_views', :view => 'get_user_email'}
116
- Couchdb.find view,@@auth_session
117
- rescue CouchdbException => e
118
- e.to_s.should == "CouchDB: Error - not_found. Reason - missing"
119
- e.error.should == "not_found"
120
- end
121
- end
122
-
123
- it "should query a permanent view and create the view on the fly, if it doesn't already exist" do
124
- view = {:database => 'contacts',
125
- :design_doc => 'my_views',
126
- :view => 'get_emails',
127
- :json_doc => '/home/obi/bin/leanback/test/my_view.json'}
128
-
129
- docs = Couchdb.find_on_fly(view,@@auth_session)
130
- docs[0].include?("Email").should == true
131
- docs[0].include?("Name").should == true
132
- #verify that the view was created
133
- doc = {:database => 'contacts', :doc_id => '_design/my_views'}
134
- hash = Couchdb.view doc,@@auth_session
135
- hash["_id"].should == '_design/my_views'
136
- Couchdb.delete_doc({:database => 'contacts', :doc_id => '_design/my_views'},@@auth_session)
137
- end
138
-
139
- it "should query a permanent view by key and create the view on the fly, if it doesn't already exist" do
140
- view = { :database => 'contacts',
141
- :design_doc => 'the_view',
142
- :view => 'age',
143
- :json_doc => '/home/obi/bin/leanback/test/view_age.json'}
144
-
145
- age = '34'
146
- docs = Couchdb.find_on_fly(view,@@auth_session,key = age)
147
- docs[0].include?("age").should == true
148
- d = docs[0]
149
- d["age"].should == '34'
150
- #verify that the view was created
151
- doc = {:database => 'contacts', :doc_id => '_design/the_view'}
152
- hash = Couchdb.view doc,@@auth_session
153
- hash["_id"].should == '_design/the_view'
154
- Couchdb.delete_doc({:database => 'contacts', :doc_id => '_design/the_view'},@@auth_session)
155
- end
156
-
157
- it "should create a design doc/permanent view and query it" do
158
- doc = { :database => 'contacts', :design_doc => 'more_views', :json_doc => '/home/obi/bin/leanback/test/my_views.json' }
159
- hash = Couchdb.create_design doc,@@auth_session
160
- hash["id"].should == '_design/more_views'
161
- hash["ok"].should == true
162
-
163
- view = { :database => "contacts", :design_doc => 'more_views', :view => 'get_email'}
164
- hash = Couchdb.find view,@@auth_session
165
- hash[0].has_key?("Firstname").should == true
166
- hash[0].has_key?("Lastname").should == true
167
- hash[0].has_key?("Email").should == true
168
-
169
- doc = {:database => 'contacts', :doc_id => '_design/more_views'}
170
- hash = Couchdb.view doc,@@auth_session
171
- hash["_id"].should == '_design/more_views'
172
- Couchdb.delete_doc({:database => 'contacts', :doc_id => '_design/more_views'},@@auth_session)
173
- end
174
-
175
- it "should return a list of all databases in the system" do
176
- databases = Couchdb.all
177
- databases.include?("contacts").should == true
178
- end
179
-
180
- it "should create a document" do
181
- data = {:firstname => 'Nancy', :lastname =>'Lee', :phone => '347-808-3734',:email =>'nancy@mail.com',:gender => 'female'}
182
- doc = {:database => 'contacts', :doc_id => 'Nancy', :data => data}
183
- hash = Couchdb.create_doc doc,@@auth_session
184
- hash["id"].should == 'Nancy'
185
- hash["ok"].should == true
186
-
187
- doc = {:database => 'contacts', :doc_id => 'Nancy'}
188
- hash = Couchdb.view doc,@@auth_session
189
- hash["_id"].should == 'Nancy'
190
- hash["firstname"].should == 'Nancy'
191
- hash["lastname"].should == 'Lee'
192
- hash["phone"].should == '347-808-3734'
193
- Couchdb.delete_doc({:database => 'contacts', :doc_id => 'Nancy'},@@auth_session)
194
- end
195
-
196
- it "should update the document" do
197
- data = {:age => "41", :lastname => "Stevens" }
198
- doc = { :database => 'contacts', :doc_id => 'john', :data => data}
199
- hash = Couchdb.update_doc doc,@@auth_session
200
- hash["id"].should == 'john'
201
- hash["ok"].should == true
202
-
203
- doc = {:database => 'contacts', :doc_id => 'john'}
204
- hash = Couchdb.view doc,@@auth_session
205
- hash["_id"].should == 'john'
206
- hash["age"].should == '41'
207
- hash["lastname"].should == 'Stevens'
208
- Couchdb.delete_doc({:database => 'contacts', :doc_id => 'john'},@@auth_session)
209
- end
210
-
211
-
212
- it "should delete a document after creating it" do
213
- data = {:firstname => 'Sun',
214
- :lastname =>'Nova',
215
- :phone => '212-234-1234',
216
- :email =>'james@mail.com'}
217
-
218
- doc = {:database => 'contacts', :doc_id => 'Sun', :data => data}
219
- Couchdb.create_doc doc,@@auth_session
220
-
221
- doc = {:database => 'contacts', :doc_id => 'Sun'}
222
- hash = Couchdb.delete_doc doc,@@auth_session
223
- hash["id"].should == 'Sun'
224
- hash["ok"].should == true
225
- begin
226
- doc = {:database => 'contacts', :doc_id => 'Sun'}
227
- Couchdb.view doc,@@auth_session
228
- rescue CouchdbException => e
229
- e.to_s.should == "CouchDB: Error - not_found. Reason - deleted"
230
- e.error.should == "not_found"
231
- end
232
- end
233
-
234
- it "should test finder options" do
235
-
236
- Couchdb.create('fishes',@@auth_session)
237
-
238
- data = {:firstname => 'aaron', :gender =>'male', :age => '28', :salary => '50000'}
239
- doc = {:database => 'fishes', :doc_id => 'aaron', :data => data}
240
- Couchdb.create_doc doc,@@auth_session
241
-
242
- data_c = {:firstname => 'john', :gender =>'male', :age => '28', :salary => '60000'}
243
- doc = {:database => 'fishes', :doc_id => 'john', :data => data_c}
244
- Couchdb.create_doc doc,@@auth_session
245
-
246
- data = {:firstname => 'peter', :gender =>'male', :age => '45', :salary => '78000'}
247
- doc = {:database => 'fishes', :doc_id => 'peter', :data => data}
248
- Couchdb.create_doc doc,@@auth_session
249
-
250
- data = {:firstname => 'sam', :gender =>'male', :age => '28', :salary => '97000'}
251
- doc = {:database => 'fishes', :doc_id => 'sam', :data => data}
252
- Couchdb.create_doc doc,@@auth_session
253
-
254
-
255
- keys = {:age =>'28', :gender => 'male'}
256
- hash = Couchdb.find_by_keys({:database => 'fishes', :keys => keys},@@auth_session, options = {:limit => 2, :skip => 1})
257
- hash.first["firstname"].should == "john"
258
- hash.length.should == 2
259
-
260
- #return hash in symbolized keys for find_by_keys
261
- hash = Couchdb.find_by_keys({:database => 'fishes', :keys => keys},@@auth_session, options = {:limit => 2, :skip => 1, :symbolize_keys => true})
262
- hash.first.should include(data_c)
263
-
264
- #create the design doc to be queryed in the test
265
- Couchdb.find_by({:database => 'fishes', :gender => 'male'},@@auth_session)
266
-
267
-
268
- view = { :database => "fishes",
269
- :design_doc => 'gender_finder',
270
- :view => 'find_by_gender'}
271
-
272
- hash = Couchdb.find view,@@auth_session,key=nil, options = {:limit => 2, :skip => 1}
273
- hash.first["firstname"].should == "john"
274
- hash.length.should == 2
275
-
276
- #return results in symbolized keys
277
- hash = Couchdb.find view,@@auth_session,key=nil, options = {:limit => 2, :skip => 1, :symbolize_keys => true}
278
- hash.first.should include(data_c)
279
-
280
- #it should not return symbolized keys
281
- hash = Couchdb.find view,@@auth_session,key=nil, options = {:limit => 2, :skip => 1, :symbolize_keys => false}
282
- hash.first.should_not include(data_c)
283
- hash.first["firstname"].should == "john"
284
-
285
- hash = Couchdb.find_by({:database => 'fishes', :gender => 'male'},@@auth_session,options = {:limit => 2, :skip => 1})
286
- hash.first["firstname"].should == "john"
287
- hash.length.should == 2
288
-
289
- #return symbolized results
290
- hash = Couchdb.find_by({:database => 'fishes', :gender => 'male'},@@auth_session,options = {:limit => 2, :skip => 1, :symbolize_keys => true})
291
- hash.first.should include(data_c)
292
-
293
- hash = Couchdb.find view,@@auth_session,key='male', options = {:descending => true}
294
- h = hash[0]
295
- h["firstname"].should == "sam"
296
-
297
- Couchdb.find_by({:database => 'fishes', :gender => 'male'},@@auth_session, options = {:descending => true})
298
- h = hash[0]
299
- h["firstname"].should == "sam"
300
-
301
-
302
-
303
- hash = Couchdb.find view,@@auth_session,key='male', options = {:limit => 3}
304
- hash.length.should == 3
305
-
306
- hash = Couchdb.find view,@@auth_session,key=nil, options = {:skip => 2}
307
- h = hash[0]
308
- h["firstname"].should == "peter"
309
- hash.length.should == 2
310
-
311
- hash = Couchdb.find view,@@auth_session,key='male', options = {:descending => true,:limit => 1}
312
- h = hash[0]
313
- h["firstname"].should == "sam"
314
- hash.length.should == 1
315
-
316
- Couchdb.find_by({:database => 'fishes', :gender => 'male'},@@auth_session, options = {:descending => true,:limit => 1})
317
- h = hash[0]
318
- h["firstname"].should == "sam"
319
- hash.length.should == 1
320
-
321
- Couchdb.find_by({:database => 'fishes', :salary => '5000'},@@auth_session)
322
-
323
-
324
- view = { :database => "fishes",
325
- :design_doc => 'salary_finder',
326
- :view => 'find_by_salary'}
327
-
328
- hash = Couchdb.find view, @@auth_session,key=nil, options = {:startkey => "3000", :endkey => "65000"}
329
- h = hash[0]
330
- h["firstname"].should == "aaron"
331
- hash.length.should == 2
332
-
333
- hash = Couchdb.find view, @@auth_session,key=nil, options = {:startkey => "53000", :endkey => "99000",:limit => 2}
334
- h = hash[0]
335
- h["firstname"].should == "john"
336
- hash.length.should == 2
337
-
338
- Couchdb.find_by({:database => 'fishes', :salary => ''},@@auth_session, options = {:startkey => "53000", :endkey => "99000",:limit => 2})
339
- h = hash[0]
340
- h["firstname"].should == "john"
341
- hash.length.should == 2
342
-
343
- view = {:database => 'fishes',
344
- :design_doc => 'my_views',
345
- :view => 'age_gender',
346
- :json_doc => '/home/obi/bin/leanback/test/start.json'}
347
-
348
- options = {:startkey => ["28","male"], :endkey => ["28","male"], :limit => 2}
349
-
350
- hash = Couchdb.find_on_fly(view,@@auth_session,key=nil, options)
351
- h0 = hash[0]
352
- h1 = hash[1]
353
- h0["firstname"].should == "aaron"
354
- h1["firstname"].should == "john"
355
- hash.length.should == 2
356
-
357
- options = {:startkey => ["28","male"], :endkey => ["28","male"], :skip => 1}
358
-
359
- hash = Couchdb.find_on_fly(view,@@auth_session,key=nil, options)
360
- h0 = hash[0]
361
- h1 = hash[1]
362
- h0["firstname"].should == "john"
363
- h1["firstname"].should == "sam"
364
- hash.length.should == 2
365
-
366
- #return results as symbolized keys
367
- options = {:startkey => ["28","male"], :endkey => ["28","male"], :skip => 1,:symbolize_keys => true}
368
- hash = Couchdb.find_on_fly(view,@@auth_session,key=nil, options)
369
- hash.first.should include(data_c)
370
-
371
- options = {:startkey => ["28","male"], :endkey => ["28","male"]}
372
-
373
- hash = Couchdb.find_on_fly(view,@@auth_session,key=nil, options)
374
- h0 = hash[0]
375
- h1 = hash[1]
376
- h0["firstname"].should == "aaron"
377
- h1["firstname"].should == "john"
378
- hash.length.should == 3
379
-
380
- Couchdb.delete 'fishes',@@auth_session
381
- end
382
-
383
- #database: administration tasks
384
-
385
- it "should set a config section, retrieve it and delete it" do
386
- data = {:section => "sample_config_section",
387
- :key => "sample_key",
388
- :value => "sample_value"}
389
- Couchdb.set_config data,@@auth_session
390
-
391
- data = {:section => "sample_config_section",
392
- :key => "sample_key"}
393
-
394
- Couchdb.get_config(data,@@auth_session).should == "sample_value"
395
-
396
- Couchdb.delete_config(data,@@auth_session).should == "sample_value"
397
-
398
- lambda {Couchdb.get_config(data,@@auth_session)}.should raise_error(CouchdbException,"CouchDB: Error - not_found. Reason - unknown_config_value")
399
- end
400
-
401
- it "should create an admin user and delete the admin user" do
402
- data = {:section => "admins",
403
- :key => "sample_admin",
404
- :value => "trusted"}
405
- Couchdb.set_config data,@@auth_session
406
-
407
- data = {:section => "admins",
408
- :key => "sample_admin"}
409
-
410
- Couchdb.delete_config(data,@@auth_session)
411
- lambda {Couchdb.get_config(data,@@auth_session)}.should raise_error(CouchdbException,"CouchDB: Error - not_found. Reason - unknown_config_value")
412
- end
413
-
414
- it "should set security object on a database, retrieve it and reset it back to original" do
415
- data = { :admins => {"names" => ["obi"], "roles" => ["admin"]},
416
- :readers => {"names" => ["obi"],"roles" => ["admin"]}
417
- }
418
-
419
- hash = Couchdb.set_security("contacts",data,@@auth_session)
420
- hash["ok"].should == true
421
-
422
- hash = Couchdb.get_security("contacts",@@auth_session)
423
- hash["admins"].should == {"names"=>["obi"], "roles"=>["admin"]}
424
- hash["readers"].should == {"names"=>["obi"], "roles"=>["admin"]}
425
-
426
- data = { :admins => {"names" => [], "roles" => []},
427
- :readers => {"names" => [],"roles" => []}
428
- }
429
-
430
- hash = Couchdb.set_security("contacts",data,@@auth_session)
431
- hash["ok"].should == true
432
-
433
- hash = Couchdb.get_security("contacts",@@auth_session)
434
- hash["admins"].should == {"names"=>[], "roles"=>[]}
435
- hash["readers"].should == {"names"=>[], "roles"=>[]}
436
- end
437
-
438
- it "create a new non-admin user, login user, retrieve user and delete the user" do
439
- user = { :username => "sample_user", :password => "trusted", :roles => []}
440
- hash = Couchdb.add_user(user)
441
- hash["ok"].should == true
442
- hash["id"].should == 'org.couchdb.user:sample_user'
443
-
444
- hash = Couchdb.login(username = 'sample_user',password ='trusted')
445
- hash.has_key?("AuthSession").should == true
446
-
447
- doc = {:database => '_users', :doc_id => 'org.couchdb.user:sample_user'}
448
- hash = Couchdb.view doc,@@auth_session
449
- hash["_id"].should == 'org.couchdb.user:sample_user'
450
-
451
- hash = Couchdb.delete_doc doc,@@auth_session
452
- hash["id"].should == 'org.couchdb.user:sample_user'
453
- hash["ok"].should == true
454
-
455
- lambda {Couchdb.view(doc,@@auth_session)}.should raise_error(CouchdbException,"CouchDB: Error - not_found. Reason - deleted")
456
- end
457
-
458
-
459
- it "should non-admin user password, verify new password" do
460
- user = { :username => "another_sample_user", :password => "trusted", :roles => []}
461
- hash = Couchdb.add_user(user)
462
- hash["ok"].should == true
463
- hash["id"].should == 'org.couchdb.user:another_sample_user'
464
-
465
- Couchdb.change_password(username = 'another_sample_user', new_password = "brown", @@auth_session)
466
- hash = Couchdb.login(username = 'another_sample_user',password ='brown')
467
- hash.has_key?("AuthSession").should == true
468
-
469
- lambda {Couchdb.login(username = 'another_sample_user',password ='trusted')}.should raise_error(CouchdbException,"CouchDB: Error - unauthorized. Reason - Name or password is incorrect.")
470
-
471
- doc = {:database => '_users', :doc_id => 'org.couchdb.user:another_sample_user'}
472
- hash = Couchdb.delete_doc doc,@@auth_session
473
-
474
- end
475
-
476
- it "should delete the database" do
477
- Couchdb.delete 'contacts',@@auth_session
478
- end
479
-
480
- it "should switch to default bind address" do
481
- data = {:section => "httpd",
482
- :key => "port",
483
- :value => "5984" }
484
- Couchdb.set_config(data,@@auth_session)
485
-
486
- #Couchdb.address = nil
487
- #Couchdb.port = nil
488
- #Couchdb.all @@auth_session
489
- end
490
-
491
- end