ccp 0.4.3 → 0.4.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/ccp/kvs/core.rb +1 -0
- data/lib/ccp/kvs/hash.rb +1 -0
- data/lib/ccp/kvs/kch.rb +1 -0
- data/lib/ccp/kvs/kyoto/cabinet.rb +5 -0
- data/lib/ccp/kvs/tch.rb +1 -0
- data/lib/ccp/kvs/tokyo/cabinet.rb +5 -0
- data/lib/ccp/receivers/aroundable.rb +1 -0
- data/lib/ccp/version.rb +1 -1
- data/spec/kvs/kvs_spec.rb +12 -0
- data/spec/receivers/aroundable_spec.rb +43 -0
- metadata +3 -2
data/lib/ccp/kvs/core.rb
CHANGED
data/lib/ccp/kvs/hash.rb
CHANGED
data/lib/ccp/kvs/kch.rb
CHANGED
data/lib/ccp/kvs/tch.rb
CHANGED
data/lib/ccp/version.rb
CHANGED
data/spec/kvs/kvs_spec.rb
CHANGED
@@ -94,6 +94,18 @@ Ccp::Kvs.each do |klass|
|
|
94
94
|
end
|
95
95
|
end
|
96
96
|
|
97
|
+
describe "#clear" do
|
98
|
+
specify do
|
99
|
+
kvs.touch
|
100
|
+
kvs.codec! :json
|
101
|
+
kvs.write("a"=>1)
|
102
|
+
kvs["a"].should == 1
|
103
|
+
kvs.clear
|
104
|
+
kvs.count.should == 0
|
105
|
+
kvs.read.should == {}
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
97
109
|
describe "#codec!" do
|
98
110
|
specify "return self" do
|
99
111
|
kvs.codec!(:msgpack).should == kvs
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Ccp::Receivers::Aroundable do
|
4
|
+
class AroundableTestOk < Cmd1
|
5
|
+
def execute
|
6
|
+
# NOP
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
class AroundableTestNg < Cmd1
|
11
|
+
def execute
|
12
|
+
raise "some error"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
let(:options) { {:breadcrumbs => []} }
|
17
|
+
let(:program) { raise "program not set" }
|
18
|
+
let(:receiver) { Ccp::Receivers::Base.new }
|
19
|
+
let(:data) { receiver.data }
|
20
|
+
|
21
|
+
def execute
|
22
|
+
data[:breadcrumbs] = []
|
23
|
+
program.execute(:receiver => receiver)
|
24
|
+
end
|
25
|
+
|
26
|
+
describe "#execute" do
|
27
|
+
context "(success)" do
|
28
|
+
let(:program) { AroundableTestOk }
|
29
|
+
it "should call before, after" do
|
30
|
+
lambda { execute }.should_not raise_error
|
31
|
+
data[:breadcrumbs].should == ["AroundableTestOk#before", "AroundableTestOk#after"]
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
context "(error)" do
|
36
|
+
let(:program) { AroundableTestNg }
|
37
|
+
it "should call before, after" do
|
38
|
+
lambda { execute }.should raise_error("some error")
|
39
|
+
data[:breadcrumbs].should == ["AroundableTestNg#before", "AroundableTestNg#after"]
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ccp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-12-
|
12
|
+
date: 2013-12-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -293,6 +293,7 @@ files:
|
|
293
293
|
- spec/persistent/loadable_spec.rb
|
294
294
|
- spec/persistent/tsv_spec.rb
|
295
295
|
- spec/persistent/versioned_spec.rb
|
296
|
+
- spec/receivers/aroundable_spec.rb
|
296
297
|
- spec/receivers/fixture_msgpack_spec.rb
|
297
298
|
- spec/receivers/fixture_save_how_spec.rb
|
298
299
|
- spec/receivers/fixture_save_ignore_logger_spec.rb
|