boss-protocol 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  module Boss
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
data/lib/boss-protocol.rb CHANGED
@@ -51,6 +51,7 @@ require 'zlib'
51
51
 
52
52
  module Boss
53
53
 
54
+ class NotSupportedException < StandardError; end
54
55
  # Basic types
55
56
  TYPE_INT = 0
56
57
  TYPE_EXTRA = 1
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.2
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-25 00:00:00.000000000 Z
12
+ date: 2013-03-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec