Skip to content

Commit

Permalink
Don't explicitly use 'test.salesforce.com' as the hostname but accept…
Browse files Browse the repository at this point in the history
… a host as part of #to_sandbox
  • Loading branch information
scoop authored and Sean O'Brien committed Oct 20, 2010
1 parent 2f43627 commit 4ddd6b0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/force/has_force.rb
Expand Up @@ -53,7 +53,7 @@ module InstanceMethods
# otherwise returns false
#
def to_salesforce(sandbox = false)
url = URI.parse("https://#{ sandbox == :sandbox ? 'test' : 'www' }.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8")
url = URI.parse("https://#{ sandbox ? sandbox : 'www' }.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
Expand Down
2 changes: 1 addition & 1 deletion test/has_force_test.rb
Expand Up @@ -43,7 +43,7 @@ def test_a_lead_submits_to_salesforce

def test_uses_the_sandbox_url
@lead = Lead.new
assert_equal 'test.salesforce.com', @lead.to_salesforce(:sandbox).address
assert_equal 'cs2.salesforce.com', @lead.to_salesforce('cs2').address
end

def test_uses_the_regular_url_by_default
Expand Down

0 comments on commit 4ddd6b0

Please sign in to comment.