em-riak 0.2.0 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,46 @@
1
+ # encoding: UTF-8
2
+ require 'rubygems'
3
+ require 'eventmachine'
4
+ require 'em-http-request'
5
+ require 'httpi'
6
+ require 'yajl'
7
+ require 'em-riak'
8
+ TEST_RIAK_HOSTS=["http://127.0.0.1:8091","http://127.0.0.1:8092","http://127.0.0.1:8093","http://127.0.0.1:8094"]
9
+ require File.expand_path('../../../lib/em-riak', __FILE__)
10
+ gem 'minitest'
11
+ require 'minitest/autorun'
12
+
13
+ class TestSecondaryIndex < MiniTest::Unit::TestCase
14
+ def setup
15
+ @tags=["cool","ruby","social","天天開心","寫程式好Happy"]
16
+ EmRiak::Connection.new({:bucket=>"test-member",:async=>false,:hosts=>TEST_RIAK_HOSTS})
17
+ @member=EmRiak.find("member5",{:name=>5})
18
+ if !@member
19
+ EmRiak.create("member5",{:name=>5})
20
+ @member=EmRiak.find("member5",{:name=>5})
21
+ end
22
+ end
23
+
24
+ def test_add_secondary_index
25
+ @member.add_tag(:likes,@tags)
26
+ data=EmRiak.search(:secondary_index,{:bin=>:likes},@tags).reject{|ary| ary==[false,false]}
27
+ p data
28
+ assert_operator 0, :<, data.count
29
+ end
30
+
31
+ def test_show_secondary_index
32
+ @member.add_tag(:likes,@tags)
33
+ data=EmRiak.search(:secondary_index,{:bin=>:likes},@tags).reject{|ary| ary==[false,false]}
34
+ assert_operator 0, :<, data.count
35
+
36
+ has_member=false
37
+ data.each{|ary| has_member=true if "member5"==ary[1] }
38
+ assert_equal true,has_member
39
+ end
40
+
41
+ def test_remove_secondary_index
42
+ @member.remove_tag(:likes,@tags)
43
+ data=EmRiak.search(:secondary_index,{:bin=>:likes},@tags).reject{|ary| ary==[false,false]}
44
+ assert_operator 1, :>, data.count
45
+ end
46
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: em-riak
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-01 00:00:00.000000000Z
12
+ date: 2012-12-27 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: escape_utils
16
- requirement: &70187287663420 !ruby/object:Gem::Requirement
16
+ requirement: &70203217400120 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,51 +21,51 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70187287663420
24
+ version_requirements: *70203217400120
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: yajl-ruby
27
- requirement: &70187287662160 !ruby/object:Gem::Requirement
27
+ requirement: &70203217396580 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
- - - ~>
30
+ - - ! '>='
31
31
  - !ruby/object:Gem::Version
32
- version: 1.1.0
32
+ version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70187287662160
35
+ version_requirements: *70203217396580
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: httpi
38
- requirement: &70187287655840 !ruby/object:Gem::Requirement
38
+ requirement: &70203217396160 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
- - - ~>
41
+ - - ! '>='
42
42
  - !ruby/object:Gem::Version
43
- version: 1.1.1
43
+ version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70187287655840
46
+ version_requirements: *70203217396160
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: eventmachine
49
- requirement: &70187287655260 !ruby/object:Gem::Requirement
49
+ requirement: &70203217395540 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
- - - ~>
52
+ - - ! '>='
53
53
  - !ruby/object:Gem::Version
54
- version: 1.0.0.beta.4
54
+ version: '0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70187287655260
57
+ version_requirements: *70203217395540
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: em-http-request
60
- requirement: &70187287654660 !ruby/object:Gem::Requirement
60
+ requirement: &70203217395000 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
- - - ~>
63
+ - - ! '>='
64
64
  - !ruby/object:Gem::Version
65
- version: 1.0.2
65
+ version: '0'
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *70187287654660
68
+ version_requirements: *70203217395000
69
69
  description: An extremely fast and convenient riak client for eventmachine.
70
70
  email: von@vonstark.co
71
71
  executables: []
@@ -85,9 +85,15 @@ files:
85
85
  - lib/em-riak/grapher.rb
86
86
  - lib/em-riak/luwak.rb
87
87
  - lib/em-riak/map_reduce.rb
88
+ - lib/em-riak/model.rb
88
89
  - lib/em-riak/secondary_index.rb
89
90
  - lib/em-riak/utils.rb
90
91
  - lib/em-riak/version.rb
92
+ - spec/unit/all.rb
93
+ - spec/unit/basic.rb
94
+ - spec/unit/core.rb
95
+ - spec/unit/map_reduce.rb
96
+ - spec/unit/secondary_index.rb
91
97
  homepage: http://tech.vonstark.co
92
98
  licenses: []
93
99
  post_install_message: