couchbase-jruby-client 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/couchbase-jruby-client.gemspec +1 -1
- data/lib/couchbase.rb +21 -15
- data/lib/couchbase/bucket.rb +39 -41
- data/lib/couchbase/operations/store.rb +1 -1
- data/lib/couchbase/version.rb +1 -1
- data/test/setup.rb +8 -145
- data/test/test_arithmetic.rb +53 -76
- data/test/test_async.rb +74 -102
- data/test/test_bucket.rb +71 -63
- data/test/test_cas.rb +9 -23
- data/test/test_couchbase.rb +5 -4
- data/test/test_delete.rb +41 -43
- data/test/test_design_docs.rb +8 -18
- data/test/test_errors.rb +9 -18
- data/test/test_format.rb +21 -31
- data/test/test_get.rb +107 -150
- data/test/test_stats.rb +9 -24
- data/test/test_store.rb +53 -62
- data/test/test_timer.rb +3 -12
- data/test/test_touch.rb +26 -33
- data/test/test_unlock.rb +45 -78
- data/test/test_utils.rb +2 -11
- data/test/test_version.rb +4 -14
- data/test/test_view.rb +4 -11
- metadata +5 -5
data/test/test_utils.rb
CHANGED
@@ -19,14 +19,6 @@ require File.join(File.dirname(__FILE__), 'setup')
|
|
19
19
|
|
20
20
|
class TestUtils < MiniTest::Test
|
21
21
|
|
22
|
-
def setup
|
23
|
-
@mock = start_mock
|
24
|
-
end
|
25
|
-
|
26
|
-
def teardown
|
27
|
-
stop_mock(@mock)
|
28
|
-
end
|
29
|
-
|
30
22
|
def test_complex_startkey
|
31
23
|
assert_equal "all_docs?startkey=%5B%22Deadmau5%22%2C%22%22%5D", Couchbase::Utils.build_query("all_docs", :startkey => ["Deadmau5", ""])
|
32
24
|
end
|
@@ -38,12 +30,11 @@ class TestUtils < MiniTest::Test
|
|
38
30
|
raise ArgumentError, "cannot accept your object"
|
39
31
|
end
|
40
32
|
end
|
41
|
-
connection = Couchbase.new(:hostname => @mock.host, :port => @mock.port)
|
42
33
|
assert_raises(Couchbase::Error::ValueFormat) do
|
43
|
-
|
34
|
+
cb.set(uniq_id, "foo")
|
44
35
|
end
|
45
36
|
begin
|
46
|
-
|
37
|
+
cb.set(uniq_id, "foo")
|
47
38
|
rescue Couchbase::Error::ValueFormat => ex
|
48
39
|
assert_match /cannot accept your object/, ex.to_s
|
49
40
|
assert_instance_of ArgumentError, ex.inner_exception
|
data/test/test_version.rb
CHANGED
@@ -19,32 +19,22 @@ require File.join(File.dirname(__FILE__), 'setup')
|
|
19
19
|
|
20
20
|
class TestVersion < MiniTest::Test
|
21
21
|
|
22
|
-
def setup
|
23
|
-
@mock = start_mock
|
24
|
-
end
|
25
|
-
|
26
|
-
def teardown
|
27
|
-
stop_mock(@mock)
|
28
|
-
end
|
29
|
-
|
30
22
|
def test_sync_version
|
31
|
-
|
32
|
-
ver = connection.version
|
23
|
+
ver = cb.version
|
33
24
|
assert ver.is_a?(Hash)
|
34
|
-
assert_equal
|
25
|
+
assert_equal 1, ver.size
|
35
26
|
end
|
36
27
|
|
37
28
|
def test_async_version
|
38
29
|
skip
|
39
|
-
connection = Couchbase.new(:hostname => @mock.host, :port => @mock.port)
|
40
30
|
ver = {}
|
41
|
-
|
31
|
+
cb.run do |conn|
|
42
32
|
conn.version do |ret|
|
43
33
|
assert ret.success?
|
44
34
|
ver[ret.node] = ret.value
|
45
35
|
end
|
46
36
|
end
|
47
|
-
assert_equal
|
37
|
+
assert_equal 1, ver.size
|
48
38
|
ver.each do |node, v|
|
49
39
|
assert v.is_a?(String)
|
50
40
|
end
|
data/test/test_view.rb
CHANGED
@@ -20,19 +20,12 @@ require File.join(File.dirname(__FILE__), 'setup')
|
|
20
20
|
class TestView < MiniTest::Test
|
21
21
|
|
22
22
|
def setup
|
23
|
-
@mock = start_mock
|
24
23
|
@path = '_design/users/_view/by_age'
|
25
|
-
|
26
|
-
@cb.save_design_doc(design_doc)
|
24
|
+
cb.save_design_doc(design_doc)
|
27
25
|
{ bob: 32, frank: 25, sam: 42, fred: 21 }.each_pair do |name, age|
|
28
|
-
|
26
|
+
cb.set(name, { type: 'user', name: name, age: age })
|
29
27
|
end
|
30
|
-
@view = Couchbase::View.new(
|
31
|
-
end
|
32
|
-
|
33
|
-
def teardown
|
34
|
-
stop_mock(@mock)
|
35
|
-
@cb.disconnect
|
28
|
+
@view = Couchbase::View.new(cb, @path)
|
36
29
|
end
|
37
30
|
|
38
31
|
def test_initialize
|
@@ -70,7 +63,7 @@ class TestView < MiniTest::Test
|
|
70
63
|
end
|
71
64
|
|
72
65
|
def test_design_doc_access
|
73
|
-
assert results =
|
66
|
+
assert results = cb.design_docs['users'].by_age.to_a
|
74
67
|
assert results.first.is_a?(Couchbase::ViewRow)
|
75
68
|
end
|
76
69
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: couchbase-jruby-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Evans
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-11-
|
11
|
+
date: 2013-11-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_json
|
@@ -25,17 +25,17 @@ dependencies:
|
|
25
25
|
prerelease: false
|
26
26
|
type: :runtime
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: thread_safe
|
29
29
|
version_requirements: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 0.1.2
|
34
34
|
requirement: !ruby/object:Gem::Requirement
|
35
35
|
requirements:
|
36
36
|
- - ~>
|
37
37
|
- !ruby/object:Gem::Version
|
38
|
-
version:
|
38
|
+
version: 0.1.2
|
39
39
|
prerelease: false
|
40
40
|
type: :runtime
|
41
41
|
- !ruby/object:Gem::Dependency
|