Merge branch 'qa-escape-netrc-regex' into 'master'
[QA] Escape arg used as regex Closes gitlab-org/quality/performance#2 See merge request gitlab-org/gitlab-ce!28104
This commit is contained in:
commit
38d57a61b6
2 changed files with 10 additions and 1 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue