active_mocker 1.7.beta2 → 1.7.beta3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/active_mocker/mock/base.rb +2 -2
- data/lib/active_mocker/mock_template.erb +10 -10
- data/lib/active_mocker/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 568d05ab028a0dd5e561ec9933bd905922671944
|
4
|
+
data.tar.gz: 432288a414d9024b74e16631f3727544431dc2c0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b5b5f4833d9d294e872c8c3087eb1d2752ecc5fad1cf98a25a9b380e546f68ecd9e46100fc87b16048783913b4eb63d727aa3a1a992b2808033f68693a3a2c7
|
7
|
+
data.tar.gz: 6d47573531aa806f71e1cc37cb2886ede715aafdb6f3c4b1f0614711bcb8ad0bbbec533b46ffb22867357466ce4a9e8cef589828c557ea81ae3ce910e63c227e
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# Changelog
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
|
+
## 1.7.beta3 - 2-14-09-25
|
4
|
+
|
5
|
+
### Fix
|
6
|
+
- Last beta introduced a breaking regression where after assigning some associations they could not be read. Solution was to never access @associations directly inside mock.
|
7
|
+
|
3
8
|
## 1.7.beta2 - 2-14-09-18
|
4
9
|
|
5
10
|
### Fix
|
@@ -54,10 +54,10 @@ class <%= class_name + @mock_append_name %> < <%= parent_class %>
|
|
54
54
|
end
|
55
55
|
|
56
56
|
def <%= meth.name %>=(val)
|
57
|
-
<% association = belongs_to_foreign_key(meth.name)
|
57
|
+
<% association = belongs_to_foreign_key(meth.name) -%>
|
58
58
|
write_attribute(:<%= meth.name %>, val)
|
59
59
|
<% if association -%>
|
60
|
-
association = classes('<%= association.class_name %>').try(:find_by, id: <%= meth.name
|
60
|
+
association = classes('<%= association.class_name %>').try(:find_by, id: <%= meth.name %>)
|
61
61
|
write_association(:<%= association.name %>,association) unless association.nil?
|
62
62
|
<% end -%>
|
63
63
|
end
|
@@ -69,11 +69,11 @@ class <%= class_name + @mock_append_name %> < <%= parent_class %>
|
|
69
69
|
<%= '# belongs_to' unless belongs_to.empty? -%>
|
70
70
|
<% belongs_to.each do |meth| %>
|
71
71
|
def <%= meth.name %>
|
72
|
-
|
72
|
+
read_association(:<%= meth.name %>)
|
73
73
|
end
|
74
74
|
|
75
75
|
def <%= meth.name %>=(val)
|
76
|
-
|
76
|
+
write_association(:<%= meth.name %>, val)
|
77
77
|
ActiveMocker::Mock::BelongsTo.new(val, child_self: self, foreign_key: :<%= meth.foreign_key %>, foreign_id: val.try(:id)).item
|
78
78
|
end
|
79
79
|
|
@@ -101,8 +101,8 @@ class <%= class_name + @mock_append_name %> < <%= parent_class %>
|
|
101
101
|
end
|
102
102
|
|
103
103
|
def <%= meth.name %>=(val)
|
104
|
-
|
105
|
-
ActiveMocker::Mock::HasOne.new(val, child_self: self, foreign_key: '<%= meth.foreign_key %>', foreign_id:
|
104
|
+
write_association(:<%= meth.name %>, val)
|
105
|
+
ActiveMocker::Mock::HasOne.new(val, child_self: self, foreign_key: '<%= meth.foreign_key %>', foreign_id: self.id).item
|
106
106
|
end
|
107
107
|
|
108
108
|
def build_<%= meth.name %>(attributes={}, &block)
|
@@ -124,21 +124,21 @@ class <%= class_name + @mock_append_name %> < <%= parent_class %>
|
|
124
124
|
<%= '# has_many' unless has_many.empty? -%>
|
125
125
|
<% has_many.each do |meth| %>
|
126
126
|
def <%= meth.name %>
|
127
|
-
|
127
|
+
read_association(:<%= meth.name %>, ActiveMocker::Mock::HasMany.new([],foreign_key: '<%= meth.foreign_key %>', foreign_id: self.id, relation_class: classes('<%= meth.class_name %>'), source: '<%= meth.source %>'))
|
128
128
|
end
|
129
129
|
|
130
130
|
def <%= meth.name %>=(val)
|
131
|
-
|
131
|
+
write_association(:<%= meth.name %>, ActiveMocker::Mock::HasMany.new(val, foreign_key: '<%= meth.foreign_key %>', foreign_id: self.id, relation_class: classes('<%= meth.class_name %>'), source: '<%= meth.source %>'))
|
132
132
|
end
|
133
133
|
<% end -%>
|
134
134
|
<%= '# has_and_belongs_to_many' unless has_and_belongs_to_many.empty? -%>
|
135
135
|
<% has_and_belongs_to_many.each do |meth| %>
|
136
136
|
def <%= meth.name %>
|
137
|
-
|
137
|
+
read_association(:<%= meth.name %>, ActiveMocker::Mock::HasAndBelongsToMany.new([]))
|
138
138
|
end
|
139
139
|
|
140
140
|
def <%= meth.name %>=(val)
|
141
|
-
|
141
|
+
write_association(:<%= meth.name %>, ActiveMocker::Mock::HasAndBelongsToMany.new(val))
|
142
142
|
end
|
143
143
|
<% end -%>
|
144
144
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_mocker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.7.
|
4
|
+
version: 1.7.beta3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dustin Zeisler
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-09-
|
11
|
+
date: 2014-09-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|