active_node 0.0.4 → 0.0.5
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/.gitignore
CHANGED
data/lib/active_node/version.rb
CHANGED
@@ -37,6 +37,16 @@ describe ActiveNode::Associations do
|
|
37
37
|
client.user_ids.should be_empty
|
38
38
|
end
|
39
39
|
|
40
|
+
it "returns nil on a has_one association for a brand spanking new model object" do
|
41
|
+
person = Person.new
|
42
|
+
person.father.should be_nil
|
43
|
+
end
|
44
|
+
|
45
|
+
it "returns nil on a has_one association where nothing is associated" do
|
46
|
+
person = Person.create!
|
47
|
+
person.father.should be_nil
|
48
|
+
end
|
49
|
+
|
40
50
|
it "can remove some of the associated objects" do
|
41
51
|
child1 = Person.create!
|
42
52
|
child2 = Person.create!
|
@@ -82,9 +92,16 @@ describe ActiveNode::Associations do
|
|
82
92
|
father.children.should == [child]
|
83
93
|
end
|
84
94
|
|
95
|
+
it "can access new association without being saved" do
|
96
|
+
father = Person.create!
|
97
|
+
child = Person.new
|
98
|
+
child.father = father
|
99
|
+
child.father.should == father
|
100
|
+
end
|
101
|
+
|
85
102
|
it 'can handle has_one reverse relationship' do
|
86
103
|
father = Person.create!(children: [Person.create!])
|
87
104
|
father.children.first.father.should == father
|
88
105
|
end
|
89
106
|
end
|
90
|
-
end
|
107
|
+
end
|
@@ -31,6 +31,11 @@ describe ActiveNode::Persistence do
|
|
31
31
|
it "should persist attributes" do
|
32
32
|
Person.create!(name: 'abc').name.should == 'abc'
|
33
33
|
end
|
34
|
+
|
35
|
+
it "should persist array properties" do
|
36
|
+
person = Person.create!(multi: [1, 2, 3])
|
37
|
+
Person.find(person.id).multi.should == [1, 2, 3]
|
38
|
+
end
|
34
39
|
end
|
35
40
|
|
36
41
|
describe "#attributes" do
|
data/spec/models/person.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_node
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
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-10-
|
12
|
+
date: 2013-10-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: active_attr
|