diff options
author | Zehan Zhao <cnallenzhao@gmail.com> | 2016-07-18 20:21:45 +0800 |
---|---|---|
committer | Zehan Zhao <cnallenzhao@gmail.com> | 2016-07-29 14:26:57 +0800 |
commit | 23505779beb8694248e8c62bb049a40fd36d9290 (patch) | |
tree | b637ecce9e0b8048f8137eca02af9e723dce2a6c /spec/bundler/friendly_errors_spec.rb | |
parent | 0db993851608f961267bdbfcca37936a07df402f (diff) | |
download | bundler-23505779beb8694248e8c62bb049a40fd36d9290.tar.gz |
Add message filter and spec for better search URL
Diffstat (limited to 'spec/bundler/friendly_errors_spec.rb')
-rw-r--r-- | spec/bundler/friendly_errors_spec.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/bundler/friendly_errors_spec.rb b/spec/bundler/friendly_errors_spec.rb index ae197a4bab..cc478ef7a5 100644 --- a/spec/bundler/friendly_errors_spec.rb +++ b/spec/bundler/friendly_errors_spec.rb @@ -2,6 +2,7 @@ require "spec_helper" require "bundler" require "bundler/friendly_errors" +require "cgi" describe Bundler, "friendly errors" do context "with invalid YAML in .gemrc" do @@ -66,5 +67,24 @@ END expect(Bundler::FriendlyErrors.issues_url(exception)).to eq("https://github.com/bundler/bundler/search?q=First+line+of+the+exception+message&type=Issues") end + + it "generates the url without colons" do + exception = Exception.new(<<END) +Exception ::: with ::: colons ::: +END + issues_url = Bundler::FriendlyErrors.issues_url(exception) + expect(issues_url).not_to include("%3A") + expect(issues_url).to eq("https://github.com/bundler/bundler/search?q=#{CGI.escape("Exception with colons ")}&type=Issues") + end + + it "removes information after - for Errono::EACCES" do + exception = Exception.new(<<END) +Errno::EACCES: Permission denied @ dir_s_mkdir - /Users/foo/bar/ +END + allow(exception).to receive(:is_a?).with(Errno).and_return(true) + issues_url = Bundler::FriendlyErrors.issues_url(exception) + expect(issues_url).not_to include("/Users/foo/bar") + expect(issues_url).to eq("https://github.com/bundler/bundler/search?q=#{CGI.escape("Errno EACCES Permission denied @ dir_s_mkdir ")}&type=Issues") + end end end |