Skip to content
This repository was archived by the owner on Jul 24, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/openid/association.rb
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def sign_message(message)

signed_list = []
message_keys.each { |k|
if k.starts_with?('openid.')
if k.start_with?('openid.')
signed_list << k[7..-1]
end
}
Expand Down
13 changes: 0 additions & 13 deletions lib/openid/extras.rb

This file was deleted.

2 changes: 1 addition & 1 deletion lib/openid/message.rb
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ def to_args
post_args = self.to_post_args
kvargs = {}
post_args.each { |k,v|
if !k.starts_with?('openid.')
if !k.start_with?('openid.')
raise ArgumentError, "This message can only be encoded as a POST, because it contains arguments that are not prefixed with 'openid.'"
else
kvargs[k[7..-1]] = v
Expand Down
2 changes: 1 addition & 1 deletion lib/openid/trustroot.rb
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ def validate_url(url)
return false
end
elsif ((@host != '') and
(!host.ends_with?('.' + @host)) and
(!host.end_with?('.' + @host)) and
(host != @host))
return false
end
Expand Down
10 changes: 4 additions & 6 deletions lib/openid/urinorm.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
require 'uri'

require "openid/extras"

module OpenID

module URINorm
Expand Down Expand Up @@ -42,15 +40,15 @@ def URINorm.remove_dot_segments(path)
result_segments = []

while path.length > 0
if path.starts_with?('../')
if path.start_with?('../')
path = path[3..-1]
elsif path.starts_with?('./')
elsif path.start_with?('./')
path = path[2..-1]
elsif path.starts_with?('/./')
elsif path.start_with?('/./')
path = path[2..-1]
elsif path == '/.'
path = '/'
elsif path.starts_with?('/../')
elsif path.start_with?('/../')
path = path[3..-1]
result_segments.pop if result_segments.length > 0
elsif path == '/..'
Expand Down
2 changes: 0 additions & 2 deletions lib/openid/util.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
require "uri"
require "logger"

require "openid/extras"

# See OpenID::Consumer or OpenID::Server modules, as well as the store classes
module OpenID
class AssertionError < Exception
Expand Down
3 changes: 1 addition & 2 deletions test/discoverdata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
require 'uri'
require 'openid/yadis/constants'
require 'openid/yadis/discovery'
require 'openid/extras'
require 'openid/util'

module OpenID
Expand Down Expand Up @@ -106,7 +105,7 @@ def generateResult(base_url, input_name, id_name, result_name, success)

ctype = nil
header_lines.each { |header_line|
if header_line.starts_with?('Content-Type:')
if header_line.start_with?('Content-Type:')
_, ctype = header_line.split(':', 2)
ctype = ctype.strip()
break
Expand Down
3 changes: 1 addition & 2 deletions test/test_accept.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
require 'minitest/autorun'
require 'testutil'
require 'openid/yadis/accept'
require 'openid/extras'
require 'openid/util'

module OpenID
Expand Down Expand Up @@ -30,7 +29,7 @@ def chunk(lines)
chunk = []
lines.each { |lineno, line|
stripped = line.strip()
if (stripped == '') or stripped.starts_with?('#')
if (stripped == '') or stripped.start_with?('#')
if chunk.length > 0
chunks << chunk
chunk = []
Expand Down
2 changes: 1 addition & 1 deletion test/test_discover.rb
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ def fetch(url, body=nil, headers=nil, limit=nil)
"mean to do that.")
end

if xri.starts_with?('/')
if xri.start_with?('/')
xri = xri[1..-1]
end

Expand Down
3 changes: 1 addition & 2 deletions test/test_discovery_manager.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
require 'minitest/autorun'
require 'openid/consumer/discovery_manager'
require 'openid/extras'
require 'testutil'

module OpenID
Expand Down Expand Up @@ -234,7 +233,7 @@ def test_destroy_manager
end

def test_session_key
assert(@manager.session_key.ends_with?(
assert(@manager.session_key.end_with?(
@manager.instance_variable_get("@session_key_suffix")))
end

Expand Down
9 changes: 4 additions & 5 deletions test/test_extras.rb
Original file line number Diff line number Diff line change
@@ -1,35 +1,34 @@
require 'minitest/autorun'
require 'openid/extras'

class StartsWithTestCase < Minitest::Test
def test_starts_with
[["anything", ""],
["something else", ""],
["", ""],
["foos", "foo"],
].each{|str,target| assert(str.starts_with?(target))}
].each{|str,target| assert(str.start_with?(target))}
end

def test_not_starts_with
[["x", "y"],
["foos", "ball"],
["xx", "xy"],
].each{|str,target| assert(!(str.starts_with? target)) }
].each{|str,target| assert(!(str.start_with? target)) }
end

def test_ends_with
[["anything", ""],
["something else", " else"],
["", ""],
["foos", "oos"],
].each{|str,target| assert(str.ends_with?(target))}
].each{|str,target| assert(str.end_with?(target))}
end

def test_not_ends_with
[["x", "y"],
["foos", "ball"],
["xx", "xy"],
["foosball", "foosbal"],
].each{|str,target| assert(!(str.ends_with? target)) }
].each{|str,target| assert(!(str.end_with? target)) }
end
end
6 changes: 3 additions & 3 deletions test/test_server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -826,7 +826,7 @@ def test_id_res
assert(webresponse.headers.member?('location'))

location = webresponse.headers['location']
assert(location.starts_with?(request.return_to),
assert(location.start_with?(request.return_to),
sprintf("%s does not start with %s",
location, request.return_to))
# argh.
Expand Down Expand Up @@ -1240,7 +1240,7 @@ def test_immediate_encode_to_url
server_url = "http://server.com/server"

url = @request.encode_to_url(server_url)
assert(url.starts_with?(server_url))
assert(url.start_with?(server_url))

_, query = url.split("?", 2)
args = Util.parse_query(query)
Expand Down Expand Up @@ -1423,7 +1423,7 @@ def test_answerImmediateDenyOpenID1
assert_equal('id_res', answer.fields.get_arg(OPENID_NS, 'mode'))

usu = answer.fields.get_arg(OPENID_NS, 'user_setup_url', '')
assert(usu.starts_with?(server_url))
assert(usu.start_with?(server_url))
expected_substr = 'openid.claimed_id=http%3A%2F%2Fclaimed-id.test%2F'
assert(!usu.index(expected_substr).nil?, usu)
end
Expand Down
2 changes: 1 addition & 1 deletion test/testutil.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def assert_protocol_error(str_prefix)
rescue ProtocolError => why
message = "Expected prefix #{str_prefix.inspect}, got "\
"#{why.message.inspect}"
assert(why.message.starts_with?(str_prefix), message)
assert(why.message.start_with?(str_prefix), message)
else
fail("Expected ProtocolError. Got #{result.inspect}")
end
Expand Down