abstractivator 0.0.30 → 0.0.31

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 34a14dfa085d8a1a7a5d462a509deed9424a9e35
4
- data.tar.gz: 511e2fd85e5ab1a828c21f0ca252a3ca686bbb14
3
+ metadata.gz: e21da1a080a716ba7807d66781ef4c0cb8bcee6a
4
+ data.tar.gz: 77814c5cff83133dac82c76758e568bc6d1055a9
5
5
  SHA512:
6
- metadata.gz: f503ac9376e4705618872262a237cb87cfd73fbe0063a7637451d1ad2e9cf5ce5ef556a688819ebaa7c1dc1beec22f8bdeb15ab620ce2d30a89e688196fbf942
7
- data.tar.gz: 6ca46af5ec6309781d3b569a555b72325f8b2b98eabacc0f8b5864eca3cb1bff7d9eaa486832663c2c17296e1c05daab43d9252f5e19d18051f5022729c0dc43
6
+ metadata.gz: 89ae1ba1cbd05b247c480256cb132d8f2e50784e42355cb3fb2802f06e1c7f25f36d6d8e11d839079a322460edde3ed6368df3f44c186efb4f3d915097792b59
7
+ data.tar.gz: 751e1e23feda00161a008f5674fefd3ace2ee128647fb9bf7523097d2bf2e8fa67fdba899e8bc2f8137634b0cbc9217b4ea756c22016b135026ca79d152f3429
@@ -15,6 +15,14 @@ module Enum
15
15
  end
16
16
  alias_method :to_s, :inspect
17
17
 
18
+ def as_json(_opts={})
19
+ value.as_json
20
+ end
21
+
22
+ def to_json
23
+ value.to_json
24
+ end
25
+
18
26
  def self.included(base)
19
27
  base.extend ClassMethods
20
28
  end
@@ -1,3 +1,3 @@
1
1
  module Abstractivator
2
- VERSION = '0.0.30'
2
+ VERSION = '0.0.31'
3
3
  end
@@ -50,6 +50,20 @@ describe Enum do
50
50
  expect{Container::Fruits.new('durian')}.to raise_error NoMethodError
51
51
  end
52
52
  end
53
+ describe '#as_json' do
54
+ it "as_json's the value" do
55
+ hash = double
56
+ expect(Meats::BACON.value).to receive(:as_json).and_return(hash)
57
+ expect(Meats::BACON.as_json).to eql hash
58
+ end
59
+ end
60
+ describe '#to_json' do
61
+ it "to_json's the value" do
62
+ json = double
63
+ expect(Meats::BACON.value).to receive(:to_json).and_return(json)
64
+ expect(Meats::BACON.to_json).to eql json
65
+ end
66
+ end
53
67
  end
54
68
 
55
69
  describe '#define_enum' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: abstractivator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.30
4
+ version: 0.0.31
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Winton