restforce-db 1.2.4 → 1.2.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: 917ef8bd6976aa2326f55c577f57a29ba7569487
4
- data.tar.gz: 595a0501e51ac8f258137446db9d14a22b1b266d
3
+ metadata.gz: 36ac82d6b0fe9d4374bfe7ee11b60fd36278b4ba
4
+ data.tar.gz: 934bdb3ef457e51ac31bc1a80e101f789f803bf2
5
5
  SHA512:
6
- metadata.gz: bb1d74b767dcf8d6a831f7504ab1de8a3234a592402fb008edc2e7880d186df5a4080e7da7cf30752217917ddb769071fe589cbe5f8746cc07abdb3dac45b8f6
7
- data.tar.gz: 07002a8559cc853ec102b547d1790240144f3943ed9ccce636455edae230fe624f521757d0710b6766fbceeeec6a096b93be73c520cf46664cf10228e4cbd0c4
6
+ metadata.gz: ad9bea1820a4bfc48caa95dfbaf24860a3564a69d9d7598eae02478c98a764f9252273495e51a48a897c3466b0281a13b4bb95596567fa17f5145eace8ea9ca1
7
+ data.tar.gz: 21188a40abaef043ada3c41bf197e1da4b4502e516e980e89fe9001d0f710dffd0170fcb7846aa1f0feba121e88fc1614124f60e2a0e9c419ed6f562b02f0c86
@@ -55,19 +55,40 @@ module Restforce
55
55
 
56
56
  private
57
57
 
58
- # Internal: Get the appropriate Salesforce Lookup ID field for the
59
- # passed mapping.
58
+ # Internal: Get a list of all newly-constructed records based on this
59
+ # association, for a set of lookups.
60
60
  #
61
- # mapping - A Restforce::DB::Mapping.
62
61
  # database_record - An instance of an ActiveRecord::Base subclass.
63
- #
64
- # Returns a String or nil.
65
- def lookup_field(mapping, database_record)
66
- inverse = inverse_association_name(target_reflection(database_record))
67
- association = mapping.associations.detect { |a| a.name == inverse }
68
- return unless association
62
+ # lookups - A Hash mapping database columns to Salesforce IDs.
63
+ # attributes - A Hash of attributes to assign to the new record.
64
+ #
65
+ # Yields the new database record if one is built.
66
+ # Returns an Array containing all newly-constructed records.
67
+ def constructed_records(database_record, lookups, attributes)
68
+ associated = target_class(database_record).find_by(lookups)
69
+
70
+ # If the association record already exists, we don't need to build out
71
+ # associations any further.
72
+ if associated
73
+ database_record.association(name).send(construction_method, associated)
74
+ return []
75
+ end
76
+
77
+ associated ||= database_record.association(name).build(lookups)
78
+ associated.assign_attributes(attributes)
79
+
80
+ nested = yield associated if block_given?
69
81
 
70
- association.lookup
82
+ [associated, *nested]
83
+ end
84
+
85
+ # Internal: Get the method by which an associated record should be
86
+ # assigned to this record. Defaults to :writer, which overwrites the
87
+ # existing association, if one exists.
88
+ #
89
+ # Returns a Symbol.
90
+ def construction_method
91
+ :writer
71
92
  end
72
93
 
73
94
  # Internal: Get the class of the inverse ActiveRecord association.
@@ -126,16 +147,6 @@ module Restforce
126
147
  end
127
148
  end
128
149
 
129
- # Internal: Get an ActiveRecord::Relation scope for the passed record's
130
- # association.
131
- #
132
- # database_record - An instance of an ActiveRecord::Base subclass.
133
- #
134
- # Returns an ActiveRecord scope.
135
- def association_scope(database_record)
136
- database_record.association(name).scope
137
- end
138
-
139
150
  # Internal: Construct all associated records for the passed database
140
151
  # record, based on the mapping represented by the passed Salesforce
141
152
  # instance.
@@ -35,13 +35,9 @@ module Restforce
35
35
  attributes = attributes.merge(attrs)
36
36
  end
37
37
 
38
- associated = association_scope(database_record).find_by(lookups)
39
- associated ||= database_record.association(name).build(lookups)
40
-
41
- associated.assign_attributes(attributes)
42
- nested = instances.flat_map { |i| nested_records(database_record, associated, i) }
43
-
44
- [associated, *nested]
38
+ constructed_records(database_record, lookups, attributes) do |associated|
39
+ instances.flat_map { |i| nested_records(database_record, associated, i) }
40
+ end
45
41
  end
46
42
 
47
43
  private
@@ -75,6 +71,21 @@ module Restforce
75
71
  salesforce_instance.record[inverse_association.lookup] if salesforce_instance
76
72
  end
77
73
 
74
+ # Internal: Get the appropriate Salesforce Lookup ID field for the
75
+ # passed mapping.
76
+ #
77
+ # mapping - A Restforce::DB::Mapping.
78
+ # database_record - An instance of an ActiveRecord::Base subclass.
79
+ #
80
+ # Returns a String or nil.
81
+ def lookup_field(mapping, database_record)
82
+ inverse = inverse_association_name(target_reflection(database_record))
83
+ association = mapping.associations.detect { |a| a.name == inverse }
84
+ return unless association
85
+
86
+ association.lookup
87
+ end
88
+
78
89
  end
79
90
 
80
91
  end
@@ -43,16 +43,15 @@ module Restforce
43
43
  def construct_for(database_record, salesforce_instance)
44
44
  mapping = salesforce_instance.mapping
45
45
  lookups = { mapping.lookup_column => salesforce_instance.id }
46
- associated = association_scope(database_record).find_by(lookups)
47
- associated ||= database_record.association(name).build(lookups)
48
46
 
49
47
  attributes = mapping.convert(
50
- associated.class,
48
+ mapping.database_model,
51
49
  salesforce_instance.attributes,
52
50
  )
53
51
 
54
- associated.assign_attributes(attributes)
55
- [associated, *nested_records(database_record, associated, salesforce_instance)]
52
+ constructed_records(database_record, lookups, attributes) do |associated|
53
+ nested_records(database_record, associated, salesforce_instance)
54
+ end
56
55
  end
57
56
 
58
57
  # Internal: Get the Salesforce ID belonging to the associated record
@@ -18,7 +18,7 @@ module Restforce
18
18
  # Returns an Array of constructed association records.
19
19
  def build(database_record, salesforce_record)
20
20
  target = target_mapping(database_record)
21
- lookup_id = "#{lookup_field(target, database_record)} = '#{salesforce_record.Id}'"
21
+ lookup_id = "#{lookup} = '#{salesforce_record.Id}'"
22
22
 
23
23
  records = []
24
24
  target.salesforce_record_type.each(conditions: lookup_id) do |instance|
@@ -28,6 +28,17 @@ module Restforce
28
28
  records.flatten
29
29
  end
30
30
 
31
+ private
32
+
33
+ # Internal: Get the method by which an associated record should be
34
+ # assigned to this record. Replaces :writer with :concat, which appends
35
+ # records to an existing association, rather than replacing it.
36
+ #
37
+ # Returns a Symbol.
38
+ def construction_method
39
+ :concat
40
+ end
41
+
31
42
  end
32
43
 
33
44
  end
@@ -18,7 +18,7 @@ module Restforce
18
18
  # Returns an Array of constructed association records.
19
19
  def build(database_record, salesforce_record)
20
20
  target = target_mapping(database_record)
21
- query = "#{lookup_field(target, database_record)} = '#{salesforce_record.Id}'"
21
+ query = "#{lookup} = '#{salesforce_record.Id}'"
22
22
 
23
23
  instance = target.salesforce_record_type.first(query)
24
24
  instance ? construct_for(database_record, instance) : []
@@ -3,7 +3,7 @@ module Restforce
3
3
  # :nodoc:
4
4
  module DB
5
5
 
6
- VERSION = "1.2.4"
6
+ VERSION = "1.2.5"
7
7
 
8
8
  end
9
9
 
@@ -0,0 +1,271 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://<host>/services/oauth2/token
6
+ body:
7
+ encoding: US-ASCII
8
+ string: grant_type=password&client_id=<client_id>&client_secret=<client_secret>&username=<username>&password=<password><security_token>
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.9.1
12
+ Content-Type:
13
+ - application/x-www-form-urlencoded
14
+ Accept-Encoding:
15
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
16
+ Accept:
17
+ - "*/*"
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ Date:
24
+ - Thu, 23 Apr 2015 17:33:14 GMT
25
+ Set-Cookie:
26
+ - BrowserId=OrIb41RKR1mxYX5PD2RcFQ;Path=/;Domain=.salesforce.com;Expires=Mon,
27
+ 22-Jun-2015 17:33:14 GMT
28
+ Expires:
29
+ - Thu, 01 Jan 1970 00:00:00 GMT
30
+ Pragma:
31
+ - no-cache
32
+ Cache-Control:
33
+ - no-cache, no-store
34
+ Content-Type:
35
+ - application/json;charset=UTF-8
36
+ Transfer-Encoding:
37
+ - chunked
38
+ body:
39
+ encoding: ASCII-8BIT
40
+ string: '{"id":"https://login.salesforce.com/id/00D1a000000H3O9EAK/0051a000000UGT8AAO","issued_at":"1429810394922","token_type":"Bearer","instance_url":"https://<host>","signature":"qD5Hnlij9mqvLquOno/CQKE+/oNFSOhawRLJvX4MVpE=","access_token":"00D1a000000H3O9!AQ4AQFoglftCDJPkzXd0wAZ6dnUwrMZEyIrpgn8BUhjwsElswNHT_M5IOJSysNJCZXw6QPBjjHcAYLoUX8bFjnXkaUCdvO1l"}'
41
+ http_version:
42
+ recorded_at: Thu, 23 Apr 2015 17:33:15 GMT
43
+ - request:
44
+ method: post
45
+ uri: https://<host>/services/data/v26.0/sobjects/Contact
46
+ body:
47
+ encoding: UTF-8
48
+ string: '{"Email":"somebody@example.com","LastName":"Somebody"}'
49
+ headers:
50
+ User-Agent:
51
+ - Faraday v0.9.1
52
+ Content-Type:
53
+ - application/json
54
+ Authorization:
55
+ - OAuth 00D1a000000H3O9!AQ4AQFoglftCDJPkzXd0wAZ6dnUwrMZEyIrpgn8BUhjwsElswNHT_M5IOJSysNJCZXw6QPBjjHcAYLoUX8bFjnXkaUCdvO1l
56
+ Accept-Encoding:
57
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
58
+ Accept:
59
+ - "*/*"
60
+ response:
61
+ status:
62
+ code: 201
63
+ message: Created
64
+ headers:
65
+ Date:
66
+ - Thu, 23 Apr 2015 17:33:15 GMT
67
+ Set-Cookie:
68
+ - BrowserId=LGloqy6ATQSeJz9TIl9ohg;Path=/;Domain=.salesforce.com;Expires=Mon,
69
+ 22-Jun-2015 17:33:15 GMT
70
+ Expires:
71
+ - Thu, 01 Jan 1970 00:00:00 GMT
72
+ Sforce-Limit-Info:
73
+ - api-usage=13/15000
74
+ Location:
75
+ - "/services/data/v26.0/sobjects/Contact/0031a000002fBHlAAM"
76
+ Content-Type:
77
+ - application/json;charset=UTF-8
78
+ Transfer-Encoding:
79
+ - chunked
80
+ body:
81
+ encoding: ASCII-8BIT
82
+ string: '{"id":"0031a000002fBHlAAM","success":true,"errors":[]}'
83
+ http_version:
84
+ recorded_at: Thu, 23 Apr 2015 17:33:16 GMT
85
+ - request:
86
+ method: post
87
+ uri: https://<host>/services/data/v26.0/sobjects/CustomObject__c
88
+ body:
89
+ encoding: UTF-8
90
+ string: '{"Friend__c":"0031a000002fBHlAAM"}'
91
+ headers:
92
+ User-Agent:
93
+ - Faraday v0.9.1
94
+ Content-Type:
95
+ - application/json
96
+ Authorization:
97
+ - OAuth 00D1a000000H3O9!AQ4AQFoglftCDJPkzXd0wAZ6dnUwrMZEyIrpgn8BUhjwsElswNHT_M5IOJSysNJCZXw6QPBjjHcAYLoUX8bFjnXkaUCdvO1l
98
+ Accept-Encoding:
99
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
100
+ Accept:
101
+ - "*/*"
102
+ response:
103
+ status:
104
+ code: 201
105
+ message: Created
106
+ headers:
107
+ Date:
108
+ - Thu, 23 Apr 2015 17:33:17 GMT
109
+ Set-Cookie:
110
+ - BrowserId=SaqTi4_pTU6Wzn2Bfq6KEg;Path=/;Domain=.salesforce.com;Expires=Mon,
111
+ 22-Jun-2015 17:33:17 GMT
112
+ Expires:
113
+ - Thu, 01 Jan 1970 00:00:00 GMT
114
+ Sforce-Limit-Info:
115
+ - api-usage=13/15000
116
+ Location:
117
+ - "/services/data/v26.0/sobjects/CustomObject__c/a001a000001QmhqAAC"
118
+ Content-Type:
119
+ - application/json;charset=UTF-8
120
+ Transfer-Encoding:
121
+ - chunked
122
+ body:
123
+ encoding: ASCII-8BIT
124
+ string: '{"id":"a001a000001QmhqAAC","success":true,"errors":[]}'
125
+ http_version:
126
+ recorded_at: Thu, 23 Apr 2015 17:33:17 GMT
127
+ - request:
128
+ method: get
129
+ uri: https://<host>/services/data/v26.0/query?q=select%20Id,%20SystemModstamp,%20Name,%20Example_Field__c,%20Friend__c%20from%20CustomObject__c%20where%20Id%20=%20%27a001a000001QmhqAAC%27
130
+ body:
131
+ encoding: US-ASCII
132
+ string: ''
133
+ headers:
134
+ User-Agent:
135
+ - Faraday v0.9.1
136
+ Authorization:
137
+ - OAuth 00D1a000000H3O9!AQ4AQFoglftCDJPkzXd0wAZ6dnUwrMZEyIrpgn8BUhjwsElswNHT_M5IOJSysNJCZXw6QPBjjHcAYLoUX8bFjnXkaUCdvO1l
138
+ Accept-Encoding:
139
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
140
+ Accept:
141
+ - "*/*"
142
+ response:
143
+ status:
144
+ code: 200
145
+ message: OK
146
+ headers:
147
+ Date:
148
+ - Thu, 23 Apr 2015 17:33:18 GMT
149
+ Set-Cookie:
150
+ - BrowserId=_63UXHLGRReEluJDxNNTTg;Path=/;Domain=.salesforce.com;Expires=Mon,
151
+ 22-Jun-2015 17:33:18 GMT
152
+ Expires:
153
+ - Thu, 01 Jan 1970 00:00:00 GMT
154
+ Sforce-Limit-Info:
155
+ - api-usage=13/15000
156
+ Content-Type:
157
+ - application/json;charset=UTF-8
158
+ Transfer-Encoding:
159
+ - chunked
160
+ body:
161
+ encoding: ASCII-8BIT
162
+ string: '{"totalSize":1,"done":true,"records":[{"attributes":{"type":"CustomObject__c","url":"/services/data/v26.0/sobjects/CustomObject__c/a001a000001QmhqAAC"},"Id":"a001a000001QmhqAAC","SystemModstamp":"2015-04-23T17:33:17.000+0000","Name":"a001a000001Qmhq","Example_Field__c":null,"Friend__c":"0031a000002fBHlAAM"}]}'
163
+ http_version:
164
+ recorded_at: Thu, 23 Apr 2015 17:33:18 GMT
165
+ - request:
166
+ method: get
167
+ uri: https://<host>/services/data/v26.0/query?q=select%20Id,%20SystemModstamp,%20Email%20from%20Contact%20where%20Id%20=%20%270031a000002fBHlAAM%27
168
+ body:
169
+ encoding: US-ASCII
170
+ string: ''
171
+ headers:
172
+ User-Agent:
173
+ - Faraday v0.9.1
174
+ Authorization:
175
+ - OAuth 00D1a000000H3O9!AQ4AQFoglftCDJPkzXd0wAZ6dnUwrMZEyIrpgn8BUhjwsElswNHT_M5IOJSysNJCZXw6QPBjjHcAYLoUX8bFjnXkaUCdvO1l
176
+ Accept-Encoding:
177
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
178
+ Accept:
179
+ - "*/*"
180
+ response:
181
+ status:
182
+ code: 200
183
+ message: OK
184
+ headers:
185
+ Date:
186
+ - Thu, 23 Apr 2015 17:33:18 GMT
187
+ Set-Cookie:
188
+ - BrowserId=VITtDGw1SFizllC79xjnpw;Path=/;Domain=.salesforce.com;Expires=Mon,
189
+ 22-Jun-2015 17:33:18 GMT
190
+ Expires:
191
+ - Thu, 01 Jan 1970 00:00:00 GMT
192
+ Sforce-Limit-Info:
193
+ - api-usage=13/15000
194
+ Content-Type:
195
+ - application/json;charset=UTF-8
196
+ Transfer-Encoding:
197
+ - chunked
198
+ body:
199
+ encoding: ASCII-8BIT
200
+ string: '{"totalSize":1,"done":true,"records":[{"attributes":{"type":"Contact","url":"/services/data/v26.0/sobjects/Contact/0031a000002fBHlAAM"},"Id":"0031a000002fBHlAAM","SystemModstamp":"2015-04-23T17:33:16.000+0000","Email":"somebody@example.com"}]}'
201
+ http_version:
202
+ recorded_at: Thu, 23 Apr 2015 17:33:19 GMT
203
+ - request:
204
+ method: delete
205
+ uri: https://<host>/services/data/v26.0/sobjects/Contact/0031a000002fBHlAAM
206
+ body:
207
+ encoding: US-ASCII
208
+ string: ''
209
+ headers:
210
+ User-Agent:
211
+ - Faraday v0.9.1
212
+ Authorization:
213
+ - OAuth 00D1a000000H3O9!AQ4AQFoglftCDJPkzXd0wAZ6dnUwrMZEyIrpgn8BUhjwsElswNHT_M5IOJSysNJCZXw6QPBjjHcAYLoUX8bFjnXkaUCdvO1l
214
+ Accept-Encoding:
215
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
216
+ Accept:
217
+ - "*/*"
218
+ response:
219
+ status:
220
+ code: 204
221
+ message: No Content
222
+ headers:
223
+ Date:
224
+ - Thu, 23 Apr 2015 17:33:19 GMT
225
+ Set-Cookie:
226
+ - BrowserId=g_8s18RQQzKapDhMAJLIOw;Path=/;Domain=.salesforce.com;Expires=Mon,
227
+ 22-Jun-2015 17:33:19 GMT
228
+ Expires:
229
+ - Thu, 01 Jan 1970 00:00:00 GMT
230
+ Sforce-Limit-Info:
231
+ - api-usage=13/15000
232
+ body:
233
+ encoding: UTF-8
234
+ string: ''
235
+ http_version:
236
+ recorded_at: Thu, 23 Apr 2015 17:33:20 GMT
237
+ - request:
238
+ method: delete
239
+ uri: https://<host>/services/data/v26.0/sobjects/CustomObject__c/a001a000001QmhqAAC
240
+ body:
241
+ encoding: US-ASCII
242
+ string: ''
243
+ headers:
244
+ User-Agent:
245
+ - Faraday v0.9.1
246
+ Authorization:
247
+ - OAuth 00D1a000000H3O9!AQ4AQFoglftCDJPkzXd0wAZ6dnUwrMZEyIrpgn8BUhjwsElswNHT_M5IOJSysNJCZXw6QPBjjHcAYLoUX8bFjnXkaUCdvO1l
248
+ Accept-Encoding:
249
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
250
+ Accept:
251
+ - "*/*"
252
+ response:
253
+ status:
254
+ code: 204
255
+ message: No Content
256
+ headers:
257
+ Date:
258
+ - Thu, 23 Apr 2015 17:33:21 GMT
259
+ Set-Cookie:
260
+ - BrowserId=_83pmWlQSA67o0QhpVdJNQ;Path=/;Domain=.salesforce.com;Expires=Mon,
261
+ 22-Jun-2015 17:33:21 GMT
262
+ Expires:
263
+ - Thu, 01 Jan 1970 00:00:00 GMT
264
+ Sforce-Limit-Info:
265
+ - api-usage=13/15000
266
+ body:
267
+ encoding: UTF-8
268
+ string: ''
269
+ http_version:
270
+ recorded_at: Thu, 23 Apr 2015 17:33:21 GMT
271
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,439 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://<host>/services/oauth2/token
6
+ body:
7
+ encoding: US-ASCII
8
+ string: grant_type=password&client_id=<client_id>&client_secret=<client_secret>&username=<username>&password=<password><security_token>
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.9.1
12
+ Content-Type:
13
+ - application/x-www-form-urlencoded
14
+ Accept-Encoding:
15
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
16
+ Accept:
17
+ - "*/*"
18
+ response:
19
+ status:
20
+ code: 200
21
+ message: OK
22
+ headers:
23
+ Date:
24
+ - Thu, 23 Apr 2015 17:40:22 GMT
25
+ Set-Cookie:
26
+ - BrowserId=auDO3L3YTRG8WSDHPuQ0iw;Path=/;Domain=.salesforce.com;Expires=Mon,
27
+ 22-Jun-2015 17:40:22 GMT
28
+ Expires:
29
+ - Thu, 01 Jan 1970 00:00:00 GMT
30
+ Pragma:
31
+ - no-cache
32
+ Cache-Control:
33
+ - no-cache, no-store
34
+ Content-Type:
35
+ - application/json;charset=UTF-8
36
+ Transfer-Encoding:
37
+ - chunked
38
+ body:
39
+ encoding: ASCII-8BIT
40
+ string: '{"id":"https://login.salesforce.com/id/00D1a000000H3O9EAK/0051a000000UGT8AAO","issued_at":"1429810822356","token_type":"Bearer","instance_url":"https://<host>","signature":"KsYGkglGxb+rYOwCQ8vWPs/HDGolddk5RrRN6T/WDMw=","access_token":"00D1a000000H3O9!AQ4AQFoglftCDJPkzXd0wAZ6dnUwrMZEyIrpgn8BUhjwsElswNHT_M5IOJSysNJCZXw6QPBjjHcAYLoUX8bFjnXkaUCdvO1l"}'
41
+ http_version:
42
+ recorded_at: Thu, 23 Apr 2015 17:40:22 GMT
43
+ - request:
44
+ method: post
45
+ uri: https://<host>/services/data/v26.0/sobjects/CustomObject__c
46
+ body:
47
+ encoding: UTF-8
48
+ string: '{"Name":"Sample object"}'
49
+ headers:
50
+ User-Agent:
51
+ - Faraday v0.9.1
52
+ Content-Type:
53
+ - application/json
54
+ Authorization:
55
+ - OAuth 00D1a000000H3O9!AQ4AQFoglftCDJPkzXd0wAZ6dnUwrMZEyIrpgn8BUhjwsElswNHT_M5IOJSysNJCZXw6QPBjjHcAYLoUX8bFjnXkaUCdvO1l
56
+ Accept-Encoding:
57
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
58
+ Accept:
59
+ - "*/*"
60
+ response:
61
+ status:
62
+ code: 201
63
+ message: Created
64
+ headers:
65
+ Date:
66
+ - Thu, 23 Apr 2015 17:40:23 GMT
67
+ Set-Cookie:
68
+ - BrowserId=q4gcxGiaTImoiTiEk64vWg;Path=/;Domain=.salesforce.com;Expires=Mon,
69
+ 22-Jun-2015 17:40:23 GMT
70
+ Expires:
71
+ - Thu, 01 Jan 1970 00:00:00 GMT
72
+ Sforce-Limit-Info:
73
+ - api-usage=19/15000
74
+ Location:
75
+ - "/services/data/v26.0/sobjects/CustomObject__c/a001a000001QmhvAAC"
76
+ Content-Type:
77
+ - application/json;charset=UTF-8
78
+ Transfer-Encoding:
79
+ - chunked
80
+ body:
81
+ encoding: ASCII-8BIT
82
+ string: '{"id":"a001a000001QmhvAAC","success":true,"errors":[]}'
83
+ http_version:
84
+ recorded_at: Thu, 23 Apr 2015 17:40:23 GMT
85
+ - request:
86
+ method: post
87
+ uri: https://<host>/services/data/v26.0/sobjects/CustomObjectDetail__c
88
+ body:
89
+ encoding: UTF-8
90
+ string: '{"Name":"First Detail","CustomObject__c":"a001a000001QmhvAAC"}'
91
+ headers:
92
+ User-Agent:
93
+ - Faraday v0.9.1
94
+ Content-Type:
95
+ - application/json
96
+ Authorization:
97
+ - OAuth 00D1a000000H3O9!AQ4AQFoglftCDJPkzXd0wAZ6dnUwrMZEyIrpgn8BUhjwsElswNHT_M5IOJSysNJCZXw6QPBjjHcAYLoUX8bFjnXkaUCdvO1l
98
+ Accept-Encoding:
99
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
100
+ Accept:
101
+ - "*/*"
102
+ response:
103
+ status:
104
+ code: 201
105
+ message: Created
106
+ headers:
107
+ Date:
108
+ - Thu, 23 Apr 2015 17:40:24 GMT
109
+ Set-Cookie:
110
+ - BrowserId=Lyq4m6PWQ7WP9iSDbCtosA;Path=/;Domain=.salesforce.com;Expires=Mon,
111
+ 22-Jun-2015 17:40:24 GMT
112
+ Expires:
113
+ - Thu, 01 Jan 1970 00:00:00 GMT
114
+ Sforce-Limit-Info:
115
+ - api-usage=19/15000
116
+ Location:
117
+ - "/services/data/v26.0/sobjects/CustomObjectDetail__c/a011a000000i200AAA"
118
+ Content-Type:
119
+ - application/json;charset=UTF-8
120
+ Transfer-Encoding:
121
+ - chunked
122
+ body:
123
+ encoding: ASCII-8BIT
124
+ string: '{"id":"a011a000000i200AAA","success":true,"errors":[]}'
125
+ http_version:
126
+ recorded_at: Thu, 23 Apr 2015 17:40:25 GMT
127
+ - request:
128
+ method: post
129
+ uri: https://<host>/services/data/v26.0/sobjects/CustomObjectDetail__c
130
+ body:
131
+ encoding: UTF-8
132
+ string: '{"Name":"Second Detail","CustomObject__c":"a001a000001QmhvAAC"}'
133
+ headers:
134
+ User-Agent:
135
+ - Faraday v0.9.1
136
+ Content-Type:
137
+ - application/json
138
+ Authorization:
139
+ - OAuth 00D1a000000H3O9!AQ4AQFoglftCDJPkzXd0wAZ6dnUwrMZEyIrpgn8BUhjwsElswNHT_M5IOJSysNJCZXw6QPBjjHcAYLoUX8bFjnXkaUCdvO1l
140
+ Accept-Encoding:
141
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
142
+ Accept:
143
+ - "*/*"
144
+ response:
145
+ status:
146
+ code: 201
147
+ message: Created
148
+ headers:
149
+ Date:
150
+ - Thu, 23 Apr 2015 17:40:26 GMT
151
+ Set-Cookie:
152
+ - BrowserId=u05ioveESM26NdjEyXuk-w;Path=/;Domain=.salesforce.com;Expires=Mon,
153
+ 22-Jun-2015 17:40:26 GMT
154
+ Expires:
155
+ - Thu, 01 Jan 1970 00:00:00 GMT
156
+ Sforce-Limit-Info:
157
+ - api-usage=19/15000
158
+ Location:
159
+ - "/services/data/v26.0/sobjects/CustomObjectDetail__c/a011a000000i205AAA"
160
+ Content-Type:
161
+ - application/json;charset=UTF-8
162
+ Transfer-Encoding:
163
+ - chunked
164
+ body:
165
+ encoding: ASCII-8BIT
166
+ string: '{"id":"a011a000000i205AAA","success":true,"errors":[]}'
167
+ http_version:
168
+ recorded_at: Thu, 23 Apr 2015 17:40:26 GMT
169
+ - request:
170
+ method: post
171
+ uri: https://<host>/services/data/v26.0/sobjects/CustomObjectDetail__c
172
+ body:
173
+ encoding: UTF-8
174
+ string: '{"Name":"Third Detail","CustomObject__c":"a001a000001QmhvAAC"}'
175
+ headers:
176
+ User-Agent:
177
+ - Faraday v0.9.1
178
+ Content-Type:
179
+ - application/json
180
+ Authorization:
181
+ - OAuth 00D1a000000H3O9!AQ4AQFoglftCDJPkzXd0wAZ6dnUwrMZEyIrpgn8BUhjwsElswNHT_M5IOJSysNJCZXw6QPBjjHcAYLoUX8bFjnXkaUCdvO1l
182
+ Accept-Encoding:
183
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
184
+ Accept:
185
+ - "*/*"
186
+ response:
187
+ status:
188
+ code: 201
189
+ message: Created
190
+ headers:
191
+ Date:
192
+ - Thu, 23 Apr 2015 17:40:27 GMT
193
+ Set-Cookie:
194
+ - BrowserId=ZXpSJyVhRo6RY4yKsLZFFg;Path=/;Domain=.salesforce.com;Expires=Mon,
195
+ 22-Jun-2015 17:40:27 GMT
196
+ Expires:
197
+ - Thu, 01 Jan 1970 00:00:00 GMT
198
+ Sforce-Limit-Info:
199
+ - api-usage=20/15000
200
+ Location:
201
+ - "/services/data/v26.0/sobjects/CustomObjectDetail__c/a011a000000i20AAAQ"
202
+ Content-Type:
203
+ - application/json;charset=UTF-8
204
+ Transfer-Encoding:
205
+ - chunked
206
+ body:
207
+ encoding: ASCII-8BIT
208
+ string: '{"id":"a011a000000i20AAAQ","success":true,"errors":[]}'
209
+ http_version:
210
+ recorded_at: Thu, 23 Apr 2015 17:40:27 GMT
211
+ - request:
212
+ method: get
213
+ uri: https://<host>/services/data/v26.0/query?q=select%20Id,%20SystemModstamp,%20Name,%20Example_Field__c%20from%20CustomObject__c%20where%20Id%20=%20%27a001a000001QmhvAAC%27
214
+ body:
215
+ encoding: US-ASCII
216
+ string: ''
217
+ headers:
218
+ User-Agent:
219
+ - Faraday v0.9.1
220
+ Authorization:
221
+ - OAuth 00D1a000000H3O9!AQ4AQFoglftCDJPkzXd0wAZ6dnUwrMZEyIrpgn8BUhjwsElswNHT_M5IOJSysNJCZXw6QPBjjHcAYLoUX8bFjnXkaUCdvO1l
222
+ Accept-Encoding:
223
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
224
+ Accept:
225
+ - "*/*"
226
+ response:
227
+ status:
228
+ code: 200
229
+ message: OK
230
+ headers:
231
+ Date:
232
+ - Thu, 23 Apr 2015 17:40:28 GMT
233
+ Set-Cookie:
234
+ - BrowserId=p4RqG89-SJicgPP_svy3hA;Path=/;Domain=.salesforce.com;Expires=Mon,
235
+ 22-Jun-2015 17:40:28 GMT
236
+ Expires:
237
+ - Thu, 01 Jan 1970 00:00:00 GMT
238
+ Sforce-Limit-Info:
239
+ - api-usage=19/15000
240
+ Content-Type:
241
+ - application/json;charset=UTF-8
242
+ Transfer-Encoding:
243
+ - chunked
244
+ body:
245
+ encoding: ASCII-8BIT
246
+ string: '{"totalSize":1,"done":true,"records":[{"attributes":{"type":"CustomObject__c","url":"/services/data/v26.0/sobjects/CustomObject__c/a001a000001QmhvAAC"},"Id":"a001a000001QmhvAAC","SystemModstamp":"2015-04-23T17:40:23.000+0000","Name":"Sample
247
+ object","Example_Field__c":null}]}'
248
+ http_version:
249
+ recorded_at: Thu, 23 Apr 2015 17:40:28 GMT
250
+ - request:
251
+ method: get
252
+ uri: https://<host>/services/data/v26.0/query?q=select%20Id,%20SystemModstamp,%20Name,%20CustomObject__c%20from%20CustomObjectDetail__c%20where%20CustomObject__c%20=%20%27a001a000001QmhvAAC%27
253
+ body:
254
+ encoding: US-ASCII
255
+ string: ''
256
+ headers:
257
+ User-Agent:
258
+ - Faraday v0.9.1
259
+ Authorization:
260
+ - OAuth 00D1a000000H3O9!AQ4AQFoglftCDJPkzXd0wAZ6dnUwrMZEyIrpgn8BUhjwsElswNHT_M5IOJSysNJCZXw6QPBjjHcAYLoUX8bFjnXkaUCdvO1l
261
+ Accept-Encoding:
262
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
263
+ Accept:
264
+ - "*/*"
265
+ response:
266
+ status:
267
+ code: 200
268
+ message: OK
269
+ headers:
270
+ Date:
271
+ - Thu, 23 Apr 2015 17:40:29 GMT
272
+ Set-Cookie:
273
+ - BrowserId=8JtfCZh8RZ-FCVG0P_xZ8w;Path=/;Domain=.salesforce.com;Expires=Mon,
274
+ 22-Jun-2015 17:40:29 GMT
275
+ Expires:
276
+ - Thu, 01 Jan 1970 00:00:00 GMT
277
+ Sforce-Limit-Info:
278
+ - api-usage=20/15000
279
+ Content-Type:
280
+ - application/json;charset=UTF-8
281
+ Transfer-Encoding:
282
+ - chunked
283
+ body:
284
+ encoding: ASCII-8BIT
285
+ string: '{"totalSize":3,"done":true,"records":[{"attributes":{"type":"CustomObjectDetail__c","url":"/services/data/v26.0/sobjects/CustomObjectDetail__c/a011a000000i200AAA"},"Id":"a011a000000i200AAA","SystemModstamp":"2015-04-23T17:40:24.000+0000","Name":"First
286
+ Detail","CustomObject__c":"a001a000001QmhvAAC"},{"attributes":{"type":"CustomObjectDetail__c","url":"/services/data/v26.0/sobjects/CustomObjectDetail__c/a011a000000i20AAAQ"},"Id":"a011a000000i20AAAQ","SystemModstamp":"2015-04-23T17:40:27.000+0000","Name":"Third
287
+ Detail","CustomObject__c":"a001a000001QmhvAAC"},{"attributes":{"type":"CustomObjectDetail__c","url":"/services/data/v26.0/sobjects/CustomObjectDetail__c/a011a000000i205AAA"},"Id":"a011a000000i205AAA","SystemModstamp":"2015-04-23T17:40:26.000+0000","Name":"Second
288
+ Detail","CustomObject__c":"a001a000001QmhvAAC"}]}'
289
+ http_version:
290
+ recorded_at: Thu, 23 Apr 2015 17:40:29 GMT
291
+ - request:
292
+ method: delete
293
+ uri: https://<host>/services/data/v26.0/sobjects/CustomObject__c/a001a000001QmhvAAC
294
+ body:
295
+ encoding: US-ASCII
296
+ string: ''
297
+ headers:
298
+ User-Agent:
299
+ - Faraday v0.9.1
300
+ Authorization:
301
+ - OAuth 00D1a000000H3O9!AQ4AQFoglftCDJPkzXd0wAZ6dnUwrMZEyIrpgn8BUhjwsElswNHT_M5IOJSysNJCZXw6QPBjjHcAYLoUX8bFjnXkaUCdvO1l
302
+ Accept-Encoding:
303
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
304
+ Accept:
305
+ - "*/*"
306
+ response:
307
+ status:
308
+ code: 204
309
+ message: No Content
310
+ headers:
311
+ Date:
312
+ - Thu, 23 Apr 2015 17:40:30 GMT
313
+ Set-Cookie:
314
+ - BrowserId=__i_R2k2QCGsGUPDu1OS6Q;Path=/;Domain=.salesforce.com;Expires=Mon,
315
+ 22-Jun-2015 17:40:30 GMT
316
+ Expires:
317
+ - Thu, 01 Jan 1970 00:00:00 GMT
318
+ Sforce-Limit-Info:
319
+ - api-usage=22/15000
320
+ body:
321
+ encoding: UTF-8
322
+ string: ''
323
+ http_version:
324
+ recorded_at: Thu, 23 Apr 2015 17:40:30 GMT
325
+ - request:
326
+ method: delete
327
+ uri: https://<host>/services/data/v26.0/sobjects/CustomObjectDetail__c/a011a000000i200AAA
328
+ body:
329
+ encoding: US-ASCII
330
+ string: ''
331
+ headers:
332
+ User-Agent:
333
+ - Faraday v0.9.1
334
+ Authorization:
335
+ - OAuth 00D1a000000H3O9!AQ4AQFoglftCDJPkzXd0wAZ6dnUwrMZEyIrpgn8BUhjwsElswNHT_M5IOJSysNJCZXw6QPBjjHcAYLoUX8bFjnXkaUCdvO1l
336
+ Accept-Encoding:
337
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
338
+ Accept:
339
+ - "*/*"
340
+ response:
341
+ status:
342
+ code: 404
343
+ message: Not Found
344
+ headers:
345
+ Date:
346
+ - Thu, 23 Apr 2015 17:40:31 GMT
347
+ Set-Cookie:
348
+ - BrowserId=sFd3_6F9Q4iqOcFFD8T1_g;Path=/;Domain=.salesforce.com;Expires=Mon,
349
+ 22-Jun-2015 17:40:31 GMT
350
+ Expires:
351
+ - Thu, 01 Jan 1970 00:00:00 GMT
352
+ Sforce-Limit-Info:
353
+ - api-usage=20/15000
354
+ Content-Type:
355
+ - application/json;charset=UTF-8
356
+ Transfer-Encoding:
357
+ - chunked
358
+ body:
359
+ encoding: UTF-8
360
+ string: '[{"message":"entity is deleted","errorCode":"ENTITY_IS_DELETED","fields":[]}]'
361
+ http_version:
362
+ recorded_at: Thu, 23 Apr 2015 17:40:31 GMT
363
+ - request:
364
+ method: delete
365
+ uri: https://<host>/services/data/v26.0/sobjects/CustomObjectDetail__c/a011a000000i205AAA
366
+ body:
367
+ encoding: US-ASCII
368
+ string: ''
369
+ headers:
370
+ User-Agent:
371
+ - Faraday v0.9.1
372
+ Authorization:
373
+ - OAuth 00D1a000000H3O9!AQ4AQFoglftCDJPkzXd0wAZ6dnUwrMZEyIrpgn8BUhjwsElswNHT_M5IOJSysNJCZXw6QPBjjHcAYLoUX8bFjnXkaUCdvO1l
374
+ Accept-Encoding:
375
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
376
+ Accept:
377
+ - "*/*"
378
+ response:
379
+ status:
380
+ code: 404
381
+ message: Not Found
382
+ headers:
383
+ Date:
384
+ - Thu, 23 Apr 2015 17:40:32 GMT
385
+ Set-Cookie:
386
+ - BrowserId=wMQ3DDSySk-NgwSt3MztcA;Path=/;Domain=.salesforce.com;Expires=Mon,
387
+ 22-Jun-2015 17:40:32 GMT
388
+ Expires:
389
+ - Thu, 01 Jan 1970 00:00:00 GMT
390
+ Sforce-Limit-Info:
391
+ - api-usage=20/15000
392
+ Content-Type:
393
+ - application/json;charset=UTF-8
394
+ Transfer-Encoding:
395
+ - chunked
396
+ body:
397
+ encoding: UTF-8
398
+ string: '[{"message":"entity is deleted","errorCode":"ENTITY_IS_DELETED","fields":[]}]'
399
+ http_version:
400
+ recorded_at: Thu, 23 Apr 2015 17:40:32 GMT
401
+ - request:
402
+ method: delete
403
+ uri: https://<host>/services/data/v26.0/sobjects/CustomObjectDetail__c/a011a000000i20AAAQ
404
+ body:
405
+ encoding: US-ASCII
406
+ string: ''
407
+ headers:
408
+ User-Agent:
409
+ - Faraday v0.9.1
410
+ Authorization:
411
+ - OAuth 00D1a000000H3O9!AQ4AQFoglftCDJPkzXd0wAZ6dnUwrMZEyIrpgn8BUhjwsElswNHT_M5IOJSysNJCZXw6QPBjjHcAYLoUX8bFjnXkaUCdvO1l
412
+ Accept-Encoding:
413
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
414
+ Accept:
415
+ - "*/*"
416
+ response:
417
+ status:
418
+ code: 404
419
+ message: Not Found
420
+ headers:
421
+ Date:
422
+ - Thu, 23 Apr 2015 17:40:33 GMT
423
+ Set-Cookie:
424
+ - BrowserId=14kb5QwbTyCwnia4w6iDyA;Path=/;Domain=.salesforce.com;Expires=Mon,
425
+ 22-Jun-2015 17:40:33 GMT
426
+ Expires:
427
+ - Thu, 01 Jan 1970 00:00:00 GMT
428
+ Sforce-Limit-Info:
429
+ - api-usage=20/15000
430
+ Content-Type:
431
+ - application/json;charset=UTF-8
432
+ Transfer-Encoding:
433
+ - chunked
434
+ body:
435
+ encoding: UTF-8
436
+ string: '[{"message":"entity is deleted","errorCode":"ENTITY_IS_DELETED","fields":[]}]'
437
+ http_version:
438
+ recorded_at: Thu, 23 Apr 2015 17:40:33 GMT
439
+ recorded_with: VCR 2.9.3
@@ -98,6 +98,18 @@ describe Restforce::DB::Associations::BelongsTo do
98
98
  expect(associated).to_not_be :empty?
99
99
  end
100
100
  end
101
+
102
+ describe "when the associated record has alrady been persisted" do
103
+ let(:database_record) { CustomObject.new }
104
+ let(:user) { User.create!(salesforce_id: user_salesforce_id) }
105
+
106
+ before { user }
107
+
108
+ it "assigns the existing record" do
109
+ expect(associated).to_be :empty?
110
+ expect(database_record.user).to_equal user
111
+ end
112
+ end
101
113
  end
102
114
  end
103
115
 
@@ -100,6 +100,18 @@ describe Restforce::DB::Associations::HasMany do
100
100
  expect(associated).to_be :empty?
101
101
  end
102
102
  end
103
+
104
+ describe "when the associated records have alrady been persisted" do
105
+ let(:database_record) { CustomObject.new }
106
+ let(:details) { detail_salesforce_ids.map { |id| Detail.create!(salesforce_id: id) } }
107
+
108
+ before { details }
109
+
110
+ it "constructs the association from the existing records" do
111
+ expect(associated).to_be :empty?
112
+ expect(database_record.details).to_match_array details
113
+ end
114
+ end
103
115
  end
104
116
  end
105
117
  end
@@ -6,6 +6,7 @@ describe Restforce::DB::Associations::HasOne do
6
6
  mappings!
7
7
 
8
8
  let(:association) { Restforce::DB::Associations::HasOne.new(:custom_object, through: "Friend__c") }
9
+ let(:inverse_association) { Restforce::DB::Associations::BelongsTo.new(:user, through: %w(Id Friend__c)) }
9
10
 
10
11
  it "sets the lookup field" do
11
12
  expect(association.lookup).to_equal "Friend__c"
@@ -39,7 +40,7 @@ describe Restforce::DB::Associations::HasOne do
39
40
  before do
40
41
  Restforce::DB::Registry << mapping
41
42
  Restforce::DB::Registry << inverse_mapping
42
- mapping.associations << Restforce::DB::Associations::BelongsTo.new(:user, through: "Friend__c")
43
+ mapping.associations << inverse_association
43
44
 
44
45
  object_salesforce_id
45
46
  end
@@ -0,0 +1,75 @@
1
+ # https://jkotests.wordpress.com/2013/12/02/comparing-arrays-in-an-order-independent-manner-using-minitest/
2
+ module MiniTest
3
+
4
+ # :nodoc:
5
+ module Assertions
6
+
7
+ # MatchArray performs an order-independent comparison of two arrays.
8
+ class MatchArray
9
+
10
+ # :nodoc:
11
+ def initialize(expected, actual)
12
+ @expected = expected
13
+ @actual = actual
14
+ end
15
+
16
+ # :nodoc:
17
+ def match
18
+ [result, message]
19
+ end
20
+
21
+ # :nodoc:
22
+ def result
23
+ return false unless @actual.respond_to? :to_ary
24
+ @extra_items = diff(@actual, @expected)
25
+ @missing_items = diff(@expected, @actual)
26
+ @extra_items.empty? & @missing_items.empty?
27
+ end
28
+
29
+ # :nodoc:
30
+ def message
31
+ if @actual.respond_to? :to_ary
32
+ message = "expected collection contained: #{safe_sort(@expected).inspect}\n"
33
+ message += "actual collection contained: #{safe_sort(@actual).inspect}\n"
34
+ message += "the missing elements were: #{safe_sort(@missing_items).inspect}\n" unless @missing_items.empty?
35
+ message += "the extra elements were: #{safe_sort(@extra_items).inspect}\n" unless @extra_items.empty?
36
+ else
37
+ message = "expected an array, actual collection was #{@actual.inspect}"
38
+ end
39
+
40
+ message
41
+ end
42
+
43
+ private
44
+
45
+ # :nodoc:
46
+ def safe_sort(array)
47
+ array.sort rescue array
48
+ end
49
+
50
+ # :nodoc:
51
+ def diff(first, second)
52
+ first.to_ary - second.to_ary
53
+ end
54
+
55
+ end
56
+
57
+ # Public: Assert that two Arrays are identical, save for the order of their
58
+ # elements.
59
+ #
60
+ # Returns an assertion.
61
+ def assert_match_array(expected, actual)
62
+ result, message = MatchArray.new(expected, actual).match
63
+ assert result, message
64
+ end
65
+
66
+ end
67
+
68
+ # :nodoc:
69
+ module Expectations
70
+
71
+ infect_an_assertion :assert_match_array, :must_match_array
72
+
73
+ end
74
+
75
+ end
data/test/test_helper.rb CHANGED
@@ -1,6 +1,5 @@
1
1
  require "cgi"
2
2
  require "minitest/autorun"
3
- require "minitest/spec/expect"
4
3
  require "yaml"
5
4
 
6
5
  $LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
@@ -10,3 +9,5 @@ secrets_file = File.expand_path("../config/secrets.yml", __FILE__)
10
9
  Secrets = YAML.load_file(secrets_file)
11
10
 
12
11
  Dir[File.join(File.dirname(__FILE__), "support/**/*.rb")].each { |f| require f }
12
+
13
+ require "minitest/spec/expect"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: restforce-db
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.4
4
+ version: 1.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Horner
@@ -242,11 +242,13 @@ files:
242
242
  - test/cassettes/Restforce_DB/accessing_Salesforce/uses_the_configured_credentials.yml
243
243
  - test/cassettes/Restforce_DB_Associations_BelongsTo/with_an_inverse_mapping/_build/returns_an_associated_record_populated_with_the_Salesforce_attributes.yml
244
244
  - test/cassettes/Restforce_DB_Associations_BelongsTo/with_an_inverse_mapping/_build/when_no_salesforce_record_is_found_for_the_association/proceeds_without_constructing_any_records.yml
245
+ - test/cassettes/Restforce_DB_Associations_BelongsTo/with_an_inverse_mapping/_build/when_the_associated_record_has_alrady_been_persisted/assigns_the_existing_record.yml
245
246
  - test/cassettes/Restforce_DB_Associations_BelongsTo/with_an_inverse_mapping/_build/with_an_unrelated_association_mapping/proceeds_without_raising_an_error.yml
246
247
  - test/cassettes/Restforce_DB_Associations_BelongsTo/with_an_inverse_mapping/_synced_for_/when_a_matching_associated_record_has_been_synchronized/returns_true.yml
247
248
  - test/cassettes/Restforce_DB_Associations_BelongsTo/with_an_inverse_mapping/_synced_for_/when_no_matching_associated_record_has_been_synchronized/returns_false.yml
248
249
  - test/cassettes/Restforce_DB_Associations_HasMany/with_an_inverse_mapping/_build/builds_a_number_of_associated_records_from_the_data_in_Salesforce.yml
249
250
  - test/cassettes/Restforce_DB_Associations_HasMany/with_an_inverse_mapping/_build/when_no_salesforce_record_is_found_for_the_association/proceeds_without_constructing_any_records.yml
251
+ - test/cassettes/Restforce_DB_Associations_HasMany/with_an_inverse_mapping/_build/when_the_associated_records_have_alrady_been_persisted/constructs_the_association_from_the_existing_records.yml
250
252
  - test/cassettes/Restforce_DB_Associations_HasMany/with_an_inverse_mapping/_synced_for_/when_a_matching_associated_record_has_been_synchronized/returns_true.yml
251
253
  - test/cassettes/Restforce_DB_Associations_HasMany/with_an_inverse_mapping/_synced_for_/when_no_matching_associated_record_has_been_synchronized/returns_false.yml
252
254
  - test/cassettes/Restforce_DB_Associations_HasOne/with_an_inverse_mapping/_build/and_a_nested_association_on_the_associated_mapping/recursively_builds_all_associations.yml
@@ -306,6 +308,7 @@ files:
306
308
  - test/lib/restforce/db_test.rb
307
309
  - test/support/active_record.rb
308
310
  - test/support/database_cleaner.rb
311
+ - test/support/matchers.rb
309
312
  - test/support/salesforce.rb
310
313
  - test/support/utilities.rb
311
314
  - test/support/vcr.rb