active_force 0.7.1 → 0.15.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +5 -5
  2. data/.circleci/config.yml +107 -0
  3. data/.github/ISSUE_TEMPLATE/bug_report.md +24 -0
  4. data/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
  5. data/.mailmap +3 -0
  6. data/CHANGELOG.md +120 -42
  7. data/CODEOWNERS +2 -0
  8. data/Gemfile +0 -1
  9. data/README.md +100 -21
  10. data/active_force.gemspec +11 -4
  11. data/lib/active_force/active_query.rb +92 -6
  12. data/lib/active_force/association/association.rb +47 -3
  13. data/lib/active_force/association/belongs_to_association.rb +25 -11
  14. data/lib/active_force/association/eager_load_projection_builder.rb +9 -3
  15. data/lib/active_force/association/has_many_association.rb +19 -19
  16. data/lib/active_force/association/has_one_association.rb +30 -0
  17. data/lib/active_force/association/relation_model_builder.rb +1 -1
  18. data/lib/active_force/association.rb +6 -4
  19. data/lib/active_force/{attribute.rb → field.rb} +3 -3
  20. data/lib/active_force/mapping.rb +6 -32
  21. data/lib/active_force/query.rb +21 -2
  22. data/lib/active_force/sobject.rb +73 -28
  23. data/lib/active_force/version.rb +3 -1
  24. data/lib/active_force.rb +2 -0
  25. data/lib/active_model/type/salesforce/multipicklist.rb +29 -0
  26. data/lib/active_model/type/salesforce/percent.rb +22 -0
  27. data/lib/generators/active_force/model/model_generator.rb +32 -21
  28. data/lib/generators/active_force/model/templates/model.rb.erb +3 -1
  29. data/spec/active_force/active_query_spec.rb +200 -8
  30. data/spec/active_force/association/relation_model_builder_spec.rb +22 -0
  31. data/spec/active_force/association_spec.rb +252 -9
  32. data/spec/active_force/field_spec.rb +34 -0
  33. data/spec/active_force/query_spec.rb +26 -0
  34. data/spec/active_force/sobject/includes_spec.rb +10 -10
  35. data/spec/active_force/sobject_spec.rb +156 -14
  36. data/spec/fixtures/sobject/single_sobject_hash.yml +1 -1
  37. data/spec/spec_helper.rb +5 -2
  38. data/spec/support/bangwhiz.rb +7 -0
  39. data/spec/support/restforce_factories.rb +1 -1
  40. data/spec/support/sobjects.rb +17 -1
  41. data/spec/support/whizbang.rb +2 -2
  42. metadata +64 -26
  43. data/lib/active_attr/dirty.rb +0 -24
  44. data/spec/active_force/attribute_spec.rb +0 -27
@@ -25,10 +25,10 @@ describe ActiveForce::SObject do
25
25
  expect(sobject.boolean).to be_an_instance_of TrueClass
26
26
  expect(sobject.checkbox).to be_an_instance_of FalseClass
27
27
  expect(sobject.date).to be_an_instance_of Date
28
- expect(sobject.datetime).to be_an_instance_of DateTime
28
+ expect(sobject.datetime).to be_an_instance_of Time
29
29
  expect(sobject.percent).to be_an_instance_of Float
30
30
  expect(sobject.text).to be_an_instance_of String
31
- expect(sobject.picklist_multiselect).to be_an_instance_of String
31
+ expect(sobject.picklist_multiselect).to be_an_instance_of Array
32
32
  end
33
33
  end
34
34
 
@@ -65,15 +65,60 @@ describe ActiveForce::SObject do
65
65
  end
66
66
  end
67
67
 
68
- context 'as: :multi_picklist' do
68
+ describe 'having a default value' do
69
+ subject { Bangwhiz }
70
+
71
+ context 'when using the default value' do
72
+ let(:instantiation_attributes) { {name: 'some name'} }
73
+ let(:percent) { 50.0 }
74
+
75
+ it 'sends percent to salesforce' do
76
+ expect(client).to receive(:create!)
77
+ .with(anything, hash_including('Percent_Label' => percent))
78
+ subject.create(**instantiation_attributes)
79
+ end
80
+
81
+ it 'sets percent field upon object instantiation' do
82
+ expect(subject.new(**instantiation_attributes)[:percent]).to eq(percent)
83
+ end
84
+ end
85
+
86
+ context 'when overriding a default value' do
87
+ let(:instantiation_attributes) { {name: 'some name', percent: percent} }
88
+ let(:percent) { 25.0 }
89
+
90
+ it 'sends percent to salesforce' do
91
+ expect(client).to receive(:create!)
92
+ .with(anything, hash_including('Percent_Label' => percent))
93
+ subject.create(**instantiation_attributes)
94
+ end
95
+
96
+ it 'sets percent field upon object instantiation' do
97
+ expect(subject.new(**instantiation_attributes)[:percent]).to eq(percent)
98
+ end
99
+ end
100
+ end
101
+
102
+ context 'as: :multipicklist' do
69
103
  before do
70
104
  class IceCream < ActiveForce::SObject
71
- field :flavors, as: :multi_picklist
105
+ field :flavors, as: :multipicklist
72
106
  end
73
- sundae.changed_attributes.clear
107
+ sundae.clear_changes_information
74
108
  sundae.flavors = %w(chocolate vanilla strawberry)
75
109
  end
76
110
 
111
+ context 'mutation of multipicklist' do
112
+ let(:sundae) { IceCream.new }
113
+
114
+ before { sundae.clear_changes_information }
115
+
116
+ it 'detects mutation' do
117
+ sundae.flavors.delete('chocolate')
118
+ expect(sundae.flavors_changed?).to be true
119
+ end
120
+ end
121
+
77
122
  context 'on create' do
78
123
  let(:sundae) { IceCream.new }
79
124
  it 'formats the picklist values' do
@@ -93,6 +138,25 @@ describe ActiveForce::SObject do
93
138
  end
94
139
  end
95
140
 
141
+ describe '.describe' do
142
+ subject { Whizbang.describe }
143
+
144
+ let(:describe_response) { { 'fields' => [] } }
145
+
146
+ before do
147
+ allow(client).to receive(:describe).and_return(describe_response)
148
+ end
149
+
150
+ it 'passes table_name to sfdc_client.describe' do
151
+ subject
152
+ expect(client).to have_received(:describe).with(Whizbang.table_name)
153
+ end
154
+
155
+ it 'returns response from describe' do
156
+ expect(subject).to eq(describe_response)
157
+ end
158
+ end
159
+
96
160
  describe "CRUD" do
97
161
  let(:instance){ Whizbang.new(id: '1') }
98
162
 
@@ -140,12 +204,12 @@ describe ActiveForce::SObject do
140
204
  end
141
205
 
142
206
  describe 'and with a ClientError' do
143
- let(:faraday_error){ Faraday::Error::ClientError.new('Some String') }
207
+ let(:faraday_error){ Faraday::ClientError.new('Some String') }
144
208
 
145
209
  before{ expect(client).to receive(:update!).and_raise(faraday_error) }
146
210
 
147
211
  it 'raises an error' do
148
- expect{ instance.update!( text: 'some text', boolean: false ) }.to raise_error(Faraday::Error::ClientError)
212
+ expect{ instance.update!( text: 'some text', boolean: false ) }.to raise_error(Faraday::ClientError)
149
213
  end
150
214
  end
151
215
  end
@@ -198,12 +262,12 @@ describe ActiveForce::SObject do
198
262
  end
199
263
 
200
264
  describe 'and with a ClientError' do
201
- let(:faraday_error){ Faraday::Error::ClientError.new('Some String') }
265
+ let(:faraday_error){ Faraday::ClientError.new('Some String') }
202
266
 
203
267
  before{ expect(client).to receive(:create!).and_raise(faraday_error) }
204
268
 
205
269
  it 'raises an error' do
206
- expect{ instance.create! }.to raise_error(Faraday::Error::ClientError)
270
+ expect{ instance.create! }.to raise_error(Faraday::ClientError)
207
271
  end
208
272
  end
209
273
  end
@@ -226,7 +290,9 @@ describe ActiveForce::SObject do
226
290
 
227
291
  describe 'self.create' do
228
292
  before do
229
- expect(client).to receive(:create!).with(Whizbang.table_name, 'Text_Label' => 'some text', 'Updated_From__c'=>'Rails').and_return('id')
293
+ expect(client).to receive(:create!)
294
+ .with(Whizbang.table_name, { 'Text_Label' => 'some text', 'Updated_From__c' => 'Rails' })
295
+ .and_return('id')
230
296
  end
231
297
 
232
298
  it 'should create a new instance' do
@@ -256,6 +322,38 @@ describe ActiveForce::SObject do
256
322
  end
257
323
  end
258
324
 
325
+ describe "#find_by!" do
326
+ it "queries the client, with the SFDC field names and correctly enclosed values" do
327
+ expect(client).to receive(:query).with("SELECT #{Whizbang.fields.join ', '} FROM Whizbang__c WHERE (Id = 123) AND (Text_Label = 'foo') LIMIT 1").and_return([Restforce::Mash.new(Id: 123, text: 'foo')])
328
+ Whizbang.find_by! id: 123, text: "foo"
329
+ end
330
+ it "raises if nothing found" do
331
+ expect(client).to receive(:query).with("SELECT #{Whizbang.fields.join ', '} FROM Whizbang__c WHERE (Id = 123) AND (Text_Label = 'foo') LIMIT 1")
332
+ expect { Whizbang.find_by! id: 123, text: "foo" }.to raise_error(ActiveForce::RecordNotFound)
333
+ end
334
+ end
335
+
336
+ describe '.find!' do
337
+ let(:id) { 'abc123' }
338
+
339
+ before do
340
+ allow(client).to receive(:query)
341
+ end
342
+
343
+ it 'returns found record' do
344
+ query = "SELECT #{Whizbang.fields.join ', '} FROM Whizbang__c WHERE (Id = '#{id}') LIMIT 1"
345
+ expected = Restforce::Mash.new(Id: id)
346
+ allow(client).to receive(:query).with(query).and_return([expected])
347
+ actual = Whizbang.find!(id)
348
+ expect(actual.id).to eq(expected.Id)
349
+ end
350
+
351
+ it 'raises RecordNotFound if nothing found' do
352
+ expect { Whizbang.find!(id) }
353
+ .to raise_error(ActiveForce::RecordNotFound, "Couldn't find #{Whizbang.table_name} with id #{id}")
354
+ end
355
+ end
356
+
259
357
  describe '#reload' do
260
358
  let(:client) do
261
359
  double("sfdc_client", query: [Restforce::Mash.new(Id: 1, Name: 'Jeff')])
@@ -314,7 +412,7 @@ describe ActiveForce::SObject do
314
412
  let(:instance){ Whizbang.new }
315
413
 
316
414
  before do
317
- allow(instance).to receive(:create!).and_raise(Faraday::Error::ClientError.new(double))
415
+ allow(instance).to receive(:create!).and_raise(Faraday::ClientError.new(double))
318
416
  end
319
417
 
320
418
  it 'catches and logs the error' do
@@ -323,6 +421,22 @@ describe ActiveForce::SObject do
323
421
  end
324
422
  end
325
423
 
424
+ describe 'to_json' do
425
+ let(:instance) { Whizbang.new }
426
+
427
+ it 'responds to' do
428
+ expect(instance).to respond_to(:to_json)
429
+ end
430
+ end
431
+
432
+ describe 'as_json' do
433
+ let(:instance) { Whizbang.new }
434
+
435
+ it 'responds to' do
436
+ expect(instance).to respond_to(:as_json)
437
+ end
438
+ end
439
+
326
440
  describe ".save!" do
327
441
  let(:instance){ Whizbang.new }
328
442
 
@@ -335,12 +449,12 @@ describe ActiveForce::SObject do
335
449
  end
336
450
 
337
451
  describe 'and with a ClientError' do
338
- let(:faraday_error){ Faraday::Error::ClientError.new('Some String') }
452
+ let(:faraday_error){ Faraday::ClientError.new('Some String') }
339
453
 
340
454
  before{ expect(client).to receive(:create!).and_raise(faraday_error) }
341
455
 
342
456
  it 'raises an error' do
343
- expect{ instance.save! }.to raise_error(Faraday::Error::ClientError)
457
+ expect{ instance.save! }.to raise_error(Faraday::ClientError)
344
458
  end
345
459
  end
346
460
  end
@@ -354,6 +468,34 @@ describe ActiveForce::SObject do
354
468
  end
355
469
  end
356
470
 
471
+ describe '#[]' do
472
+ let(:sobject){ Whizbang.build sobject_hash }
473
+
474
+ it 'allows accessing the attribute values as if the Sobject were a Hash' do
475
+ expect(sobject[:boolean]).to eq sobject.boolean
476
+ expect(sobject[:checkbox]).to eq sobject.checkbox
477
+ expect(sobject[:date]).to eq sobject.date
478
+ expect(sobject[:datetime]).to eq sobject.datetime
479
+ expect(sobject[:percent]).to eq sobject.percent
480
+ expect(sobject[:text]).to eq sobject.text
481
+ expect(sobject[:picklist_multiselect]).to eq sobject.picklist_multiselect
482
+ end
483
+ end
484
+
485
+ describe '#[]=' do
486
+ let(:sobject){ Whizbang.new }
487
+
488
+ it 'allows modifying the attribute values as if the Sobject were a Hash' do
489
+ expect(sobject[:boolean]=false).to eq sobject.boolean
490
+ expect(sobject[:checkbox]=true).to eq sobject.checkbox
491
+ expect(sobject[:datetime]=Time.now).to eq sobject.datetime
492
+ expect(sobject[:percent]=50).to eq sobject.percent
493
+ expect(sobject[:text]='foo-bar').to eq sobject.text
494
+ sobject[:picklist_multiselect]='a;b'
495
+ expect(sobject.picklist_multiselect).to eq ['a', 'b']
496
+ end
497
+ end
498
+
357
499
  describe ".save" do
358
500
  let(:instance){ Whizbang.new }
359
501
 
@@ -366,7 +508,7 @@ describe ActiveForce::SObject do
366
508
  end
367
509
 
368
510
  describe 'and with a ClientError' do
369
- let(:faraday_error){ Faraday::Error::ClientError.new('Some String') }
511
+ let(:faraday_error){ Faraday::ClientError.new('Some String') }
370
512
  before{ expect(client).to receive(:create!).and_raise(faraday_error) }
371
513
  it 'returns false' do
372
514
  expect(instance.save).to eq(false)
@@ -6,7 +6,7 @@ Text_Label: 'Hi there!'
6
6
  Date_Label: '2010-01-01'
7
7
  DateTime_Label: '2011-07-07T00:37:00.000+0000'
8
8
  Picklist_Multiselect_Label: 'four;six'
9
- Percent_Label: 20
9
+ Percent_Label: 21
10
10
  Boolean_Label: true
11
11
 
12
12
  ParentWhizbang__r:
data/spec/spec_helper.rb CHANGED
@@ -1,5 +1,8 @@
1
- require "codeclimate-test-reporter"
2
- CodeClimate::TestReporter.start
1
+ require 'simplecov'
2
+ SimpleCov.start do
3
+ add_filter '/vendor'
4
+ add_filter '/spec'
5
+ end
3
6
 
4
7
  $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
5
8
  require 'active_force'
@@ -0,0 +1,7 @@
1
+ class Bangwhiz < ActiveForce::SObject
2
+
3
+ field :id, from: 'Id'
4
+ field :name, from: 'Name'
5
+ field :percent, from: 'Percent_Label', as: :percent, default: -> { 50.0 }
6
+
7
+ end
@@ -1,5 +1,5 @@
1
1
  module RestforceFactories
2
- def build_restforce_collection(array)
2
+ def build_restforce_collection(array=[])
3
3
  Restforce::Collection.new({ 'records' => array }, nil)
4
4
  end
5
5
 
@@ -15,6 +15,8 @@ class Post < ActiveForce::SObject
15
15
  has_many :reply_comments, model: Comment, scoped_as: ->(post){ where(body: "RE: #{post.title}").order('CreationDate DESC') }
16
16
  has_many :ugly_comments, { model: Comment }
17
17
  has_many :poster_comments, { foreign_key: :poster_id, model: Comment }
18
+ has_one :last_comment, model: Comment, scoped_as: -> { where.not(body: nil).order('CreatedDate DESC') }
19
+ has_one :repeat_comment, model: Comment, scoped_as: ->(post) { where(body: post.title) }
18
20
  end
19
21
  class Territory < ActiveForce::SObject
20
22
  field :quota_id, from: "Quota__c"
@@ -47,6 +49,17 @@ class EnforcedTableName < ActiveForce::SObject
47
49
  self.table_name = 'Forced__c'
48
50
  end
49
51
 
52
+ class HasOneChild < ActiveForce::SObject
53
+ field :has_one_parent_id, from: 'has_one_parent_id__c'
54
+ field :fancy_parent_id, from: 'FancyParentId'
55
+ belongs_to :has_one_parent, foreign_key: :has_one_parent_id
56
+ end
57
+
58
+ class HasOneParent < ActiveForce::SObject
59
+ field :comment
60
+ has_one :has_one_child, model: HasOneChild
61
+ end
62
+
50
63
  module Foo
51
64
  class Bar < ActiveForce::SObject; end
52
65
  class Opportunity < ActiveForce::SObject
@@ -57,7 +70,10 @@ module Foo
57
70
  has_many :opportunities, model: Foo::Opportunity
58
71
  has_many :partner_opportunities, foreign_key: :partner_account_id, model: Foo::Opportunity
59
72
  end
60
- class Lead < ActiveForce::SObject; end
73
+ class Lead < ActiveForce::SObject
74
+ has_one :attachment, model: 'Foo::Attachment'
75
+ has_one :fancy_attachment, model: 'Foo::Attachment', foreign_key: :fancy_lead_id
76
+ end
61
77
  class Attachment < ActiveForce::SObject
62
78
  field :lead_id, from: 'Lead_Id__c'
63
79
  field :fancy_lead_id, from: 'LeadId'
@@ -9,7 +9,7 @@ class Whizbang < ActiveForce::SObject
9
9
  field :boolean, from: 'Boolean_Label', as: :boolean
10
10
  field :percent, from: 'Percent_Label', as: :percent
11
11
  field :estimated_close_date, as: :datetime
12
- field :updated_from, as: :datetime
12
+ field :updated_from, as: :string
13
13
  field :dirty_attribute, as: :boolean
14
14
 
15
15
  before_save :set_as_updated_from_rails
@@ -27,4 +27,4 @@ class Whizbang < ActiveForce::SObject
27
27
  self.dirty_attribute = true
28
28
  end
29
29
 
30
- end
30
+ end
metadata CHANGED
@@ -1,60 +1,60 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_force
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 0.15.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eloy Espinaco
8
8
  - Pablo Oldani
9
9
  - Armando Andini
10
10
  - José Piccioni
11
- autorequire:
11
+ autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2014-10-29 00:00:00.000000000 Z
14
+ date: 2023-05-31 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
- name: active_attr
17
+ name: activemodel
18
18
  requirement: !ruby/object:Gem::Requirement
19
19
  requirements:
20
20
  - - "~>"
21
21
  - !ruby/object:Gem::Version
22
- version: '0.8'
22
+ version: '7.0'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - "~>"
28
28
  - !ruby/object:Gem::Version
29
- version: '0.8'
29
+ version: '7.0'
30
30
  - !ruby/object:Gem::Dependency
31
- name: restforce
31
+ name: activesupport
32
32
  requirement: !ruby/object:Gem::Requirement
33
33
  requirements:
34
34
  - - "~>"
35
35
  - !ruby/object:Gem::Version
36
- version: '1.4'
36
+ version: '7.0'
37
37
  type: :runtime
38
38
  prerelease: false
39
39
  version_requirements: !ruby/object:Gem::Requirement
40
40
  requirements:
41
41
  - - "~>"
42
42
  - !ruby/object:Gem::Version
43
- version: '1.4'
43
+ version: '7.0'
44
44
  - !ruby/object:Gem::Dependency
45
- name: bundler
45
+ name: restforce
46
46
  requirement: !ruby/object:Gem::Requirement
47
47
  requirements:
48
- - - "~>"
48
+ - - ">="
49
49
  - !ruby/object:Gem::Version
50
- version: '1.3'
51
- type: :development
50
+ version: '5'
51
+ type: :runtime
52
52
  prerelease: false
53
53
  version_requirements: !ruby/object:Gem::Requirement
54
54
  requirements:
55
- - - "~>"
55
+ - - ">="
56
56
  - !ruby/object:Gem::Version
57
- version: '1.3'
57
+ version: '5'
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: rake
60
60
  requirement: !ruby/object:Gem::Requirement
@@ -83,6 +83,20 @@ dependencies:
83
83
  - - ">="
84
84
  - !ruby/object:Gem::Version
85
85
  version: '0'
86
+ - !ruby/object:Gem::Dependency
87
+ name: rspec_junit_formatter
88
+ requirement: !ruby/object:Gem::Requirement
89
+ requirements:
90
+ - - ">="
91
+ - !ruby/object:Gem::Version
92
+ version: '0'
93
+ type: :development
94
+ prerelease: false
95
+ version_requirements: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ version: '0'
86
100
  - !ruby/object:Gem::Dependency
87
101
  name: pry
88
102
  requirement: !ruby/object:Gem::Requirement
@@ -97,22 +111,40 @@ dependencies:
97
111
  - - ">="
98
112
  - !ruby/object:Gem::Version
99
113
  version: '0'
114
+ - !ruby/object:Gem::Dependency
115
+ name: simplecov
116
+ requirement: !ruby/object:Gem::Requirement
117
+ requirements:
118
+ - - ">="
119
+ - !ruby/object:Gem::Version
120
+ version: '0'
121
+ type: :development
122
+ prerelease: false
123
+ version_requirements: !ruby/object:Gem::Requirement
124
+ requirements:
125
+ - - ">="
126
+ - !ruby/object:Gem::Version
127
+ version: '0'
100
128
  description: Use SalesForce as an ActiveModel
101
129
  email: eloyesp@gmail.com
102
130
  executables: []
103
131
  extensions: []
104
132
  extra_rdoc_files: []
105
133
  files:
134
+ - ".circleci/config.yml"
135
+ - ".github/ISSUE_TEMPLATE/bug_report.md"
136
+ - ".github/ISSUE_TEMPLATE/feature_request.md"
106
137
  - ".gitignore"
138
+ - ".mailmap"
107
139
  - ".rspec"
108
140
  - ".travis.yml"
109
141
  - CHANGELOG.md
142
+ - CODEOWNERS
110
143
  - Gemfile
111
144
  - LICENSE.txt
112
145
  - README.md
113
146
  - Rakefile
114
147
  - active_force.gemspec
115
- - lib/active_attr/dirty.rb
116
148
  - lib/active_force.rb
117
149
  - lib/active_force/active_query.rb
118
150
  - lib/active_force/association.rb
@@ -120,22 +152,25 @@ files:
120
152
  - lib/active_force/association/belongs_to_association.rb
121
153
  - lib/active_force/association/eager_load_projection_builder.rb
122
154
  - lib/active_force/association/has_many_association.rb
155
+ - lib/active_force/association/has_one_association.rb
123
156
  - lib/active_force/association/relation_model_builder.rb
124
- - lib/active_force/attribute.rb
157
+ - lib/active_force/field.rb
125
158
  - lib/active_force/mapping.rb
126
159
  - lib/active_force/query.rb
127
160
  - lib/active_force/sobject.rb
128
161
  - lib/active_force/standard_types.rb
129
162
  - lib/active_force/table.rb
130
163
  - lib/active_force/version.rb
164
+ - lib/active_model/type/salesforce/multipicklist.rb
165
+ - lib/active_model/type/salesforce/percent.rb
131
166
  - lib/generators/active_force/model/USAGE
132
167
  - lib/generators/active_force/model/model_generator.rb
133
168
  - lib/generators/active_force/model/templates/model.rb.erb
134
169
  - spec/active_force/active_query_spec.rb
135
170
  - spec/active_force/association/relation_model_builder_spec.rb
136
171
  - spec/active_force/association_spec.rb
137
- - spec/active_force/attribute_spec.rb
138
172
  - spec/active_force/callbacks_spec.rb
173
+ - spec/active_force/field_spec.rb
139
174
  - spec/active_force/mapping_spec.rb
140
175
  - spec/active_force/query_spec.rb
141
176
  - spec/active_force/sobject/includes_spec.rb
@@ -145,15 +180,19 @@ files:
145
180
  - spec/active_force_spec.rb
146
181
  - spec/fixtures/sobject/single_sobject_hash.yml
147
182
  - spec/spec_helper.rb
183
+ - spec/support/bangwhiz.rb
148
184
  - spec/support/fixture_helpers.rb
149
185
  - spec/support/restforce_factories.rb
150
186
  - spec/support/sobjects.rb
151
187
  - spec/support/whizbang.rb
152
- homepage: https://github.com/ionia-corporation/active_force
188
+ homepage: https://github.com/Beyond-Finance/active_force#readme
153
189
  licenses:
154
190
  - MIT
155
- metadata: {}
156
- post_install_message:
191
+ metadata:
192
+ bug_tracker_uri: https://github.com/Beyond-Finance/active_force/issues
193
+ changelog_uri: https://github.com/Beyond-Finance/active_force/blob/main/CHANGELOG.md
194
+ source_code_uri: https://github.com/Beyond-Finance/active_force
195
+ post_install_message:
157
196
  rdoc_options: []
158
197
  require_paths:
159
198
  - lib
@@ -168,17 +207,16 @@ required_rubygems_version: !ruby/object:Gem::Requirement
168
207
  - !ruby/object:Gem::Version
169
208
  version: '0'
170
209
  requirements: []
171
- rubyforge_project:
172
- rubygems_version: 2.2.2
173
- signing_key:
210
+ rubygems_version: 3.4.6
211
+ signing_key:
174
212
  specification_version: 4
175
213
  summary: Help you implement models persisting on Sales Force within Rails using RESTForce
176
214
  test_files:
177
215
  - spec/active_force/active_query_spec.rb
178
216
  - spec/active_force/association/relation_model_builder_spec.rb
179
217
  - spec/active_force/association_spec.rb
180
- - spec/active_force/attribute_spec.rb
181
218
  - spec/active_force/callbacks_spec.rb
219
+ - spec/active_force/field_spec.rb
182
220
  - spec/active_force/mapping_spec.rb
183
221
  - spec/active_force/query_spec.rb
184
222
  - spec/active_force/sobject/includes_spec.rb
@@ -188,8 +226,8 @@ test_files:
188
226
  - spec/active_force_spec.rb
189
227
  - spec/fixtures/sobject/single_sobject_hash.yml
190
228
  - spec/spec_helper.rb
229
+ - spec/support/bangwhiz.rb
191
230
  - spec/support/fixture_helpers.rb
192
231
  - spec/support/restforce_factories.rb
193
232
  - spec/support/sobjects.rb
194
233
  - spec/support/whizbang.rb
195
- has_rdoc:
@@ -1,24 +0,0 @@
1
- require 'active_support'
2
- require 'active_model/dirty'
3
- require 'active_attr'
4
-
5
- module ActiveAttr
6
- module Dirty
7
- extend ActiveSupport::Concern
8
- include ActiveModel::Dirty
9
-
10
- module ClassMethods
11
- def attribute!(name, options={})
12
- super(name, options)
13
- define_method("#{name}=") do |value|
14
- send("#{name}_will_change!") unless value == read_attribute(name)
15
- super(value)
16
- end
17
- end
18
- end
19
-
20
- def attributes_and_changes
21
- attributes.select{ |attr, key| changed.include? attr }
22
- end
23
- end
24
- end
@@ -1,27 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe ActiveForce::Attribute do
4
- let(:attribute) { ActiveForce::Attribute }
5
-
6
- describe 'initialize' do
7
- let(:some_field) { attribute.new(:some_field) }
8
-
9
- it 'should set "from" and "as" as default' do
10
- expect(some_field.sfdc_name).to eq 'Some_Field__c'
11
- expect(some_field.as).to eq :string
12
- end
13
-
14
- it 'should take values from the option parameter' do
15
- other_field = attribute.new(:other_field, sfdc_name: 'OT__c', as: :integer)
16
- expect(other_field.sfdc_name).to eq 'OT__c'
17
- expect(other_field.as).to eq :integer
18
- end
19
- end
20
-
21
- describe 'when the attribute is' do
22
- it 'a multipick should return all values as 1 string separated with ";"' do
23
- names = attribute.new(:names, as: :multi_picklist)
24
- expect(names.value_for_hash ['olvap', 'eloy']).to eq 'olvap;eloy'
25
- end
26
- end
27
- end