leap_salesforce 0.1.11 → 0.1.12

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
  SHA256:
3
- metadata.gz: 0643c6bdb99cf5d5ab3c1daa4993be2d57405e8beca02b4554188b260cf35c38
4
- data.tar.gz: 2aadf0ffb313f32e35280794de1a182ca3e9567b1753c878493ac24180069658
3
+ metadata.gz: f223007c3c8d006fd9d639357756108c242a18f70a5843648ffe3393ce1928be
4
+ data.tar.gz: abe22b8c691f391158e38520476ed23e1378e54e2feabb4cac1ff366d422847b
5
5
  SHA512:
6
- metadata.gz: 4af203c910c8aaf8c3b9322c72e26010a45cbb3b4a60b594584537f2f934038a12dde800cb58ba600392d676aa6b46970c3747094daf91774d76e80917fe27f6
7
- data.tar.gz: 07f636197ce307d8390b694317ddcfec9e8dadf56277650b124b93f1646210d17850ea8a5b070f91fd6418911f69d2ca266ff943f03874bba5a8216fae202306
6
+ metadata.gz: 24fa2a866b764c494127fd2413c4a6f9c14d2faee72d0f47b3efec4a96295e9decdff0c2ebc8e701f880663c8777649d05a6fb5411a49255650106b75759c3f0
7
+ data.tar.gz: 1aad23255a4ee3233096a029962f24ecf7079850c67107834be0d11671c7165a673edb2733d8e586407a3dd68c368bd4ba52f1e23183127d4d3563b707eeb710
data/.idea/.rakeTasks CHANGED
@@ -4,4 +4,4 @@ You are allowed to:
4
4
  1. Remove rake task
5
5
  2. Add existing rake tasks
6
6
  To add existing rake tasks automatically delete this file and reload the project.
7
- --><RakeGroup description="" fullCmd="" taksId="rake"><RakeTask description="Build leap_salesforce-0.1.1.gem into the pkg directory" fullCmd="build" taksId="build" /><RakeTask description="Remove any temporary products" fullCmd="clean" taksId="clean" /><RakeTask description="Remove any generated files" fullCmd="clobber" taksId="clobber" /><RakeTask description="Build and install leap_salesforce-0.1.1.gem into system gems" fullCmd="install" taksId="install" /><RakeGroup description="" fullCmd="" taksId="install"><RakeTask description="Build and install leap_salesforce-0.1.1.gem into system gems without network access" fullCmd="install:local" taksId="local" /></RakeGroup><RakeGroup description="" fullCmd="" taksId="leaps"><RakeTask description="Create objects, fields, enums" fullCmd="leaps:create_all" taksId="create_all" /><RakeTask description="Create Enumeration objects for picklists from Salesforce Metadata" fullCmd="leaps:create_enums" taksId="create_enums" /><RakeTask description="Create Soql Data objects" fullCmd="leaps:create_soql_objects" taksId="create_soql_objects" /></RakeGroup><RakeTask description="Create tag v0.1.1 and build and push leap_salesforce-0.1.1.gem to rubygems.org" fullCmd="release[remote]" taksId="release[remote]" /><RakeTask description="Run RSpec code examples" fullCmd="spec" taksId="spec" /><RakeTask description="Create stubs for dynamic methods so they're picked up by the IDE" fullCmd="stub" taksId="stub" /><RakeTask description="" fullCmd="default" taksId="default" /><RakeTask description="" fullCmd="release" taksId="release" /><RakeGroup description="" fullCmd="" taksId="release"><RakeTask description="" fullCmd="release:guard_clean" taksId="guard_clean" /><RakeTask description="" fullCmd="release:rubygem_push" taksId="rubygem_push" /><RakeTask description="" fullCmd="release:source_control_push" taksId="source_control_push" /></RakeGroup></RakeGroup></Settings>
7
+ --><RakeGroup description="" fullCmd="" taksId="rake"><RakeTask description="Build leap_salesforce-0.1.11.gem into the pkg directory" fullCmd="build" taksId="build" /><RakeTask description="Check Salesforce OAuth2 authentication is working" fullCmd="check_oauth" taksId="check_oauth" /><RakeTask description="Remove any temporary products" fullCmd="clean" taksId="clean" /><RakeTask description="Remove any generated files" fullCmd="clobber" taksId="clobber" /><RakeTask description="Build and install leap_salesforce-0.1.11.gem into system gems" fullCmd="install" taksId="install" /><RakeGroup description="" fullCmd="" taksId="install"><RakeTask description="Build and install leap_salesforce-0.1.11.gem into system gems without network access" fullCmd="install:local" taksId="local" /></RakeGroup><RakeGroup description="" fullCmd="" taksId="leaps"><RakeTask description="Create objects, fields, enums" fullCmd="leaps:create_all" taksId="create_all" /><RakeTask description="Create Enumeration objects for picklists from Salesforce Metadata" fullCmd="leaps:create_enums" taksId="create_enums" /><RakeTask description="Create Soql Data objects" fullCmd="leaps:create_soql_objects" taksId="create_soql_objects" /></RakeGroup><RakeTask description="Create tag v0.1.11 and build and push leap_salesforce-0.1.11.gem to rubygems.org" fullCmd="release[remote]" taksId="release[remote]" /><RakeTask description="Run RSpec code examples" fullCmd="spec" taksId="spec" /><RakeTask description="Create stubs for dynamic methods so they're picked up by the IDE" fullCmd="stub" taksId="stub" /><RakeTask description="" fullCmd="default" taksId="default" /><RakeTask description="" fullCmd="release" taksId="release" /><RakeGroup description="" fullCmd="" taksId="release"><RakeTask description="" fullCmd="release:guard_clean" taksId="guard_clean" /><RakeTask description="" fullCmd="release:rubygem_push" taksId="rubygem_push" /><RakeTask description="" fullCmd="release:source_control_push" taksId="source_control_push" /></RakeGroup></RakeGroup></Settings>
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="MarkdownExportedFiles">
4
+ <htmlFiles />
5
+ <imageFiles />
6
+ <otherFiles />
7
+ </component>
8
+ </project>
data/ChangeLog CHANGED
@@ -1,3 +1,10 @@
1
+ Version 0.1.12
2
+ * Enhancements
3
+ * Add contact factory to source control so it can be used to demonstrate traits and associations
4
+ * Provide 2 more ways of creating objects.
5
+ * Through specifying hash on 'new'
6
+ * Through 'create' which calls FactoryBot for itself
7
+
1
8
  Version 0.1.11
2
9
  * Enhancements
3
10
  * Set retry limit to 0 for OAuth as retrying too many times causes user to be locked
data/PITCHME.md ADDED
@@ -0,0 +1,110 @@
1
+ # Leap Salesforce
2
+
3
+ Making Salesforce testing easy
4
+
5
+ ---
6
+
7
+ ## Contents
8
+
9
+ * What does this library do
10
+ * Bootstrap of test automation suite from Salesforce credentials
11
+ * Verification of Salesforce on different levels
12
+ * Creation of objects
13
+ * Querying for objects
14
+ * Updating objects
15
+ * Deleting objects
16
+
17
+ ---
18
+
19
+ ## What it does
20
+
21
+ Makes it easy to create integrated tests using Salesforce API with Ruby objects that map to objects in Salesforce.
22
+ Ruby gem is open source and has many convenience methods to performing actions that form automated tests.
23
+
24
+ ---
25
+
26
+ ## Bootstrapping test automation suite
27
+
28
+ * Install gem
29
+ * From Salesforce credentials create a full automation suite
30
+ * See a recording of running through this [here](https://asciinema.org/a/259098)
31
+
32
+ ---
33
+
34
+ ## Verification on different levels
35
+
36
+ From faster with broadest coverage to slower and harder to maintain
37
+
38
+ * Metadata
39
+ * System
40
+ * Integration
41
+ * UI
42
+
43
+ ---
44
+
45
+ ## Metadata
46
+
47
+ Creating a baseline of Metadata and checking what has changed (For example, the values in a picklist can be
48
+ recorded and then every time there's a change, the test will be to whether the values are the same. The baseline
49
+ can be re-recorded easily when a change is meant to occur).
50
+
51
+ ---
52
+
53
+ ## System
54
+
55
+ Entities can have single actions on them and a small step checked. (For example, not setting all mandatory fields
56
+ can be checked to see if an error message occurs or an update could be made to an object that automatically creates
57
+ another object which can be verified)
58
+
59
+ ---
60
+
61
+ ## Integration
62
+
63
+ Business processes that verify the integration of entities, automated processes, third party systems, etc
64
+
65
+ ---
66
+
67
+ ## UI
68
+
69
+ Crucial actions can be performed via the UI to verify the User interface.
70
+ At the moment this library does not assist in UI testing but the plan is
71
+ to accommodate this in the future through page objects that are tied to
72
+ metadata.
73
+
74
+ ---
75
+
76
+ ## Creation of data
77
+
78
+ ---?code=spec/integration/creating_spec.rb&lang=ruby&title=Creating entities
79
+
80
+ @[1](Declare what it is you're testing)
81
+ @[2](Define what 'it' is, a the object under test must do)
82
+ @[3](Create an instance of the object class - nothing sent to Salesforce yet)
83
+ @[4-5](Set the first and last name to random names)
84
+ @[6](Create the object in Salesforce by sending request via API)
85
+ @[7](Verify creation was successful)
86
+ @[9-12](Creating through Factory)
87
+
88
+ ---
89
+
90
+ ## Reading data
91
+
92
+ ---?code=spec/integration/query_spec.rb&lang=ruby&title=Querying entities
93
+
94
+ @[6](Find an object using a specific attribute specific value)
95
+ @[19](Find an object using a comparator)
96
+
97
+ ---
98
+
99
+ ## Updating and deleting data
100
+
101
+ ---?code=spec/integration/crud_eg_spec.rb&lang=ruby&title=Updating entities
102
+
103
+ @[7-8,19-20](Update first name using 'first_name' setting)
104
+ @[23](Delete test contact)
105
+
106
+ ---
107
+
108
+ ## Thank you
109
+
110
+ Any questions?
data/PITCHME.yaml ADDED
@@ -0,0 +1,2 @@
1
+
2
+ logo : assets/img/logo.png
data/README.md CHANGED
@@ -50,7 +50,8 @@ E.g.,
50
50
 
51
51
  `rake` # Run all tests
52
52
 
53
- API Traffic logs can be seen in the `logs` folder. You can see an example of running through this [here](https://asciinema.org/a/259098)
53
+ API Traffic logs can be seen in the `logs` folder. You can see an example of running through
54
+ this [here](https://asciinema.org/a/259098).
54
55
 
55
56
  ### Understanding how things work
56
57
 
@@ -158,6 +159,8 @@ Everyone interacting in the LeapSalesforce project’s codebases, issue trackers
158
159
 
159
160
  # Examples
160
161
 
162
+ See [spec/integration](spec/integration) folder for examples of tests.
163
+
161
164
  ```ruby
162
165
  # deleting old contacts
163
166
  objects = Contact.each_id_with CreatedDate: "<#{5.days.ago}"
@@ -167,3 +170,7 @@ objects.each do |id|
167
170
  Contact.delete id
168
171
  end
169
172
  ```
173
+
174
+ # References
175
+
176
+ See the presentation on this [here](https://gitpitch.com/leap-dojo/leap_salesforce?grs=gitlab)
Binary file
@@ -6,7 +6,7 @@ require 'soaspec'
6
6
  Soaspec::OAuth2.refresh_token = :once # Save access token and reuse it
7
7
  Soaspec.log_warnings = false # Log any API warnings
8
8
  Soaspec::OAuth2.request_message = false
9
- Soaspec::OAuth2.retry_limit = 0 # Retrying for OAuth token results in error
9
+ Soaspec::OAuth2.retry_limit = 1 # Retrying for OAuth token too many times results in user locked out
10
10
  require 'active_support/core_ext/integer/time' # Creating time objects
11
11
  require 'leap_salesforce/parameters'
12
12
  require 'leap_salesforce/ext/string'
@@ -26,13 +26,18 @@ class SoqlData < Exchange
26
26
  # contact.last_name = 'Smith'
27
27
  # contact.save! # API request made at this point
28
28
  #
29
+ # @example Create a Contact by specifying field names
30
+ # contact = Contact.new first_name: 'Bob', last_name: 'Smith'
31
+ # contact.save!
32
+ #
29
33
  # @example Create a contact using a factory with a trait of :email
30
34
  # contact_with_email = FactoryBot.create(:contact, :email)
31
35
  #
32
36
  # @example Perform a get to the Salesforce limits api
33
37
  # SoqlData.new("Limits", method: :get, suburl: 'limits/')
34
38
  #
35
- # @param [String] name Name describing object. Defaults to itself
39
+ # @param [String, Hash] name Name describing object. Defaults to itself. If Hash is provided
40
+ # with no 'http_parameters' then list will be fields to set on creating entity
36
41
  # @param [Hash] http_parameters Parameters used in making HTTP request. If creating a new object
37
42
  # leave this to empty. Otherwise Hash would look like method: :get, suburl: 'URL_AFTER_SOQL_HANDLER_BASE_URL'
38
43
  def initialize(name = nil, http_parameters = {})
@@ -44,6 +49,17 @@ class SoqlData < Exchange
44
49
  self.suburl = "sobjects/#{table_name}"
45
50
  optional_name = self.class.to_s == table_name ? '' : "(#{table_name})"
46
51
  self.test_name = "Factory for '#{self.class}'#{optional_name}" unless name
52
+ return unless name.is_a? Hash
53
+
54
+ name.each do |field_name, field_value|
55
+ send("#{field_name}=", field_value)
56
+ end
57
+ end
58
+
59
+ # Create object using FactoryBot
60
+ # @param [Hash] factory_parameters Parameters to pass to FactoryBot
61
+ def self.create(*factory_parameters)
62
+ FactoryBot.create(to_s.snakecase.to_sym, *factory_parameters)
47
63
  end
48
64
 
49
65
  # @return [String] User used to make api calls
@@ -2,5 +2,5 @@
2
2
 
3
3
  module LeapSalesforce
4
4
  # @return [String] Version of leap salesforce
5
- VERSION = '0.1.11'
5
+ VERSION = '0.1.12'
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: leap_salesforce
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.11
4
+ version: 0.1.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - IQA
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2019-07-28 00:00:00.000000000 Z
12
+ date: 2019-07-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -237,6 +237,7 @@ files:
237
237
  - ".idea/.rakeTasks"
238
238
  - ".idea/dictionaries/iqa.xml"
239
239
  - ".idea/leap-salesforce.iml"
240
+ - ".idea/markdown-exported-files.xml"
240
241
  - ".idea/markdown-navigator.xml"
241
242
  - ".idea/markdown-navigator/profiles_settings.xml"
242
243
  - ".idea/misc.xml"
@@ -249,8 +250,11 @@ files:
249
250
  - ChangeLog
250
251
  - Gemfile
251
252
  - LICENSE.txt
253
+ - PITCHME.md
254
+ - PITCHME.yaml
252
255
  - README.md
253
256
  - Rakefile
257
+ - assets/img/logo.png
254
258
  - bin/console
255
259
  - bin/setup
256
260
  - config/environments/prod.rb