summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorRobert Speicher <robert@gitlab.com>2016-04-19 17:13:25 +0000
committerRobert Speicher <robert@gitlab.com>2016-04-19 17:13:25 +0000
commitf1e778be48c36fb26670325e61acb4ed12785b7d (patch)
tree8e668c446f6fb0344130900576595f2d1d655fa1 /spec
parent55380e69fcd070751a26e368da55968fa3f57419 (diff)
parent835acf22d4c6c4cae4d64ad5a069f64c4c679be6 (diff)
downloadgitlab-ce-f1e778be48c36fb26670325e61acb4ed12785b7d.tar.gz
Merge branch 'imported-ghe-project-names-links-to-github' into 'master'
Fix GitHub project's link in the import page when provider has a custom URL Closes gitlab-org/gitlab-ee#478 See merge request !3803
Diffstat (limited to 'spec')
-rw-r--r--spec/helpers/import_helper_spec.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/spec/helpers/import_helper_spec.rb b/spec/helpers/import_helper_spec.rb
new file mode 100644
index 00000000000..3391234e9f5
--- /dev/null
+++ b/spec/helpers/import_helper_spec.rb
@@ -0,0 +1,25 @@
+require 'rails_helper'
+
+describe ImportHelper do
+ describe '#github_project_link' do
+ context 'when provider does not specify a custom URL' do
+ it 'uses default GitHub URL' do
+ allow(Gitlab.config.omniauth).to receive(:providers).
+ and_return([Settingslogic.new('name' => 'github')])
+
+ expect(helper.github_project_link('octocat/Hello-World')).
+ to include('href="https://github.com/octocat/Hello-World"')
+ end
+ end
+
+ context 'when provider specify a custom URL' do
+ it 'uses custom URL' do
+ allow(Gitlab.config.omniauth).to receive(:providers).
+ and_return([Settingslogic.new('name' => 'github', 'url' => 'https://github.company.com')])
+
+ expect(helper.github_project_link('octocat/Hello-World')).
+ to include('href="https://github.company.com/octocat/Hello-World"')
+ end
+ end
+ end
+end