Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix deprecation warning, fix private method `gsub' called for nil:NilClass error on 1.8.7 #53

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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 Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ rescue LoadError
puts "Hiding spec tasks because RSpec is not available"
end

require 'rake/rdoctask'
require 'rdoc/task'
Rake::RDocTask.new do |rdoc|
version = File.exist?('VERSION') ? File.read('VERSION') : ""

Expand Down
13 changes: 11 additions & 2 deletions lib/casclient/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -282,9 +282,18 @@ def hash_to_query(hash)
pairs = []
hash.each do |k, vals|
vals = [vals] unless vals.kind_of? Array
vals.each {|v| pairs << (v.nil? ? CGI.escape(k) : "#{CGI.escape(k)}=#{CGI.escape(v)}")}

vals.each {|v|
if v.nil?
pairs << CGI.escape(k) unless k.nil?
else
pairs << "#{CGI.escape(k)}=#{CGI.escape(v)}"
end

pairs
}
end
pairs.join("&")
end
end
end
end
8 changes: 8 additions & 0 deletions spec/casclient/client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,12 @@
end
end
end

describe 'logout_url' do
it 'should tolerate oddly formed URIs' do
destination_url = 'https://foo.com/path/to/page?&sort=date_received.DESC'

client.logout_url(destination_url)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the expected output of this call?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its not too relevant, at least for this bug - the code throws an error, or doesn't. Happy to contribute other test coverage that targets the method in a separate pr

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ugh, it's been three years and the underlying bug is still present - https://github.com/rubycas/rubycas-client/blob/master/lib/casclient/client.rb#L286

end
end
end