ar_doc_store 0.0.4 → 0.0.5

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: f53b88c6de1ed3b89140686a6322e0e657019fb4
4
- data.tar.gz: 27633939568dfd0e2534e7c7fbd588fd8fec4521
3
+ metadata.gz: 8976a8f0c31fe24e9670d9cb702c42e2e6bc2dab
4
+ data.tar.gz: f4cd0ed1f6623495a63a211b4d435b3541ac2594
5
5
  SHA512:
6
- metadata.gz: 9c7f66c471005f5ad2777203e864019452c855018010becb66300aa2c0c6f6ed065785362fae8da98f96fe4a7e9c829e74a93d0732cd23d608d5d1b97a4426b7
7
- data.tar.gz: 1c7540f9d60c030368a27d253cacca11ee8ac2187acefa43404de7f4a0bb3ef8c12952fcb2e73dae9f71075bb6ab876e5452aa4db5f1692eb2edbbb7daab7c02
6
+ metadata.gz: 015565bb5727c8156169edde09e3155cdb59f95907244e1d25821f36897ed0503669a3370c34891cfb12beaf6423c2513d4de0ab7732428e963e93d61250b132
7
+ data.tar.gz: 551012c6c8a78f4cc5378213073743637de2c99b2d2f84acedffbe7231bd7a5ceca47dc73f94ee602199ab23293e670b790dda8a3fbf5795a16f2eb396276241
@@ -8,16 +8,8 @@ module ArDocStore
8
8
  attr_accessor :_destroy
9
9
  attr_accessor :attributes
10
10
 
11
- @virtual_attributes = HashWithIndifferentAccess.new
12
-
13
- def self.virtual_attributes; @virtual_attributes; end
14
- def self.virtual_attributes=(value); @virtual_attributes=value; end
15
- def virtual_attributes; self.class.virtual_attributes; end
16
-
17
- @columns_hash = HashWithIndifferentAccess.new
18
- def self.columns_hash; @columns_hash; end
19
- def self.columns_hash=(value); @columns_hash=value; end
20
- def columns_hash; self.class.columns_hash; end
11
+ class_attribute :virtual_attributes
12
+ self.virtual_attributes ||= HashWithIndifferentAccess.new
21
13
 
22
14
  delegate :as_json, to: :attributes
23
15
 
@@ -1,3 +1,3 @@
1
1
  module ArDocStore
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -29,5 +29,15 @@ class EmbeddingTest < MiniTest::Test
29
29
  b.restrooms << r
30
30
  assert !b.valid?
31
31
  end
32
-
32
+
33
+ def test_model_with_no_attributes
34
+ item = ThingWithEmptyModel.new
35
+ item.build_empty_model
36
+ assert item.empty_model.is_a?(EmptyModel)
37
+ end
38
+
39
+ def test_model_subclassing
40
+ assert_equal EmbeddableB.virtual_attributes.size, 2
41
+ end
42
+
33
43
  end
data/test/test_helper.rb CHANGED
@@ -63,7 +63,25 @@ class ARDuck
63
63
  def self.columns_hash
64
64
  @@columns_hash ||= HashWithIndifferentAccess.new
65
65
  end
66
-
66
+
67
+ end
68
+
69
+ class EmptyModel
70
+ include ArDocStore::EmbeddableModel
71
+ end
72
+
73
+ class ThingWithEmptyModel < ARDuck
74
+ include ArDocStore::Model
75
+ embeds_one :empty_model
76
+ end
77
+
78
+ class EmbeddableA < ARDuck
79
+ include ArDocStore::EmbeddableModel
80
+ attribute :name
81
+ end
82
+
83
+ class EmbeddableB < EmbeddableA
84
+ attribute :gender
67
85
  end
68
86
 
69
87
  class Dimensions
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ar_doc_store
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Furber
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-20 00:00:00.000000000 Z
11
+ date: 2015-02-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord