Permalink
Browse files

remember authenticated username/password for automatic reauth

  • Loading branch information...
1 parent 1df27f3 commit 123f2579b8da994b018f882527dd79e0e4c889f4 @dburkes dburkes committed Sep 22, 2011
Showing with 8 additions and 0 deletions.
  1. +2 −0 lib/databasedotcom/client.rb
  2. +6 −0 spec/lib/client_spec.rb
@@ -95,6 +95,8 @@ def authenticate(options = nil)
result = req.post(path, "")
log_response(result)
raise SalesForceError.new(result) unless result.is_a?(Net::HTTPOK)
+ self.username = user
+ self.password = pass
parse_auth_response(result.body)
elsif options.is_a?(Hash)
if options.has_key?("provider")
View
@@ -170,6 +170,12 @@
it "returns the token" do
@client.authenticate(:username => "username", :password => "password").should == "access_token"
end
+
+ it "sets username and password" do
+ @client.authenticate(:username => "username", :password => "password")
+ @client.username.should == "username"
+ @client.password.should == "password"
+ end
end
context "with an error response" do

0 comments on commit 123f257

Please sign in to comment.