activeforce 1.9.1 → 1.10.0

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: 6ea91427358fe2a99e7e387cd93f2fb29e2d46f4
4
- data.tar.gz: 5896f0d50d1fe3c34db359eaf163202b90d254c0
3
+ metadata.gz: 69123682a6ac617075d98685ea650011159ccd3c
4
+ data.tar.gz: c9e794312166984a669adb8751e02d24f372b952
5
5
  SHA512:
6
- metadata.gz: 671e1b7c312c8b3cacde63befeb14456f845de87d0da6537272f727c2118adafa6e5d7592dc6688056a5751875b7949ffbe57a3ba84cf6e49c97aae74114084e
7
- data.tar.gz: e7421931c6ae2de95efa9a5be5686ffab6e3e4bb3ecf4618c11a8d0c64e277bbd3ac6df6d88fc09cf7b1b1e6192fea55db13bdfbcf920f8401f6d165349859a9
6
+ metadata.gz: a6ef3998eb4a67f84adf2c430b2e2e7885547360d21946b302021c8c966f9f76fc631079a71aecfefd08251966c87ac66e62ea2ca8facf20340a9085b408e708
7
+ data.tar.gz: 57b871a7e9294e09710b09c29f24e3ab4d1ff9e6a33e4825d23007f4fcba0f73defc8b12a0e5257ed3f175e8363ad7689441a5bb47a3fdd220768f009e6c58c2
data/.gitignore CHANGED
@@ -16,3 +16,5 @@ tmp
16
16
  .yardoc
17
17
  _yardoc
18
18
  doc/
19
+
20
+ Gemfile.lock
data/.travis.yml ADDED
@@ -0,0 +1,17 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1.4
4
+ - 2.0.0
5
+ - 1.9.3
6
+ - ruby-head
7
+
8
+ sudo: false
9
+
10
+ matrix:
11
+ allow_failures:
12
+ - rvm: ruby-head
13
+
14
+ gemfile:
15
+ - gemfiles/4.0.gemfile
16
+ - gemfiles/4.1.gemfile
17
+ - gemfiles/4.2.gemfile
data/Appraisals ADDED
@@ -0,0 +1,11 @@
1
+ appraise "4.0" do
2
+ gem "rails", "~> 4.0.0"
3
+ end
4
+
5
+ appraise "4.1" do
6
+ gem "rails", "~> 4.1.0"
7
+ end
8
+
9
+ appraise "4.2" do
10
+ gem "rails", "~> 4.2"
11
+ end
data/Gemfile CHANGED
@@ -1,7 +1,6 @@
1
- source "http://rubygems.org"
1
+ source "https://rubygems.org"
2
2
 
3
3
  gemspec
4
4
 
5
+ gem 'appraisal'
5
6
  gem 'mocha', '0.14.0', :require => false
6
- gem "yard", "~> 0.6.0"
7
- gem "bundler", "~> 1.0"
data/README.md CHANGED
@@ -1,7 +1,12 @@
1
1
  # ActiveForce
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/activeforce.svg)](http://badge.fury.io/rb/activeforce)
4
+ [![Build Status](https://travis-ci.org/appfolio/activeforce.svg?branch=master)](https://travis-ci.org/appfolio/activeforce)
5
+
3
6
  Activeforce provides a clean ActiveRecord-like interface to the SalesForce.com REST API.
4
7
 
8
+ Activeforce does not provide any integration with any Appfolio products.
9
+
5
10
  * Detects the schema of the SalesForce Objects on the fly, so that you can interact with the familiar ActiveRecord style attribute accessor methods.
6
11
  * Provides full access to all methods provided to the SQL-like Salesforce Object Query Language (SOQL).
7
12
  * Integrates with Salesforce.com REST-based BULK API.
data/Rakefile CHANGED
@@ -11,6 +11,7 @@ rescue Bundler::BundlerError => e
11
11
  end
12
12
 
13
13
  require 'rake'
14
+ require 'appraisal'
14
15
 
15
16
  require 'bundler/gem_tasks'
16
17
 
@@ -22,6 +23,3 @@ Rake::TestTask.new(:test) do |test|
22
23
  end
23
24
 
24
25
  task :default => :test
25
-
26
- require 'yard'
27
- YARD::Rake::YardocTask.new
data/activeforce.gemspec CHANGED
@@ -21,10 +21,10 @@ Gem::Specification.new do |s|
21
21
  s.rubygems_version = "2.0.3"
22
22
  s.summary = "A Simple gem to interact with the Salesforce REST API"
23
23
 
24
- s.add_dependency(%q<rails>, [">= 3.0"])
24
+ s.add_dependency(%q<rails>, [">= 4.0", "< 5.0"])
25
25
  s.add_dependency(%q<savon>, ["~> 1.0"])
26
26
  s.add_dependency(%q<blockenspiel>, [">= 0"])
27
- s.add_dependency(%q<rest-client>, [">= 0"])
27
+ s.add_dependency(%q<rest-client>, [">= 0", '< 2.0'])
28
28
  s.add_dependency(%q<fastercsv>, [">= 0"])
29
29
  end
30
30
 
@@ -0,0 +1,9 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "appraisal"
6
+ gem "mocha", "0.14.0", :require => false
7
+ gem "rails", "~> 4.0.0"
8
+
9
+ gemspec :path => "../"
@@ -0,0 +1,9 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "appraisal"
6
+ gem "mocha", "0.14.0", :require => false
7
+ gem "rails", "~> 4.1.0"
8
+
9
+ gemspec :path => "../"
@@ -0,0 +1,9 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "appraisal"
6
+ gem "mocha", "0.14.0", :require => false
7
+ gem "rails", "~> 4.2"
8
+
9
+ gemspec :path => "../"
@@ -1,3 +1,3 @@
1
1
  module Activeforce
2
- VERSION = '1.9.1'.freeze
2
+ VERSION = '1.10.0'.freeze
3
3
  end
@@ -12,7 +12,12 @@ module Salesforce
12
12
  result = Connection.login
13
13
  Config.instance.soap_endpoint_url result[:server_url]
14
14
  Config.instance.session_id result[:session_id]
15
- Config.instance.server_instance URI.parse(result[:server_url]).host[/(na|cs)\d+/]
15
+
16
+ host = URI.parse(result[:server_url]).host
17
+ host_match = host.match(/(?<instance>[a-z0-9\-]+)\.(?<domain>(?:my\.)?salesforce\.com)/)
18
+
19
+ Config.instance.server_instance host_match[:instance]
20
+ Config.instance.server_domain host_match[:domain]
16
21
  Config.instance.user_id result[:user_id]
17
22
  Config.session_id
18
23
  end
@@ -57,7 +57,7 @@ module Salesforce
57
57
  end
58
58
 
59
59
  def temporary_csv_file
60
- if Object.const_defined?(:Rails)
60
+ if Object.const_defined?(:Rails) && Rails.root.present?
61
61
  Rails.root.join('tmp', 'files', "#{ Time.now.to_i}#{rand(10000)}.csv")
62
62
  else
63
63
  File.join("/tmp/#{ Time.now.to_i}#{rand(10000)}.csv")
@@ -6,11 +6,11 @@ module Salesforce
6
6
  include Blockenspiel::DSL
7
7
  include Blockenspiel::DSLSetupMethods
8
8
 
9
- dsl_attr_accessor :session_id, :server_instance, :user_id, :soap_endpoint_url
9
+ dsl_attr_accessor :session_id, :server_instance, :server_domain, :user_id, :soap_endpoint_url
10
10
 
11
11
  [
12
12
  :username, :password, :api_version, :use_sandbox?, :use_full_length_ids?,
13
- :login_url, :session_id, :server_instance, :soap_endpoint_url, :soap_enterprise_namespace,
13
+ :login_url, :session_id, :server_instance, :server_domain, :soap_endpoint_url, :soap_enterprise_namespace,
14
14
  :user_id, :server_url, :server_host, :async_url, :configured?, :on_login_failure ].each do |method_name|
15
15
  eval <<-RUBY
16
16
  def self.#{method_name}
@@ -51,7 +51,7 @@ module Salesforce
51
51
  if val
52
52
  @api_version = val.to_f.to_s
53
53
  else
54
- @api_version || DEFAULT_API_VERSION
54
+ @api_version ||= DEFAULT_API_VERSION
55
55
  end
56
56
  end
57
57
 
@@ -88,15 +88,15 @@ module Salesforce
88
88
  end
89
89
 
90
90
  def server_url
91
- "https://#{server_instance}.salesforce.com/services/data/v#{api_version}"
91
+ "https://#{server_instance}.#{server_domain}/services/data/v#{api_version}"
92
92
  end
93
93
 
94
94
  def server_host
95
- "https://#{server_instance}.salesforce.com"
95
+ "https://#{server_instance}.#{server_domain}"
96
96
  end
97
97
 
98
98
  def async_url
99
- "https://#{server_instance}.salesforce.com/services/async/#{api_version}"
99
+ "https://#{server_instance}.#{server_domain}/services/async/#{api_version}"
100
100
  end
101
101
 
102
102
  def login_url
@@ -46,7 +46,25 @@ class Salesforce::AuthenticationTest < ActiveSupport::TestCase
46
46
  assert_equal "https://cs99.salesforce.com/services/Soap/c/22.0/00DQ00000001LRX", Salesforce::Config.soap_endpoint_url
47
47
  assert_equal "session_id", Salesforce::Config.session_id
48
48
  assert_equal "cs99", Salesforce::Config.server_instance
49
+ assert_equal "salesforce.com", Salesforce::Config.server_domain
50
+ assert_equal "user_id", Salesforce::Config.user_id
51
+ end
52
+
53
+ def test_generate_new_session_id__calls_connection_login__my_domain
54
+ result = {
55
+ :session_id => "session_id",
56
+ :server_url => "https://awesome-2000.my.salesforce.com/services/Soap/c/22.0/00DQ00000001LRX",
57
+ :user_id => "user_id"
58
+ }
59
+
60
+ Salesforce.connection.expects(:login).returns(result)
61
+
62
+ assert_equal "session_id", Salesforce::Authentication.generate_new_session_id
63
+ assert_equal "https://awesome-2000.my.salesforce.com/services/Soap/c/22.0/00DQ00000001LRX", Salesforce::Config.soap_endpoint_url
64
+ assert_equal "session_id", Salesforce::Config.session_id
65
+ assert_equal "awesome-2000", Salesforce::Config.server_instance
66
+ assert_equal "my.salesforce.com", Salesforce::Config.server_domain
49
67
  assert_equal "user_id", Salesforce::Config.user_id
50
68
  end
51
69
 
52
- end
70
+ end
@@ -78,7 +78,7 @@ class Salesforce::Bulk::BatchTest < ActiveSupport::TestCase
78
78
  end
79
79
 
80
80
  def clear_file
81
- FileUtils.rm_rf(@batch.filename) if @batch.filename.present?
81
+ FileUtils.rm_rf(@batch.filename) if @batch.present? && @batch.filename.present?
82
82
  end
83
83
  end
84
84
 
@@ -39,17 +39,17 @@ class Salesforce::ConfigTest < ActiveSupport::TestCase
39
39
  def test_config__on_login_failure
40
40
  assert_nil Salesforce::Config.on_login_failure
41
41
 
42
- @my_stuff = 0
42
+ my_stuff = 0
43
43
 
44
44
  Salesforce.configure do
45
- on_login_failure { @my_stuff = @my_stuff + 1 }
45
+ on_login_failure { my_stuff = my_stuff + 1 }
46
46
  end
47
47
 
48
48
  Salesforce::Config.on_login_failure
49
- assert_equal 1, @my_stuff
49
+ assert_equal 1, my_stuff
50
50
  Salesforce::Config.on_login_failure
51
51
 
52
- assert_equal 2, @my_stuff
52
+ assert_equal 2, my_stuff
53
53
  end
54
54
 
55
55
  def test_config__specific_api_version
@@ -112,6 +112,9 @@ class Salesforce::ConfigTest < ActiveSupport::TestCase
112
112
 
113
113
  config.server_instance "na99"
114
114
  assert_equal "na99", Salesforce::Config.server_instance
115
+
116
+ config.server_domain "something.salesforce.com"
117
+ assert_equal "something.salesforce.com", Salesforce::Config.server_domain
115
118
 
116
119
  config.user_id "user_id"
117
120
  assert_equal "user_id", Salesforce::Config.user_id
@@ -121,9 +124,10 @@ class Salesforce::ConfigTest < ActiveSupport::TestCase
121
124
  def test_server_url__and_server_host
122
125
  config = Salesforce::Config.instance
123
126
  config.server_instance "sa2"
127
+ config.server_domain "something.salesforce.com"
124
128
  config.api_version 99
125
- assert_equal "https://sa2.salesforce.com/services/data/v99.0", Salesforce::Config.server_url
126
- assert_equal "https://sa2.salesforce.com", Salesforce::Config.server_host
129
+ assert_equal "https://sa2.something.salesforce.com/services/data/v99.0", Salesforce::Config.server_url
130
+ assert_equal "https://sa2.something.salesforce.com", Salesforce::Config.server_host
127
131
  end
128
132
 
129
133
  def test_configured
@@ -160,4 +164,4 @@ class Salesforce::ConfigTest < ActiveSupport::TestCase
160
164
  Salesforce::Config.instance_variable_set(:@instance, nil)
161
165
  end
162
166
 
163
- end
167
+ end
@@ -1,6 +1,11 @@
1
1
  require 'test_helper'
2
2
 
3
3
  class Salesforce.connection::AsyncTest < ActiveSupport::TestCase
4
+ setup do
5
+ Salesforce::Config.instance.server_instance 'awesome-2000'
6
+ Salesforce::Config.instance.server_domain 'something.salesforce.com'
7
+ end
8
+
4
9
  def async_post(path, body, options = {})
5
10
  as_logged_in_user do
6
11
  convert_body RestClient.post(async_api_url(path), body, async_headers(options)), options
@@ -12,7 +17,7 @@ class Salesforce.connection::AsyncTest < ActiveSupport::TestCase
12
17
  def test_async_post__json
13
18
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
14
19
  http_body = stub(:body => { :result => 'foo' }.to_json)
15
- RestClient.expects(:post).with('https://.salesforce.com/services/async/22.0/path', :body, {'X-SFDC-Session' => 'session_id', :content_type => 'application/json'}).returns(http_body)
20
+ RestClient.expects(:post).with('https://awesome-2000.something.salesforce.com/services/async/22.0/path', :body, {'X-SFDC-Session' => 'session_id', :content_type => 'application/json'}).returns(http_body)
16
21
  assert_equal({'result' => 'foo'}, Salesforce.connection.async_post('path', :body, :format => :json))
17
22
  end
18
23
 
@@ -26,7 +31,7 @@ class Salesforce.connection::AsyncTest < ActiveSupport::TestCase
26
31
  assert false, "Shouldn't have gotten here"
27
32
  rescue => e
28
33
  assert_equal "Salesforce::InvalidRequest", e.class.name
29
- assert_equal "MALFORMED_QUERY: someproblem while accessing https://.salesforce.com/services/async/22.0/path", e.message
34
+ assert_equal "MALFORMED_QUERY: someproblem while accessing https://awesome-2000.something.salesforce.com/services/async/22.0/path", e.message
30
35
  end
31
36
  end
32
37
 
@@ -34,14 +39,14 @@ class Salesforce.connection::AsyncTest < ActiveSupport::TestCase
34
39
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
35
40
  error = RestClient::BadRequest.new
36
41
  error.stubs(:http_body).returns("<?xml version=\"1.0\" encoding=\"UTF-8\"?><Errors><Error><errorCode>MALFORMED_QUERY</errorCode><message>someproblem</message></Error></Errors>" )
37
- RestClient.expects(:post).with('https://.salesforce.com/services/async/22.0/path', :body, {'X-SFDC-Session' => 'session_id', :content_type => 'application/xml'}).raises(error)
42
+ RestClient.expects(:post).with('https://awesome-2000.something.salesforce.com/services/async/22.0/path', :body, {'X-SFDC-Session' => 'session_id', :content_type => 'application/xml'}).raises(error)
38
43
 
39
44
  begin
40
45
  Salesforce.connection.async_post('path', :body, :format => :xml)
41
46
  assert false, "Shouldn't have gotten here"
42
47
  rescue => e
43
48
  assert_equal "Salesforce::InvalidRequest", e.class.name
44
- assert_equal "MALFORMED_QUERY: someproblem while accessing https://.salesforce.com/services/async/22.0/path", e.message
49
+ assert_equal "MALFORMED_QUERY: someproblem while accessing https://awesome-2000.something.salesforce.com/services/async/22.0/path", e.message
45
50
  end
46
51
  end
47
52
 
@@ -49,13 +54,13 @@ class Salesforce.connection::AsyncTest < ActiveSupport::TestCase
49
54
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
50
55
  error = RestClient::ResourceNotFound.new
51
56
  error.stubs(:http_body).returns("[{\"message\":\"someproblem\",\"errorCode\":\"MALFORMED_QUERY\"}]")
52
- RestClient.expects(:post).with('https://.salesforce.com/services/async/22.0/path', :body, {'X-SFDC-Session' => 'session_id', :content_type => 'application/json'}).raises(error)
57
+ RestClient.expects(:post).with('https://awesome-2000.something.salesforce.com/services/async/22.0/path', :body, {'X-SFDC-Session' => 'session_id', :content_type => 'application/json'}).raises(error)
53
58
  begin
54
59
  Salesforce.connection.async_post('path', :body, :format => :json)
55
60
  assert false, "Shouldn't have gotten here"
56
61
  rescue => e
57
62
  assert_equal "Salesforce::InvalidRequest", e.class.name
58
- assert_equal "MALFORMED_QUERY: someproblem while accessing https://.salesforce.com/services/async/22.0/path", e.message
63
+ assert_equal "MALFORMED_QUERY: someproblem while accessing https://awesome-2000.something.salesforce.com/services/async/22.0/path", e.message
59
64
  end
60
65
  end
61
66
 
@@ -63,28 +68,28 @@ class Salesforce.connection::AsyncTest < ActiveSupport::TestCase
63
68
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
64
69
  error = RestClient::ResourceNotFound.new
65
70
  error.stubs(:http_body).returns("<?xml version=\"1.0\" encoding=\"UTF-8\"?><Errors><Error><errorCode>MALFORMED_QUERY</errorCode><message>someproblem</message></Error></Errors>" )
66
- RestClient.expects(:post).with('https://.salesforce.com/services/async/22.0/path', :body, {'X-SFDC-Session' => 'session_id', :content_type => 'application/xml'}).raises(error)
71
+ RestClient.expects(:post).with('https://awesome-2000.something.salesforce.com/services/async/22.0/path', :body, {'X-SFDC-Session' => 'session_id', :content_type => 'application/xml'}).raises(error)
67
72
 
68
73
  begin
69
74
  Salesforce.connection.async_post('path', :body, :format => :xml)
70
75
  assert false, "Shouldn't have gotten here"
71
76
  rescue => e
72
77
  assert_equal "Salesforce::InvalidRequest", e.class.name
73
- assert_equal "MALFORMED_QUERY: someproblem while accessing https://.salesforce.com/services/async/22.0/path", e.message
78
+ assert_equal "MALFORMED_QUERY: someproblem while accessing https://awesome-2000.something.salesforce.com/services/async/22.0/path", e.message
74
79
  end
75
80
  end
76
81
 
77
82
  def test_async_post__xml
78
83
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
79
84
  http_body = stub(:body => { :result => 'foo' }.to_xml)
80
- RestClient.expects(:post).with('https://.salesforce.com/services/async/22.0/path', :body, {'X-SFDC-Session' => 'session_id', :content_type => 'application/xml'}).returns(http_body)
85
+ RestClient.expects(:post).with('https://awesome-2000.something.salesforce.com/services/async/22.0/path', :body, {'X-SFDC-Session' => 'session_id', :content_type => 'application/xml'}).returns(http_body)
81
86
  assert_equal({'result' => 'foo'}, Salesforce.connection.async_post('path', :body, :format => :xml))
82
87
  end
83
88
 
84
89
  def test_async_get__json
85
90
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
86
91
  http_body = stub(:body => { :result => 'foo' }.to_json)
87
- RestClient.expects(:get).with('https://.salesforce.com/services/async/22.0/path', {'X-SFDC-Session' => 'session_id', :content_type => 'application/json'}).returns(http_body)
92
+ RestClient.expects(:get).with('https://awesome-2000.something.salesforce.com/services/async/22.0/path', {'X-SFDC-Session' => 'session_id', :content_type => 'application/json'}).returns(http_body)
88
93
  assert_equal({'result' => 'foo'}, Salesforce.connection.async_get('path', :format => :json))
89
94
  end
90
95
 
@@ -92,14 +97,14 @@ class Salesforce.connection::AsyncTest < ActiveSupport::TestCase
92
97
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
93
98
  error = RestClient::BadRequest.new
94
99
  error.stubs(:http_body).returns("[{\"message\":\"someproblem\",\"errorCode\":\"MALFORMED_QUERY\"}]")
95
- RestClient.expects(:get).with('https://.salesforce.com/services/async/22.0/path', {'X-SFDC-Session' => 'session_id', :content_type => 'application/json'}).raises(error)
100
+ RestClient.expects(:get).with('https://awesome-2000.something.salesforce.com/services/async/22.0/path', {'X-SFDC-Session' => 'session_id', :content_type => 'application/json'}).raises(error)
96
101
 
97
102
  begin
98
103
  Salesforce.connection.async_get('path', :format => :json)
99
104
  assert false, "Shouldn't have gotten here"
100
105
  rescue => e
101
106
  assert_equal "Salesforce::InvalidRequest", e.class.name
102
- assert_equal "MALFORMED_QUERY: someproblem while accessing https://.salesforce.com/services/async/22.0/path", e.message
107
+ assert_equal "MALFORMED_QUERY: someproblem while accessing https://awesome-2000.something.salesforce.com/services/async/22.0/path", e.message
103
108
  end
104
109
  end
105
110
 
@@ -107,26 +112,26 @@ class Salesforce.connection::AsyncTest < ActiveSupport::TestCase
107
112
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
108
113
  error = RestClient::BadRequest.new
109
114
  error.stubs(:http_body).returns("<?xml version=\"1.0\" encoding=\"UTF-8\"?><Errors><Error><errorCode>MALFORMED_QUERY</errorCode><message>someproblem</message></Error></Errors>" )
110
- RestClient.expects(:get).with('https://.salesforce.com/services/async/22.0/path', {'X-SFDC-Session' => 'session_id', :content_type => 'application/xml'}).raises(error)
115
+ RestClient.expects(:get).with('https://awesome-2000.something.salesforce.com/services/async/22.0/path', {'X-SFDC-Session' => 'session_id', :content_type => 'application/xml'}).raises(error)
111
116
 
112
117
  begin
113
118
  Salesforce.connection.async_get('path', :format => :xml)
114
119
  assert false, "Shouldn't have gotten here"
115
120
  rescue => e
116
121
  assert_equal "Salesforce::InvalidRequest", e.class.name
117
- assert_equal "MALFORMED_QUERY: someproblem while accessing https://.salesforce.com/services/async/22.0/path", e.message
122
+ assert_equal "MALFORMED_QUERY: someproblem while accessing https://awesome-2000.something.salesforce.com/services/async/22.0/path", e.message
118
123
  end
119
124
  end
120
125
 
121
126
  def test_async_get__xml
122
127
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
123
128
  http_body = stub(:body => { :result => 'foo' }.to_xml)
124
- RestClient.expects(:get).with('https://.salesforce.com/services/async/22.0/path', {'X-SFDC-Session' => 'session_id', :content_type => 'application/xml'}).returns(http_body)
129
+ RestClient.expects(:get).with('https://awesome-2000.something.salesforce.com/services/async/22.0/path', {'X-SFDC-Session' => 'session_id', :content_type => 'application/xml'}).returns(http_body)
125
130
  assert_equal({'result' => 'foo'}, Salesforce.connection.async_get('path', :format => :xml))
126
131
  end
127
132
 
128
133
  def test_async_api_url
129
- assert_equal 'https://.salesforce.com/services/async/22.0/path', Salesforce.connection.async_api_url('path')
134
+ assert_equal 'https://awesome-2000.something.salesforce.com/services/async/22.0/path', Salesforce.connection.async_api_url('path')
130
135
  end
131
136
 
132
137
 
@@ -1,6 +1,11 @@
1
1
  require 'test_helper'
2
2
 
3
3
  class Salesforce.connection::HttpMethodsTest < ActiveSupport::TestCase
4
+ setup do
5
+ Salesforce::Config.instance.server_instance 'awesome-2000'
6
+ Salesforce::Config.instance.server_domain 'something.salesforce.com'
7
+ end
8
+
4
9
  def test_content_type_headers
5
10
  assert_equal({ :content_type => 'application/json'}, Salesforce.connection.content_type_headers(:format => :json))
6
11
  assert_equal({ :content_type => 'application/json'}, Salesforce.connection.content_type_headers(:format => "json"))
@@ -13,7 +18,7 @@ class Salesforce.connection::HttpMethodsTest < ActiveSupport::TestCase
13
18
  def test_get__json
14
19
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
15
20
  http_body = stub(:body => { :result => 'foo' }.to_json)
16
- RestClient.expects(:get).with('https://.salesforce.com/services/data/v22.0/path', {'Authorization' => 'OAuth session_id', :content_type => 'application/json'}).returns(http_body)
21
+ RestClient.expects(:get).with('https://awesome-2000.something.salesforce.com/services/data/v22.0/path', {'Authorization' => 'OAuth session_id', :content_type => 'application/json'}).returns(http_body)
17
22
  assert_equal({'result' => 'foo'}, Salesforce.connection.get('path', :format => :json))
18
23
  end
19
24
 
@@ -21,14 +26,14 @@ class Salesforce.connection::HttpMethodsTest < ActiveSupport::TestCase
21
26
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
22
27
  error = RestClient::BadRequest.new
23
28
  error.stubs(:http_body).returns("[{\"message\":\"someproblem\",\"errorCode\":\"MALFORMED_QUERY\"}]")
24
- RestClient.expects(:get).with('https://.salesforce.com/services/data/v22.0/path', {'Authorization' => 'OAuth session_id', :content_type => 'application/json'}).raises(error)
29
+ RestClient.expects(:get).with('https://awesome-2000.something.salesforce.com/services/data/v22.0/path', {'Authorization' => 'OAuth session_id', :content_type => 'application/json'}).raises(error)
25
30
 
26
31
  begin
27
32
  Salesforce.connection.get('path', :format => :json)
28
33
  assert false, "Shouldn't have gotten here"
29
34
  rescue => e
30
35
  assert_equal "Salesforce::InvalidRequest", e.class.name
31
- assert_equal "MALFORMED_QUERY: someproblem while accessing https://.salesforce.com/services/data/v22.0/path", e.message
36
+ assert_equal "MALFORMED_QUERY: someproblem while accessing https://awesome-2000.something.salesforce.com/services/data/v22.0/path", e.message
32
37
  end
33
38
  end
34
39
 
@@ -36,28 +41,28 @@ class Salesforce.connection::HttpMethodsTest < ActiveSupport::TestCase
36
41
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
37
42
  error = RestClient::BadRequest.new
38
43
  error.stubs(:http_body).returns("<?xml version=\"1.0\" encoding=\"UTF-8\"?><Errors><Error><errorCode>MALFORMED_QUERY</errorCode><message>someproblem</message></Error></Errors>" )
39
- RestClient.expects(:get).with('https://.salesforce.com/services/data/v22.0/path', {'Authorization' => 'OAuth session_id', :content_type => 'application/xml'}).raises(error)
44
+ RestClient.expects(:get).with('https://awesome-2000.something.salesforce.com/services/data/v22.0/path', {'Authorization' => 'OAuth session_id', :content_type => 'application/xml'}).raises(error)
40
45
 
41
46
  begin
42
47
  Salesforce.connection.get('path', :format => :xml)
43
48
  assert false, "Shouldn't have gotten here"
44
49
  rescue => e
45
50
  assert_equal "Salesforce::InvalidRequest", e.class.name
46
- assert_equal "MALFORMED_QUERY: someproblem while accessing https://.salesforce.com/services/data/v22.0/path", e.message
51
+ assert_equal "MALFORMED_QUERY: someproblem while accessing https://awesome-2000.something.salesforce.com/services/data/v22.0/path", e.message
47
52
  end
48
53
  end
49
54
 
50
55
  def test_get__xml
51
56
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
52
57
  http_body = stub(:body => { :result => 'foo' }.to_xml)
53
- RestClient.expects(:get).with('https://.salesforce.com/services/data/v22.0/path', {'Authorization' => 'OAuth session_id', :content_type => 'application/xml'}).returns(http_body)
58
+ RestClient.expects(:get).with('https://awesome-2000.something.salesforce.com/services/data/v22.0/path', {'Authorization' => 'OAuth session_id', :content_type => 'application/xml'}).returns(http_body)
54
59
  assert_equal({'result' => 'foo'}, Salesforce.connection.get('path', :format => :xml))
55
60
  end
56
61
 
57
62
  def test_patch__json
58
63
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
59
64
  http_body = stub(:code => 204, :body => '')
60
- RestClient.expects(:patch).with('https://.salesforce.com/services/data/v22.0/path', :body, {'Authorization' => 'OAuth session_id', :content_type => 'application/json'}).returns(http_body)
65
+ RestClient.expects(:patch).with('https://awesome-2000.something.salesforce.com/services/data/v22.0/path', :body, {'Authorization' => 'OAuth session_id', :content_type => 'application/json'}).returns(http_body)
61
66
  assert Salesforce.connection.patch('path', :body, :format => :json)
62
67
  end
63
68
 
@@ -65,13 +70,13 @@ class Salesforce.connection::HttpMethodsTest < ActiveSupport::TestCase
65
70
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
66
71
  error = RestClient::BadRequest.new
67
72
  error.stubs(:http_body).returns("[{\"message\":\"someproblem\",\"errorCode\":\"MALFORMED_QUERY\"}]")
68
- RestClient.expects(:patch).with('https://.salesforce.com/services/data/v22.0/path', :body, {'Authorization' => 'OAuth session_id', :content_type => 'application/json'}).raises(error)
73
+ RestClient.expects(:patch).with('https://awesome-2000.something.salesforce.com/services/data/v22.0/path', :body, {'Authorization' => 'OAuth session_id', :content_type => 'application/json'}).raises(error)
69
74
  begin
70
75
  Salesforce.connection.patch('path', :body, :format => :json)
71
76
  assert false, "Shouldn't have gotten here"
72
77
  rescue => e
73
78
  assert_equal "Salesforce::InvalidRequest", e.class.name
74
- assert_equal "MALFORMED_QUERY: someproblem while accessing https://.salesforce.com/services/data/v22.0/path", e.message
79
+ assert_equal "MALFORMED_QUERY: someproblem while accessing https://awesome-2000.something.salesforce.com/services/data/v22.0/path", e.message
75
80
  end
76
81
  end
77
82
 
@@ -79,14 +84,14 @@ class Salesforce.connection::HttpMethodsTest < ActiveSupport::TestCase
79
84
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
80
85
  error = RestClient::BadRequest.new
81
86
  error.stubs(:http_body).returns("<?xml version=\"1.0\" encoding=\"UTF-8\"?><Errors><Error><errorCode>MALFORMED_QUERY</errorCode><message>someproblem</message></Error></Errors>" )
82
- RestClient.expects(:patch).with('https://.salesforce.com/services/data/v22.0/path', :body, {'Authorization' => 'OAuth session_id', :content_type => 'application/xml'}).raises(error)
87
+ RestClient.expects(:patch).with('https://awesome-2000.something.salesforce.com/services/data/v22.0/path', :body, {'Authorization' => 'OAuth session_id', :content_type => 'application/xml'}).raises(error)
83
88
 
84
89
  begin
85
90
  Salesforce.connection.patch('path', :body, :format => :xml)
86
91
  assert false, "Shouldn't have gotten here"
87
92
  rescue => e
88
93
  assert_equal "Salesforce::InvalidRequest", e.class.name
89
- assert_equal "MALFORMED_QUERY: someproblem while accessing https://.salesforce.com/services/data/v22.0/path", e.message
94
+ assert_equal "MALFORMED_QUERY: someproblem while accessing https://awesome-2000.something.salesforce.com/services/data/v22.0/path", e.message
90
95
  end
91
96
  end
92
97
 
@@ -94,13 +99,13 @@ class Salesforce.connection::HttpMethodsTest < ActiveSupport::TestCase
94
99
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
95
100
  error = RestClient::ResourceNotFound.new
96
101
  error.stubs(:http_body).returns("[{\"message\":\"someproblem\",\"errorCode\":\"MALFORMED_QUERY\"}]")
97
- RestClient.expects(:patch).with('https://.salesforce.com/services/data/v22.0/path', :body, {'Authorization' => 'OAuth session_id', :content_type => 'application/json'}).raises(error)
102
+ RestClient.expects(:patch).with('https://awesome-2000.something.salesforce.com/services/data/v22.0/path', :body, {'Authorization' => 'OAuth session_id', :content_type => 'application/json'}).raises(error)
98
103
  begin
99
104
  Salesforce.connection.patch('path', :body, :format => :json)
100
105
  assert false, "Shouldn't have gotten here"
101
106
  rescue => e
102
107
  assert_equal "Salesforce::InvalidRequest", e.class.name
103
- assert_equal "MALFORMED_QUERY: someproblem while accessing https://.salesforce.com/services/data/v22.0/path", e.message
108
+ assert_equal "MALFORMED_QUERY: someproblem while accessing https://awesome-2000.something.salesforce.com/services/data/v22.0/path", e.message
104
109
  end
105
110
  end
106
111
 
@@ -108,21 +113,21 @@ class Salesforce.connection::HttpMethodsTest < ActiveSupport::TestCase
108
113
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
109
114
  error = RestClient::ResourceNotFound.new
110
115
  error.stubs(:http_body).returns("<?xml version=\"1.0\" encoding=\"UTF-8\"?><Errors><Error><errorCode>MALFORMED_QUERY</errorCode><message>someproblem</message></Error></Errors>" )
111
- RestClient.expects(:patch).with('https://.salesforce.com/services/data/v22.0/path', :body, {'Authorization' => 'OAuth session_id', :content_type => 'application/xml'}).raises(error)
116
+ RestClient.expects(:patch).with('https://awesome-2000.something.salesforce.com/services/data/v22.0/path', :body, {'Authorization' => 'OAuth session_id', :content_type => 'application/xml'}).raises(error)
112
117
 
113
118
  begin
114
119
  Salesforce.connection.patch('path', :body, :format => :xml)
115
120
  assert false, "Shouldn't have gotten here"
116
121
  rescue => e
117
122
  assert_equal "Salesforce::InvalidRequest", e.class.name
118
- assert_equal "MALFORMED_QUERY: someproblem while accessing https://.salesforce.com/services/data/v22.0/path", e.message
123
+ assert_equal "MALFORMED_QUERY: someproblem while accessing https://awesome-2000.something.salesforce.com/services/data/v22.0/path", e.message
119
124
  end
120
125
  end
121
126
 
122
127
  def test_patch__xml
123
128
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
124
129
  http_body = stub(:code => 204, :body => '')
125
- RestClient.expects(:patch).with('https://.salesforce.com/services/data/v22.0/path', :body, {'Authorization' => 'OAuth session_id', :content_type => 'application/xml'}).returns(http_body)
130
+ RestClient.expects(:patch).with('https://awesome-2000.something.salesforce.com/services/data/v22.0/path', :body, {'Authorization' => 'OAuth session_id', :content_type => 'application/xml'}).returns(http_body)
126
131
  assert Salesforce.connection.patch('path', :body, :format => :xml)
127
132
  end
128
133
 
@@ -130,7 +135,7 @@ class Salesforce.connection::HttpMethodsTest < ActiveSupport::TestCase
130
135
  def test_post__json
131
136
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
132
137
  http_body = stub(:body => { :result => 'foo' }.to_json)
133
- RestClient.expects(:post).with('https://.salesforce.com/services/data/v22.0/path', :body, {'Authorization' => 'OAuth session_id', :content_type => 'application/json'}).returns(http_body)
138
+ RestClient.expects(:post).with('https://awesome-2000.something.salesforce.com/services/data/v22.0/path', :body, {'Authorization' => 'OAuth session_id', :content_type => 'application/json'}).returns(http_body)
134
139
  assert_equal({'result' => 'foo'}, Salesforce.connection.post('path', :body, :format => :json))
135
140
  end
136
141
 
@@ -138,13 +143,13 @@ class Salesforce.connection::HttpMethodsTest < ActiveSupport::TestCase
138
143
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
139
144
  error = RestClient::BadRequest.new
140
145
  error.stubs(:http_body).returns("[{\"message\":\"someproblem\",\"errorCode\":\"MALFORMED_QUERY\"}]")
141
- RestClient.expects(:post).with('https://.salesforce.com/services/data/v22.0/path', :body, {'Authorization' => 'OAuth session_id', :content_type => 'application/json'}).raises(error)
146
+ RestClient.expects(:post).with('https://awesome-2000.something.salesforce.com/services/data/v22.0/path', :body, {'Authorization' => 'OAuth session_id', :content_type => 'application/json'}).raises(error)
142
147
  begin
143
148
  Salesforce.connection.post('path', :body, :format => :json)
144
149
  assert false, "Shouldn't have gotten here"
145
150
  rescue => e
146
151
  assert_equal "Salesforce::InvalidRequest", e.class.name
147
- assert_equal "MALFORMED_QUERY: someproblem while accessing https://.salesforce.com/services/data/v22.0/path", e.message
152
+ assert_equal "MALFORMED_QUERY: someproblem while accessing https://awesome-2000.something.salesforce.com/services/data/v22.0/path", e.message
148
153
  end
149
154
  end
150
155
 
@@ -152,14 +157,14 @@ class Salesforce.connection::HttpMethodsTest < ActiveSupport::TestCase
152
157
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
153
158
  error = RestClient::BadRequest.new
154
159
  error.stubs(:http_body).returns("<?xml version=\"1.0\" encoding=\"UTF-8\"?><Errors><Error><errorCode>MALFORMED_QUERY</errorCode><message>someproblem</message></Error></Errors>" )
155
- RestClient.expects(:post).with('https://.salesforce.com/services/data/v22.0/path', :body, {'Authorization' => 'OAuth session_id', :content_type => 'application/xml'}).raises(error)
160
+ RestClient.expects(:post).with('https://awesome-2000.something.salesforce.com/services/data/v22.0/path', :body, {'Authorization' => 'OAuth session_id', :content_type => 'application/xml'}).raises(error)
156
161
 
157
162
  begin
158
163
  Salesforce.connection.post('path', :body, :format => :xml)
159
164
  assert false, "Shouldn't have gotten here"
160
165
  rescue => e
161
166
  assert_equal "Salesforce::InvalidRequest", e.class.name
162
- assert_equal "MALFORMED_QUERY: someproblem while accessing https://.salesforce.com/services/data/v22.0/path", e.message
167
+ assert_equal "MALFORMED_QUERY: someproblem while accessing https://awesome-2000.something.salesforce.com/services/data/v22.0/path", e.message
163
168
  end
164
169
  end
165
170
 
@@ -167,13 +172,13 @@ class Salesforce.connection::HttpMethodsTest < ActiveSupport::TestCase
167
172
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
168
173
  error = RestClient::ResourceNotFound.new
169
174
  error.stubs(:http_body).returns("[{\"message\":\"someproblem\",\"errorCode\":\"MALFORMED_QUERY\"}]")
170
- RestClient.expects(:post).with('https://.salesforce.com/services/data/v22.0/path', :body, {'Authorization' => 'OAuth session_id', :content_type => 'application/json'}).raises(error)
175
+ RestClient.expects(:post).with('https://awesome-2000.something.salesforce.com/services/data/v22.0/path', :body, {'Authorization' => 'OAuth session_id', :content_type => 'application/json'}).raises(error)
171
176
  begin
172
177
  Salesforce.connection.post('path', :body, :format => :json)
173
178
  assert false, "Shouldn't have gotten here"
174
179
  rescue => e
175
180
  assert_equal "Salesforce::InvalidRequest", e.class.name
176
- assert_equal "MALFORMED_QUERY: someproblem while accessing https://.salesforce.com/services/data/v22.0/path", e.message
181
+ assert_equal "MALFORMED_QUERY: someproblem while accessing https://awesome-2000.something.salesforce.com/services/data/v22.0/path", e.message
177
182
  end
178
183
  end
179
184
 
@@ -181,21 +186,21 @@ class Salesforce.connection::HttpMethodsTest < ActiveSupport::TestCase
181
186
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
182
187
  error = RestClient::ResourceNotFound.new
183
188
  error.stubs(:http_body).returns("<?xml version=\"1.0\" encoding=\"UTF-8\"?><Errors><Error><errorCode>MALFORMED_QUERY</errorCode><message>someproblem</message></Error></Errors>" )
184
- RestClient.expects(:post).with('https://.salesforce.com/services/data/v22.0/path', :body, {'Authorization' => 'OAuth session_id', :content_type => 'application/xml'}).raises(error)
189
+ RestClient.expects(:post).with('https://awesome-2000.something.salesforce.com/services/data/v22.0/path', :body, {'Authorization' => 'OAuth session_id', :content_type => 'application/xml'}).raises(error)
185
190
 
186
191
  begin
187
192
  Salesforce.connection.post('path', :body, :format => :xml)
188
193
  assert false, "Shouldn't have gotten here"
189
194
  rescue => e
190
195
  assert_equal "Salesforce::InvalidRequest", e.class.name
191
- assert_equal "MALFORMED_QUERY: someproblem while accessing https://.salesforce.com/services/data/v22.0/path", e.message
196
+ assert_equal "MALFORMED_QUERY: someproblem while accessing https://awesome-2000.something.salesforce.com/services/data/v22.0/path", e.message
192
197
  end
193
198
  end
194
199
 
195
200
  def test_post__xml
196
201
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
197
202
  http_body = stub(:body => { :result => 'foo' }.to_xml)
198
- RestClient.expects(:post).with('https://.salesforce.com/services/data/v22.0/path', :body, {'Authorization' => 'OAuth session_id', :content_type => 'application/xml'}).returns(http_body)
203
+ RestClient.expects(:post).with('https://awesome-2000.something.salesforce.com/services/data/v22.0/path', :body, {'Authorization' => 'OAuth session_id', :content_type => 'application/xml'}).returns(http_body)
199
204
  assert_equal({'result' => 'foo'}, Salesforce.connection.post('path', :body, :format => :xml))
200
205
  end
201
206
 
@@ -203,14 +208,14 @@ class Salesforce.connection::HttpMethodsTest < ActiveSupport::TestCase
203
208
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
204
209
  error = RestClient::BadRequest.new
205
210
  error.stubs(:http_body).returns("<?xml version=\"1.0\" encoding=\"UTF-8\"?><Errors><Error><errorCode>MALFORMED_QUERY</errorCode><message>someproblem</message></Error></Errors>" )
206
- RestClient.expects(:delete).with('https://.salesforce.com/services/data/v22.0/path', {'Authorization' => 'OAuth session_id', :content_type => 'application/xml'}).raises(error)
211
+ RestClient.expects(:delete).with('https://awesome-2000.something.salesforce.com/services/data/v22.0/path', {'Authorization' => 'OAuth session_id', :content_type => 'application/xml'}).raises(error)
207
212
 
208
213
  begin
209
214
  Salesforce.connection.delete('path')
210
215
  assert false, "Shouldn't have gotten here"
211
216
  rescue => e
212
217
  assert_equal "Salesforce::InvalidRequest", e.class.name
213
- assert_equal "MALFORMED_QUERY: someproblem while accessing https://.salesforce.com/services/data/v22.0/path", e.message
218
+ assert_equal "MALFORMED_QUERY: someproblem while accessing https://awesome-2000.something.salesforce.com/services/data/v22.0/path", e.message
214
219
  end
215
220
  end
216
221
 
@@ -218,25 +223,25 @@ class Salesforce.connection::HttpMethodsTest < ActiveSupport::TestCase
218
223
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
219
224
  error = RestClient::ResourceNotFound.new
220
225
  error.stubs(:http_body).returns("<?xml version=\"1.0\" encoding=\"UTF-8\"?><Errors><Error><errorCode>MALFORMED_QUERY</errorCode><message>someproblem</message></Error></Errors>" )
221
- RestClient.expects(:delete).with('https://.salesforce.com/services/data/v22.0/path', {'Authorization' => 'OAuth session_id', :content_type => 'application/xml'}).raises(error)
226
+ RestClient.expects(:delete).with('https://awesome-2000.something.salesforce.com/services/data/v22.0/path', {'Authorization' => 'OAuth session_id', :content_type => 'application/xml'}).raises(error)
222
227
 
223
228
  begin
224
229
  Salesforce.connection.delete('path')
225
230
  assert false, "Shouldn't have gotten here"
226
231
  rescue => e
227
232
  assert_equal "Salesforce::InvalidRequest", e.class.name
228
- assert_equal "MALFORMED_QUERY: someproblem while accessing https://.salesforce.com/services/data/v22.0/path", e.message
233
+ assert_equal "MALFORMED_QUERY: someproblem while accessing https://awesome-2000.something.salesforce.com/services/data/v22.0/path", e.message
229
234
  end
230
235
  end
231
236
 
232
237
  def test_delete__xml
233
238
  Salesforce::Authentication.stubs(:session_id).returns('session_id')
234
- RestClient.expects(:delete).with('https://.salesforce.com/services/data/v22.0/path', {'Authorization' => 'OAuth session_id', :content_type => 'application/xml'}).returns(stub(:body => ''))
239
+ RestClient.expects(:delete).with('https://awesome-2000.something.salesforce.com/services/data/v22.0/path', {'Authorization' => 'OAuth session_id', :content_type => 'application/xml'}).returns(stub(:body => ''))
235
240
  assert Salesforce.connection.delete('path')
236
241
  end
237
242
 
238
243
  def test_salesforce_url
239
- assert_equal 'https://.salesforce.com/services/data/v22.0/path', Salesforce.connection.salesforce_url("path")
240
- assert_equal 'https://.salesforce.com/services/data/23.0/foo', Salesforce.connection.salesforce_url("/services/data/23.0/foo")
244
+ assert_equal 'https://awesome-2000.something.salesforce.com/services/data/v22.0/path', Salesforce.connection.salesforce_url("path")
245
+ assert_equal 'https://awesome-2000.something.salesforce.com/services/data/23.0/foo', Salesforce.connection.salesforce_url("/services/data/23.0/foo")
241
246
  end
242
- end
247
+ end
@@ -55,10 +55,10 @@ class Salesforce::ConnectionTest < ActiveSupport::TestCase
55
55
  end
56
56
 
57
57
  def test_as_logged_in_user__invalid_username_password__recovers
58
- @on_login_failure_called = false
58
+ on_login_failure_called = false
59
59
 
60
60
  Salesforce.configure do
61
- on_login_failure { @on_login_failure_called = true }
61
+ on_login_failure { on_login_failure_called = true }
62
62
  end
63
63
 
64
64
  xml = <<-XML
@@ -79,14 +79,14 @@ class Salesforce::ConnectionTest < ActiveSupport::TestCase
79
79
  end
80
80
 
81
81
  assert_equal :results, results
82
- assert @on_login_failure_called, "Salesforce::Config.on_login_failure was not called upon login failure"
82
+ assert on_login_failure_called, "Salesforce::Config.on_login_failure was not called upon login failure"
83
83
  end
84
84
 
85
85
  def test_as_logged_in_user__invalid_username_password__doesnt_recover
86
- @on_login_failure_called = 0
86
+ on_login_failure_called = 0
87
87
 
88
88
  Salesforce.configure do
89
- on_login_failure { @on_login_failure_called += 1 }
89
+ on_login_failure { on_login_failure_called += 1 }
90
90
  end
91
91
 
92
92
  xml = <<-XML
@@ -104,8 +104,8 @@ class Salesforce::ConnectionTest < ActiveSupport::TestCase
104
104
  raise error
105
105
  end
106
106
  end
107
-
108
- assert_equal 1, @on_login_failure_called, "Salesforce::Config.on_login_failure was not called upon login failure"
107
+
108
+ assert_equal 1, on_login_failure_called, "Salesforce::Config.on_login_failure was not called upon login failure"
109
109
  end
110
110
 
111
111
  def test_as_logged_in_user__invalid_username_password__recovers__no_on_login_failure_hook
data/test/test_helper.rb CHANGED
@@ -7,7 +7,7 @@ rescue Bundler::BundlerError => e
7
7
  $stderr.puts "Run `bundle install` to install missing gems"
8
8
  exit e.status_code
9
9
  end
10
- require 'test/unit'
10
+ require 'minitest/autorun'
11
11
 
12
12
  $LOAD_PATH.unshift(File.dirname(__FILE__))
13
13
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
@@ -16,8 +16,6 @@ Dir.glob(File.expand_path('../../app/models/salesforce/**.rb', __FILE__)).each {
16
16
 
17
17
  require 'mocha/setup'
18
18
 
19
- class Test::Unit::TestCase
20
- end
21
19
 
22
20
  Time.zone = 'America/Los_Angeles'
23
21
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activeforce
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.1
4
+ version: 1.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tushar Ranka
@@ -17,14 +17,20 @@ dependencies:
17
17
  requirements:
18
18
  - - ">="
19
19
  - !ruby/object:Gem::Version
20
- version: '3.0'
20
+ version: '4.0'
21
+ - - "<"
22
+ - !ruby/object:Gem::Version
23
+ version: '5.0'
21
24
  type: :runtime
22
25
  prerelease: false
23
26
  version_requirements: !ruby/object:Gem::Requirement
24
27
  requirements:
25
28
  - - ">="
26
29
  - !ruby/object:Gem::Version
27
- version: '3.0'
30
+ version: '4.0'
31
+ - - "<"
32
+ - !ruby/object:Gem::Version
33
+ version: '5.0'
28
34
  - !ruby/object:Gem::Dependency
29
35
  name: savon
30
36
  requirement: !ruby/object:Gem::Requirement
@@ -60,6 +66,9 @@ dependencies:
60
66
  - - ">="
61
67
  - !ruby/object:Gem::Version
62
68
  version: '0'
69
+ - - "<"
70
+ - !ruby/object:Gem::Version
71
+ version: '2.0'
63
72
  type: :runtime
64
73
  prerelease: false
65
74
  version_requirements: !ruby/object:Gem::Requirement
@@ -67,6 +76,9 @@ dependencies:
67
76
  - - ">="
68
77
  - !ruby/object:Gem::Version
69
78
  version: '0'
79
+ - - "<"
80
+ - !ruby/object:Gem::Version
81
+ version: '2.0'
70
82
  - !ruby/object:Gem::Dependency
71
83
  name: fastercsv
72
84
  requirement: !ruby/object:Gem::Requirement
@@ -93,6 +105,8 @@ extra_rdoc_files:
93
105
  - README.md
94
106
  files:
95
107
  - ".gitignore"
108
+ - ".travis.yml"
109
+ - Appraisals
96
110
  - Gemfile
97
111
  - LICENSE.txt
98
112
  - README.md
@@ -145,6 +159,9 @@ files:
145
159
  - app/models/salesforce/user.rb
146
160
  - app/models/salesforce/user_role.rb
147
161
  - app/models/salesforce/vote.rb
162
+ - gemfiles/4.0.gemfile
163
+ - gemfiles/4.1.gemfile
164
+ - gemfiles/4.2.gemfile
148
165
  - lib/activeforce.rb
149
166
  - lib/activeforce/version.rb
150
167
  - lib/ruby_187_range_extension.rb
@@ -200,7 +217,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
200
217
  version: '0'
201
218
  requirements: []
202
219
  rubyforge_project:
203
- rubygems_version: 2.2.0
220
+ rubygems_version: 2.6.9
204
221
  signing_key:
205
222
  specification_version: 4
206
223
  summary: A Simple gem to interact with the Salesforce REST API