relaxo 0.4.7 → 1.0.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.
@@ -1,29 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require_relative 'spec_helper'
4
-
5
- require 'relaxo'
6
-
7
- RSpec.describe Relaxo::Connection do
8
- before :all do
9
- @connection = Relaxo::Connection.new(TEST_DATABASE_HOST)
10
- end
11
-
12
- it "should provide connection information hash" do
13
- expect(@connection.info).to be_kind_of Hash
14
- end
15
-
16
- it "should create test database" do
17
- database = Relaxo::Database.new(@connection, TEST_DATABASE_NAME)
18
-
19
- if database.exist?
20
- expect(database.delete!).to be == Relaxo::SUCCESS
21
- end
22
-
23
- expect(database.create!).to be == Relaxo::SUCCESS
24
-
25
- expect(@connection.databases).to be_include TEST_DATABASE_NAME
26
-
27
- expect(database.delete!).to be == Relaxo::SUCCESS
28
- end
29
- end
@@ -1,4 +0,0 @@
1
-
2
- # Avoid running these tests on a live server if you have a valuable database as named below:
3
- TEST_DATABASE_NAME = 'relaxo-test-database'
4
- TEST_DATABASE_HOST = 'localhost:5984'
@@ -1,63 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require_relative 'spec_helper'
4
-
5
- require 'relaxo'
6
- require 'relaxo/transaction'
7
-
8
- RSpec.describe Relaxo::Transaction do
9
- before :all do
10
- @connection = Relaxo::Connection.new(TEST_DATABASE_HOST)
11
- @database = Relaxo::Database.new(@connection, TEST_DATABASE_NAME)
12
-
13
- if @database.exist?
14
- @database.delete!
15
- end
16
-
17
- @database.create!
18
- end
19
-
20
- it "should create some documents" do
21
- documents = @database.transaction do |txn|
22
- 10.times do |i|
23
- txn.save({:i => i})
24
- end
25
- end
26
-
27
- # We got 10 document IDs back
28
- expect(documents.size).to be == 10
29
- end
30
-
31
- it "should abort transaction" do
32
- all_documents = @database.documents
33
-
34
- documents = @database.transaction do |txn|
35
- 10.times do |i|
36
- txn.save({:i => i})
37
-
38
- txn.abort! if i == 5
39
- end
40
- end
41
-
42
- expect(documents).to be nil
43
- expect(all_documents).to be == @database.documents
44
- end
45
-
46
- it "should delete some documents" do
47
- documents = @database.transaction do |txn|
48
- 3.times do |i|
49
- txn.save({:i => i})
50
- end
51
- end
52
-
53
- @database.transaction do |txn|
54
- documents.each do |document|
55
- txn.delete(document)
56
- end
57
- end
58
-
59
- documents.each do |document|
60
- expect(@database.id?(document[Relaxo::ID])).to be false
61
- end
62
- end
63
- end