1
0
Fork 0
mirror of https://github.com/jnunemaker/httparty synced 2023-03-27 23:23:07 -04:00

Mitigates Style/HashSyntax

This commit is contained in:
Thomas Nys 2015-04-18 14:06:57 +02:00
parent e9329f0053
commit 223c1603ae
2 changed files with 5 additions and 5 deletions

View file

@ -344,7 +344,7 @@ module HTTParty
def set_basic_auth_from_uri
if path.userinfo
username, password = path.userinfo.split(':')
options[:basic_auth] = {:username => username, :password => password}
options[:basic_auth] = {username: username, password: password}
end
end
end

View file

@ -60,15 +60,15 @@ RSpec.describe HTTParty::Request do
context "when basic auth options wasn't set explicitly" do
it "sets basic auth from uri" do
request = HTTParty::Request.new(Net::HTTP::Get, 'http://user1:pass1@example.com')
expect(request.options[:basic_auth]).to eq({:username => 'user1', :password => 'pass1'})
expect(request.options[:basic_auth]).to eq({username: 'user1', password: 'pass1'})
end
end
context "when basic auth options was set explicitly" do
it "uses basic auth from url anyway" do
basic_auth = {:username => 'user2', :password => 'pass2'}
request = HTTParty::Request.new(Net::HTTP::Get, 'http://user1:pass1@example.com', :basic_auth => basic_auth)
expect(request.options[:basic_auth]).to eq({:username => 'user1', :password => 'pass1'})
basic_auth = {username: 'user2', password: 'pass2'}
request = HTTParty::Request.new(Net::HTTP::Get, 'http://user1:pass1@example.com', basic_auth: basic_auth)
expect(request.options[:basic_auth]).to eq({username: 'user1', password: 'pass1'})
end
end
end