kosher 0.1.11 → 0.1.12
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/kosher/struct.rb +15 -0
- data/lib/kosher/version.rb +1 -1
- data/lib/kosher.rb +1 -0
- data/spec/kosher/item_spec.rb +4 -0
- data/spec/kosher/struct_spec.rb +28 -0
- metadata +4 -1
data/lib/kosher/version.rb
CHANGED
data/lib/kosher.rb
CHANGED
data/spec/kosher/item_spec.rb
CHANGED
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Kosher
|
4
|
+
describe Struct do
|
5
|
+
before(:all) do
|
6
|
+
class Foo < Struct.new(:bar); end
|
7
|
+
end
|
8
|
+
|
9
|
+
describe "to_json" do
|
10
|
+
it "converts to JSON" do
|
11
|
+
foo = Foo.new
|
12
|
+
foo.bar = 1
|
13
|
+
|
14
|
+
foo.to_json.should eql "{\"bar\":1}"
|
15
|
+
end
|
16
|
+
|
17
|
+
it "handles nested structs" do
|
18
|
+
foo_1 = Foo.new
|
19
|
+
foo_2 = Foo.new
|
20
|
+
|
21
|
+
foo_2.bar = 1
|
22
|
+
foo_1.bar = foo_2
|
23
|
+
|
24
|
+
foo_1.to_json.should eql "{\"bar\":{\"bar\":1}}"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: kosher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.1.
|
5
|
+
version: 0.1.12
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Paper Cavalier
|
@@ -114,6 +114,7 @@ files:
|
|
114
114
|
- lib/kosher/offer.rb
|
115
115
|
- lib/kosher/request.rb
|
116
116
|
- lib/kosher/seller.rb
|
117
|
+
- lib/kosher/struct.rb
|
117
118
|
- lib/kosher/version.rb
|
118
119
|
- spec/fabricators/condition_fabricator.rb
|
119
120
|
- spec/fabricators/offer_fabricator.rb
|
@@ -127,6 +128,7 @@ files:
|
|
127
128
|
- spec/kosher/offer_spec.rb
|
128
129
|
- spec/kosher/request_spec.rb
|
129
130
|
- spec/kosher/seller_spec.rb
|
131
|
+
- spec/kosher/struct_spec.rb
|
130
132
|
- spec/spec_helper.rb
|
131
133
|
- spec/support/credentials.rb
|
132
134
|
- spec/support/faker.rb
|
@@ -173,6 +175,7 @@ test_files:
|
|
173
175
|
- spec/kosher/offer_spec.rb
|
174
176
|
- spec/kosher/request_spec.rb
|
175
177
|
- spec/kosher/seller_spec.rb
|
178
|
+
- spec/kosher/struct_spec.rb
|
176
179
|
- spec/spec_helper.rb
|
177
180
|
- spec/support/credentials.rb
|
178
181
|
- spec/support/faker.rb
|