diff options
author | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-04-18 20:01:33 -0300 |
---|---|---|
committer | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-04-19 13:21:30 -0300 |
commit | 835acf22d4c6c4cae4d64ad5a069f64c4c679be6 (patch) | |
tree | f7c3ee8f403d660b90a57d7220fb8906f2072bbe /spec/helpers | |
parent | 2011f02b5dc718b39ee7b3de7db4cea2fffafd36 (diff) | |
download | gitlab-ce-835acf22d4c6c4cae4d64ad5a069f64c4c679be6.tar.gz |
Fix GitHub project's link on import page when provider has a custom URL
Diffstat (limited to 'spec/helpers')
-rw-r--r-- | spec/helpers/import_helper_spec.rb | 25 |
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 |