leap_salesforce 0.2.9 → 0.2.10

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c4dc5bd26b8412061706ac98895eea74b76075b089d5cec455d9d7450231dff4
4
- data.tar.gz: 552ef5630394b37404ffa40a14cba794b81d5edc91489b0fa92241f1124cc328
3
+ metadata.gz: 2b4228bbc91ae1dffc9760add16a38dbf863b4109e3091ffc7b022303fc7e665
4
+ data.tar.gz: 21c8daf87f6078118de270eecbf9ca680571ec0040d115f16f64840b27a86188
5
5
  SHA512:
6
- metadata.gz: a582df7a920c314bcaa3b776d6dacfcab03ca4af1b6f49c2b6544a560547cfa6fc83707c2d2af40da69ca91241d0bd63d93ee32613fc0f03b06109485e37cda1
7
- data.tar.gz: d71765c646e4d356943fdc50309fe395a0cae3a15d98200fc18e78e4135c819258c6d095a359fb446ec51bd18fb490fcb9784765b0a49016574d932e8ae28d20
6
+ metadata.gz: 2b1c45e827fb9866c5901aa8b085c6452e885cc54b076cbf7dc3176abf78d25de6195335efe97a7872ecb634e2eb72badf76c121fbe659ff3f40140ff4d9de4e
7
+ data.tar.gz: ca9ca1edbb4919fba1b6895262de9b4e3389048756319b62320562e528f9fe48028e20f8f6157031d2015e4c50248865ffe731d3c73c2ddf751068f19c22232a
@@ -23,24 +23,24 @@
23
23
  <orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.3, RVM: ruby-2.6.5) [gem]" level="application" />
24
24
  <orderEntry type="library" scope="PROVIDED" name="domain_name (v0.5.20190701, RVM: ruby-2.6.5) [gem]" level="application" />
25
25
  <orderEntry type="library" scope="PROVIDED" name="factory_bot (v5.1.1, RVM: ruby-2.6.5) [gem]" level="application" />
26
- <orderEntry type="library" scope="PROVIDED" name="faker (v2.5.0, RVM: ruby-2.6.5) [gem]" level="application" />
26
+ <orderEntry type="library" scope="PROVIDED" name="faker (v2.6.0, RVM: ruby-2.6.5) [gem]" level="application" />
27
27
  <orderEntry type="library" scope="PROVIDED" name="gyoku (v1.3.1, RVM: ruby-2.6.5) [gem]" level="application" />
28
28
  <orderEntry type="library" scope="PROVIDED" name="hashie (v3.6.0, RVM: ruby-2.6.5) [gem]" level="application" />
29
29
  <orderEntry type="library" scope="PROVIDED" name="http-accept (v1.7.0, RVM: ruby-2.6.5) [gem]" level="application" />
30
30
  <orderEntry type="library" scope="PROVIDED" name="http-cookie (v1.0.3, RVM: ruby-2.6.5) [gem]" level="application" />
31
31
  <orderEntry type="library" scope="PROVIDED" name="httpi (v2.4.4, RVM: ruby-2.6.5) [gem]" level="application" />
32
- <orderEntry type="library" scope="PROVIDED" name="humanize (v2.1.2, RVM: ruby-2.6.5) [gem]" level="application" />
33
- <orderEntry type="library" scope="PROVIDED" name="i18n (v1.6.0, RVM: ruby-2.6.5) [gem]" level="application" />
32
+ <orderEntry type="library" scope="PROVIDED" name="humanize (v2.3.0, RVM: ruby-2.6.5) [gem]" level="application" />
33
+ <orderEntry type="library" scope="PROVIDED" name="i18n (v1.7.0, RVM: ruby-2.6.5) [gem]" level="application" />
34
34
  <orderEntry type="library" scope="PROVIDED" name="jaro_winkler (v1.5.3, RVM: ruby-2.6.5) [gem]" level="application" />
35
- <orderEntry type="library" scope="PROVIDED" name="jsonpath (v1.0.4, RVM: ruby-2.6.5) [gem]" level="application" />
35
+ <orderEntry type="library" scope="PROVIDED" name="jsonpath (v1.0.5, RVM: ruby-2.6.5) [gem]" level="application" />
36
36
  <orderEntry type="library" scope="PROVIDED" name="kramdown (v2.1.0, RVM: ruby-2.6.5) [gem]" level="application" />
37
37
  <orderEntry type="library" scope="PROVIDED" name="launchy (v2.4.3, RVM: ruby-2.6.5) [gem]" level="application" />
38
38
  <orderEntry type="library" scope="PROVIDED" name="method_source (v0.9.2, RVM: ruby-2.6.5) [gem]" level="application" />
39
39
  <orderEntry type="library" scope="PROVIDED" name="mime-types (v3.3, RVM: ruby-2.6.5) [gem]" level="application" />
40
- <orderEntry type="library" scope="PROVIDED" name="mime-types-data (v3.2019.0904, RVM: ruby-2.6.5) [gem]" level="application" />
40
+ <orderEntry type="library" scope="PROVIDED" name="mime-types-data (v3.2019.1009, RVM: ruby-2.6.5) [gem]" level="application" />
41
41
  <orderEntry type="library" scope="PROVIDED" name="mini_portile2 (v2.4.0, RVM: ruby-2.6.5) [gem]" level="application" />
42
42
  <orderEntry type="library" scope="PROVIDED" name="minitest (v5.12.2, RVM: ruby-2.6.5) [gem]" level="application" />
43
- <orderEntry type="library" scope="PROVIDED" name="multi_json (v1.13.1, RVM: ruby-2.6.5) [gem]" level="application" />
43
+ <orderEntry type="library" scope="PROVIDED" name="multi_json (v1.14.1, RVM: ruby-2.6.5) [gem]" level="application" />
44
44
  <orderEntry type="library" scope="PROVIDED" name="mustermann (v1.0.3, RVM: ruby-2.6.5) [gem]" level="application" />
45
45
  <orderEntry type="library" scope="PROVIDED" name="netrc (v0.11.0, RVM: ruby-2.6.5) [gem]" level="application" />
46
46
  <orderEntry type="library" scope="PROVIDED" name="nokogiri (v1.10.4, RVM: ruby-2.6.5) [gem]" level="application" />
@@ -56,20 +56,20 @@
56
56
  <orderEntry type="library" scope="PROVIDED" name="random-port (v0.5.1, RVM: ruby-2.6.5) [gem]" level="application" />
57
57
  <orderEntry type="library" scope="PROVIDED" name="require_all (v2.0.0, RVM: ruby-2.6.5) [gem]" level="application" />
58
58
  <orderEntry type="library" scope="PROVIDED" name="rest-client (v2.1.0, RVM: ruby-2.6.5) [gem]" level="application" />
59
- <orderEntry type="library" scope="PROVIDED" name="rspec (v3.8.0, RVM: ruby-2.6.5) [gem]" level="application" />
59
+ <orderEntry type="library" scope="PROVIDED" name="rspec (v3.9.0, RVM: ruby-2.6.5) [gem]" level="application" />
60
60
  <orderEntry type="library" scope="PROVIDED" name="rspec-core (v3.8.2, RVM: ruby-2.6.5) [gem]" level="application" />
61
61
  <orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v3.8.6, RVM: ruby-2.6.5) [gem]" level="application" />
62
62
  <orderEntry type="library" scope="PROVIDED" name="rspec-its (v1.3.0, RVM: ruby-2.6.5) [gem]" level="application" />
63
63
  <orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v3.8.2, RVM: ruby-2.6.5) [gem]" level="application" />
64
64
  <orderEntry type="library" scope="PROVIDED" name="rspec-support (v3.8.3, RVM: ruby-2.6.5) [gem]" level="application" />
65
- <orderEntry type="library" scope="PROVIDED" name="rubocop (v0.75.0, RVM: ruby-2.6.5) [gem]" level="application" />
65
+ <orderEntry type="library" scope="PROVIDED" name="rubocop (v0.75.1, RVM: ruby-2.6.5) [gem]" level="application" />
66
66
  <orderEntry type="library" scope="PROVIDED" name="ruby-progressbar (v1.10.1, RVM: ruby-2.6.5) [gem]" level="application" />
67
67
  <orderEntry type="library" scope="PROVIDED" name="rubykeyword (v0.0.4, RVM: ruby-2.6.5) [gem]" level="application" />
68
68
  <orderEntry type="library" scope="PROVIDED" name="savon (v2.12.0, RVM: ruby-2.6.5) [gem]" level="application" />
69
69
  <orderEntry type="library" scope="PROVIDED" name="sinatra (v2.0.4, RVM: ruby-2.6.5) [gem]" level="application" />
70
70
  <orderEntry type="library" scope="PROVIDED" name="sinatra-basic-auth (v0.1.0, RVM: ruby-2.6.5) [gem]" level="application" />
71
71
  <orderEntry type="library" scope="PROVIDED" name="sinatra-docdsl (v0.8.6, RVM: ruby-2.6.5) [gem]" level="application" />
72
- <orderEntry type="library" scope="PROVIDED" name="soaspec (v0.3.1, RVM: ruby-2.6.5) [gem]" level="application" />
72
+ <orderEntry type="library" scope="PROVIDED" name="soaspec (v0.3.2, RVM: ruby-2.6.5) [gem]" level="application" />
73
73
  <orderEntry type="library" scope="PROVIDED" name="socksify (v1.7.1, RVM: ruby-2.6.5) [gem]" level="application" />
74
74
  <orderEntry type="library" scope="PROVIDED" name="thor (v0.20.3, RVM: ruby-2.6.5) [gem]" level="application" />
75
75
  <orderEntry type="library" scope="PROVIDED" name="thread_safe (v0.3.6, RVM: ruby-2.6.5) [gem]" level="application" />
@@ -84,7 +84,7 @@
84
84
  <orderEntry type="library" scope="PROVIDED" name="xml-simple (v1.1.5, RVM: ruby-2.6.5) [gem]" level="application" />
85
85
  <orderEntry type="library" scope="PROVIDED" name="yard (v0.9.20, RVM: ruby-2.6.5) [gem]" level="application" />
86
86
  <orderEntry type="library" scope="PROVIDED" name="yard-doctest (v0.1.17, RVM: ruby-2.6.5) [gem]" level="application" />
87
- <orderEntry type="library" scope="PROVIDED" name="zeitwerk (v2.1.10, RVM: ruby-2.6.5) [gem]" level="application" />
87
+ <orderEntry type="library" scope="PROVIDED" name="zeitwerk (v2.2.0, RVM: ruby-2.6.5) [gem]" level="application" />
88
88
  </component>
89
89
  <component name="RModuleSettingsStorage">
90
90
  <LOAD_PATH number="1" string0="$MODULE_DIR$/spec/support" />
@@ -6,7 +6,7 @@ soql_objects:
6
6
  - Contact
7
7
  - Document: ContentDocument
8
8
  - User:
9
- create_enum: false
9
+ create_enum: true # Set this to false to not track enums for object
10
10
  - Group
11
11
  - Broker: Broker__c
12
12
  - Account
data/ChangeLog CHANGED
@@ -1,7 +1,11 @@
1
- Version 0.2.9
1
+ Version 0.2.10
2
2
  * Enhancement
3
3
  * LeapSalesforce::Users
4
4
  * any? method to check whether user is defined
5
+
6
+ Version 0.2.9
7
+ * Enhancement
8
+ * LeapSalesforce::Users
5
9
  * execute_as_if_present to temporarily switch to another user if they exist
6
10
 
7
11
  Version 0.2.8
@@ -3,6 +3,7 @@
3
3
  # Add users to LeapSalesforce context. First user is the default
4
4
  module LeapSalesforce
5
5
  Users.add User.new :admin, 'samuel.garratt@brave-otter-ttxype.com'
6
+ Users.add User.new :not_there, 'not.there@brave-otter-ttxype.com'
6
7
  end
7
8
 
8
9
  ENV['SF_USERNAME'] = 'samuel.garratt@brave-otter-ttxype.com'
@@ -2,13 +2,16 @@
2
2
 
3
3
  module LeapSalesforce
4
4
  # A test user used to execute tests
5
+ # TODO: Handle approach of assigning a profile including role hierarchy.
6
+ # I.e, Sales user and Sales Manager have one role but different position
5
7
  class User
6
8
  # @return [String] Name to identify user by
7
9
  attr_accessor :key
8
10
  # @return [String] Username of User interpreted by ERB (in email address format). Use ERB to define users that can vary
9
11
  # according to environment
10
12
  attr_writer :username
11
- # @return [String] Long form description of user. Could be used to reference them in a Cucumber test
13
+ # @return [String] Long form description of user. Could be used to reference them where a human
14
+ # readable format is required such as in a Cucumber test
12
15
  attr_accessor :description
13
16
 
14
17
  # @param [String, Symbol] key Key used to identify a test user
@@ -19,7 +22,21 @@ module LeapSalesforce
19
22
  self.description = description
20
23
  end
21
24
 
22
- # @return [String] Email address of User
25
+ # Query for user in Salesforce instance
26
+ # @return [Boolean] Whether Salesforce user exists in environment running against
27
+ def exists?
28
+ if defined? ::User
29
+ Users.execute_as_if_present key: :admin do
30
+ ::User.any?(username: username)
31
+ end
32
+ else
33
+ raise LeapSalesforce::SetupError, "'User' class must be defined " \
34
+ " to check presence of user in environment #{LeapSalesforce.environment}"
35
+ end
36
+ end
37
+
38
+ # @return [String] Username of User interpreted by ERB (in email address format).
39
+ # Use ERB to define users that can vary according to environment
23
40
  def username
24
41
  ERB.new(@username).result(binding)
25
42
  end
@@ -33,14 +33,16 @@ module LeapSalesforce
33
33
 
34
34
  # Execute block as user matching filter if that user is present
35
35
  # If user is not present the current user will be used
36
+ # @return [Object] Result of block
36
37
  def execute_as_if_present(filter)
37
38
  raise ArgumentError, 'Pass block to :execute_as_if_present method' unless block_given?
38
39
 
39
40
  current_user = LeapSalesforce.api_user
40
41
  if any? filter
41
42
  LeapSalesforce.api_user = LeapSalesforce::Users.where filter
42
- yield
43
+ result = yield
43
44
  LeapSalesforce.api_user = current_user
45
+ result
44
46
  else
45
47
  LeapSalesforce.logger.warn "No user found user filter #{filter}, using '#{current_user}'"
46
48
  yield
@@ -2,5 +2,5 @@
2
2
 
3
3
  module LeapSalesforce
4
4
  # @return [String] Version of leap salesforce
5
- VERSION = '0.2.9'
5
+ VERSION = '0.2.10'
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.2.9
4
+ version: 0.2.10
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-10-16 00:00:00.000000000 Z
12
+ date: 2019-10-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler