|
84 | 84 | describe '#remote_uri_path' do
|
85 | 85 | subject(:method_call) { repository.remote_uri_path }
|
86 | 86 |
|
| 87 | + let(:remote_url) { 'ssh://[email protected]:29418/projects/central/bsw' } |
| 88 | + |
87 | 89 | let(:remote) do
|
88 | 90 | instance_double(
|
89 | 91 | Git::Remote,
|
90 |
| - url: 'ssh://[email protected]:29418/projects/central/bsw' |
| 92 | + url: remote_url |
91 | 93 | )
|
92 | 94 | end
|
93 | 95 |
|
|
109 | 111 | method_call
|
110 | 112 | end
|
111 | 113 |
|
112 |
| - it "returns only the path of the remote's URL" do |
113 |
| - expect(method_call).to eq('/projects/central/bsw') |
| 114 | + context 'when the URL is a standard SSH url' do |
| 115 | + it "returns only the path of the remote's URL" do |
| 116 | + expect(method_call).to eq('/projects/central/bsw') |
| 117 | + end |
| 118 | + end |
| 119 | + |
| 120 | + context 'when the URL is a Git URL' do |
| 121 | + let(:remote_url) { 'git://[email protected]/esrlabs/dox.git' } |
| 122 | + |
| 123 | + it "returns only the path of the remote's URL" do |
| 124 | + expect(method_call).to eq('/esrlabs/dox.git') |
| 125 | + end |
| 126 | + end |
| 127 | + |
| 128 | + context 'when the URL is a GitHub URL' do |
| 129 | + let(:remote_url) { '[email protected]:esrlabs/dox.git' } |
| 130 | + |
| 131 | + it "returns only the path of the remote's URL" do |
| 132 | + expect(method_call).to eq('/esrlabs/dox.git') |
| 133 | + end |
| 134 | + end |
| 135 | + |
| 136 | + context 'when the URL is an HTTPS URL' do |
| 137 | + let(:remote_url) { 'https://github.com/esrlabs/dox.git' } |
| 138 | + |
| 139 | + it "returns only the path of the remote's URL" do |
| 140 | + expect(method_call).to eq('/esrlabs/dox.git') |
| 141 | + end |
| 142 | + end |
| 143 | + |
| 144 | + context 'when the URL is a file URL' do |
| 145 | + let(:remote_url) { '~/Projects/esrlabs/dox' } |
| 146 | + |
| 147 | + it "returns only the path of the remote's URL" do |
| 148 | + expect(method_call).to eq('~/Projects/esrlabs/dox') |
| 149 | + end |
| 150 | + end |
| 151 | + |
| 152 | + context 'when the URL is a JOSH URL' do |
| 153 | + let(:remote_url) { 'https://[email protected]/bsw.git:/libs.git' } |
| 154 | + |
| 155 | + it "returns only the path of the remote's URL" do |
| 156 | + expect(method_call).to eq('/bsw.git:/libs.git') |
| 157 | + end |
114 | 158 | end
|
115 | 159 | end
|
116 | 160 |
|
|
0 commit comments