Skip to content
Snippets Groups Projects
Commit f9e06897 authored by Mark Lapierre's avatar Mark Lapierre
Browse files

Escape arg used in regex

parent 9aa81c0a
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -251,7 +251,7 @@ module QA
end
 
def netrc_already_contains_content?
read_netrc_content.grep(/^#{netrc_content}$/).any?
read_netrc_content.grep(/^#{Regexp.escape(netrc_content)}$/).any?
end
end
end
Loading
Loading
Loading
Loading
@@ -116,6 +116,15 @@ describe QA::Git::Repository do
expect(File.read(File.join(tmp_netrc_dir, '.netrc')))
.to eq("machine foo login user password foo\n")
end
it 'adds credentials with special characters' do
password = %q(!"#$%&'()*+,-./:;<=>?)
repository.username = 'user'
repository.password = password
expect(File.read(File.join(tmp_netrc_dir, '.netrc')))
.to eq("machine foo login user password #{password}\n")
end
end
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment