spec/bin_spec.rb in git-browse-remote-0.1.0 vs spec/bin_spec.rb in git-browse-remote-0.1.1
- old
+ new
@@ -51,10 +51,19 @@
git :config, '--local', 'user.name', 'git-browse-remote tester'
git :remote, 'add', 'origin', 'https://github.com/user/repo.git'
git :remote, 'add', 'origin2', 'git@gh-mirror.host:user/repo2'
+ git :remote, 'add', 'origin3', 'ssh://git@my-git-host.com:9999/user/repo2'
+ git :config, '--local', 'browse-remote.my-git-host.com.top', 'https://{host}/{path}'
+
+ git :remote, 'add', 'origin4', 'ssh://git@my-git-host2.com:9999/user/repo2'
+ git :config, '--local', 'browse-remote.my-git-host2.com.top', 'https://{host_port}/{path}'
+
+ git :remote, 'add', 'origin5', 'git@my-git-host3.com:9999/user/repo2' # here 9999 is a part of path
+ git :config, '--local', 'browse-remote.my-git-host3.com.top', 'https://{host_port}/{path}'
+
FileUtils.copy_file ROOT + 'README.md', 'README.md'
git :add, 'README.md'
git :commit, '-m' '1st commit'
FileUtils.mkdir_p 'foo/bar'
@@ -241,9 +250,27 @@
end
when_run_with_args 'origin2' do
it 'should open the remote' do
expect(opened_url).to eq("https://gh-mirror.host/user/repo2")
+ end
+ end
+
+ when_run_with_args '--remote', 'origin3' do
+ it 'should open the specified remote page, `host` does not include port' do
+ expect(opened_url).to eq("https://my-git-host.com/user/repo2")
+ end
+ end
+
+ when_run_with_args '--remote', 'origin4' do
+ it 'should open the specified remote page, using `host_port` variable' do
+ expect(opened_url).to eq("https://my-git-host2.com:9999/user/repo2")
+ end
+ end
+
+ when_run_with_args '--remote', 'origin5' do
+ it 'should open the specified remote page on a SCP-like URL' do
+ expect(opened_url).to eq("https://my-git-host3.com/9999/user/repo2")
end
end
end
context 'on some branch' do