Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/features/projects/new_project_spec.rb')
-rw-r--r--spec/features/projects/new_project_spec.rb72
1 files changed, 44 insertions, 28 deletions
diff --git a/spec/features/projects/new_project_spec.rb b/spec/features/projects/new_project_spec.rb
index b3fbf5d356e..c57e39b6508 100644
--- a/spec/features/projects/new_project_spec.rb
+++ b/spec/features/projects/new_project_spec.rb
@@ -372,7 +372,7 @@ RSpec.describe 'New project', :js do
it 'shows import instructions' do
expect(page).to have_content('Authenticate with GitHub')
- expect(current_path).to eq new_import_github_path
+ expect(page).to have_current_path new_import_github_path, ignore_query: true
end
end
@@ -383,7 +383,7 @@ RSpec.describe 'New project', :js do
it 'shows import instructions' do
expect(page).to have_content('Manifest file import')
- expect(current_path).to eq new_import_manifest_path
+ expect(page).to have_current_path new_import_manifest_path, ignore_query: true
end
end
end
@@ -405,46 +405,62 @@ RSpec.describe 'New project', :js do
end
end
- context 'from Bitbucket', :js do
- shared_examples 'has a link to bitbucket cloud' do
- context 'when bitbucket is not configured' do
- before do
- allow(Gitlab::Auth::OAuth::Provider).to receive(:enabled?).and_call_original
- allow(Gitlab::Auth::OAuth::Provider)
- .to receive(:enabled?).with(:bitbucket)
- .and_return(false)
+ shared_examples 'has instructions to enable OAuth' do
+ context 'when OAuth is not configured' do
+ before do
+ sign_in(user)
- visit new_project_path
- click_link 'Import project'
- click_link 'Bitbucket Cloud'
- end
+ allow(Gitlab::Auth::OAuth::Provider).to receive(:enabled?).and_call_original
+ allow(Gitlab::Auth::OAuth::Provider)
+ .to receive(:enabled?).with(provider)
+ .and_return(false)
- it 'shows import instructions' do
- expect(find('.modal-body')).to have_content(bitbucket_link_content)
- end
+ visit new_project_path
+ click_link 'Import project'
+ click_link target_link
+ end
+
+ it 'shows import instructions' do
+ expect(find('.modal-body')).to have_content(oauth_config_instructions)
end
end
+ end
+
+ context 'from Bitbucket', :js do
+ let(:target_link) { 'Bitbucket Cloud' }
+ let(:provider) { :bitbucket }
context 'as a user' do
let(:user) { create(:user) }
- let(:bitbucket_link_content) { 'To enable importing projects from Bitbucket, ask your GitLab administrator to configure OAuth integration' }
+ let(:oauth_config_instructions) { 'To enable importing projects from Bitbucket, ask your GitLab administrator to configure OAuth integration' }
- before do
- sign_in(user)
- end
-
- it_behaves_like 'has a link to bitbucket cloud'
+ it_behaves_like 'has instructions to enable OAuth'
end
context 'as an admin' do
let(:user) { create(:admin) }
- let(:bitbucket_link_content) { 'To enable importing projects from Bitbucket, as administrator you need to configure OAuth integration' }
+ let(:oauth_config_instructions) { 'To enable importing projects from Bitbucket, as administrator you need to configure OAuth integration' }
- before do
- sign_in(user)
- end
+ it_behaves_like 'has instructions to enable OAuth'
+ end
+ end
+
+ context 'from GitLab.com', :js do
+ let(:target_link) { 'GitLab.com' }
+ let(:provider) { :gitlab }
+
+ context 'as a user' do
+ let(:user) { create(:user) }
+ let(:oauth_config_instructions) { 'To enable importing projects from GitLab.com, ask your GitLab administrator to configure OAuth integration' }
+
+ it_behaves_like 'has instructions to enable OAuth'
+ end
+
+ context 'as an admin' do
+ let(:user) { create(:admin) }
+ let(:oauth_config_instructions) { 'To enable importing projects from GitLab.com, as administrator you need to configure OAuth integration' }
- it_behaves_like 'has a link to bitbucket cloud'
+ it_behaves_like 'has instructions to enable OAuth'
end
end
end