boss-protocol 0.1.2 → 0.1.3
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.
- data/lib/boss-protocol/version.rb +1 -1
- data/lib/boss-protocol.rb +1 -0
- data/spec/boss_spec.rb +28 -0
- metadata +2 -2
data/lib/boss-protocol.rb
CHANGED
data/spec/boss_spec.rb
CHANGED
@@ -101,6 +101,30 @@ describe 'Boss' do
|
|
101
101
|
round_check root
|
102
102
|
end
|
103
103
|
|
104
|
+
it 'shold encode hash/array ancestors too' do
|
105
|
+
class MyHash < Hash
|
106
|
+
def []= k, v
|
107
|
+
super k.to_s, v.to_s
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
class MyArray < Array
|
112
|
+
def []= i, val
|
113
|
+
super i.to_i, val.to_s
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
h = MyHash.new
|
118
|
+
h[:one] = 1
|
119
|
+
h[:two] = 2
|
120
|
+
round_check h
|
121
|
+
|
122
|
+
a = MyArray.new
|
123
|
+
a["0"] = :zero
|
124
|
+
a["1"] = :one
|
125
|
+
round_check a
|
126
|
+
|
127
|
+
end
|
104
128
|
|
105
129
|
it 'should effectively compress/decompress' do
|
106
130
|
# No compression
|
@@ -123,6 +147,10 @@ describe 'Boss' do
|
|
123
147
|
#x2.length.should < 13700
|
124
148
|
end
|
125
149
|
|
150
|
+
it 'should raise proper error' do
|
151
|
+
class MyObject; end
|
152
|
+
-> { Boss.dump MyObject.new }.should raise_error(Boss::NotSupportedException)
|
153
|
+
end
|
126
154
|
|
127
155
|
def round_check(ob)
|
128
156
|
ob.should == Boss.load(Boss.dump(ob))
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: boss-protocol
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
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-03-
|
12
|
+
date: 2013-03-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|