diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2018-02-12 16:43:32 +0800 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2018-02-12 16:43:32 +0800 |
commit | bc2739a52ff9a5366d3d668ef0ee07e91974c540 (patch) | |
tree | 3feef5d1f12464d15c8c2140b32fc154f46d89ad /qa/spec | |
parent | 75984534f80b97d2bc7f05c24ce3e0cadb5b85a3 (diff) | |
download | gitlab-ce-bc2739a52ff9a5366d3d668ef0ee07e91974c540.tar.gz |
Adopt Git style URI
Diffstat (limited to 'qa/spec')
-rw-r--r-- | qa/spec/git/repository_spec.rb | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/qa/spec/git/repository_spec.rb b/qa/spec/git/repository_spec.rb new file mode 100644 index 00000000000..ae58355d199 --- /dev/null +++ b/qa/spec/git/repository_spec.rb @@ -0,0 +1,52 @@ +describe QA::Git::Repository do + describe '.parse_uri' do + context 'when URI starts with ssh://' do + context 'when URI has port' do + it 'parses correctly' do + uri = described_class + .parse_uri('ssh://git@qa.test:2222/sandbox/qa/repo.git') + + expect(uri.user).to eq('git') + expect(uri.host).to eq('qa.test') + expect(uri.port).to eq(2222) + expect(uri.path).to eq('/sandbox/qa/repo.git') + end + end + + context 'when URI does not have port' do + it 'parses correctly' do + uri = described_class + .parse_uri('ssh://git@qa.test/sandbox/qa/repo.git') + + expect(uri.user).to eq('git') + expect(uri.host).to eq('qa.test') + expect(uri.path).to eq('/sandbox/qa/repo.git') + end + end + end + + context 'when URI does not start with ssh://' do + context 'when host does not have colons' do + it 'parses correctly' do + uri = described_class + .parse_uri('git@qa.test:sandbox/qa/repo.git') + + expect(uri.user).to eq('git') + expect(uri.host).to eq('qa.test') + expect(uri.path).to eq('/sandbox/qa/repo.git') + end + end + + context 'when host has a colon' do + it 'parses correctly' do + uri = described_class + .parse_uri('[git@qa:test]:sandbox/qa/repo.git') + + expect(uri.user).to eq('git') + expect(uri.host).to eq('qa%3Atest') + expect(uri.path).to eq('/sandbox/qa/repo.git') + end + end + end + end +end |