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.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.rspec +3 -0
- data/.travis.yml +6 -3
- data/Gemfile +9 -2
- data/README.md +67 -60
- data/Rakefile +12 -0
- data/lib/relaxo.rb +6 -15
- data/lib/relaxo/{connection.rb → changeset.rb} +59 -27
- data/lib/relaxo/database.rb +67 -83
- data/lib/relaxo/{json.rb → dataset.rb} +36 -9
- data/lib/relaxo/directory.rb +97 -0
- data/lib/relaxo/version.rb +1 -1
- data/relaxo.gemspec +1 -2
- data/spec/relaxo/changeset_spec.rb +39 -0
- data/spec/relaxo/concurrency_spec.rb +39 -0
- data/spec/relaxo/database_spec.rb +68 -33
- data/spec/relaxo/enumeration_spec.rb +30 -0
- data/spec/relaxo/performance_spec.rb +78 -0
- data/spec/relaxo/test_records.rb +25 -0
- metadata +18 -29
- data/lib/relaxo/attachments.rb +0 -65
- data/lib/relaxo/client.rb +0 -168
- data/lib/relaxo/transaction.rb +0 -116
- data/spec/relaxo/connection_spec.rb +0 -29
- data/spec/relaxo/spec_helper.rb +0 -4
- data/spec/relaxo/transaction_spec.rb +0 -63
@@ -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
|
data/spec/relaxo/spec_helper.rb
DELETED
@@ -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
|