Commit 13f7415a authored by Rémy Coutable's avatar Rémy Coutable Committed by Robert Speicher

Address review feedback

Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent 2d54dfb2
require 'spec_helper' require 'spec_helper'
feature 'Project Activity RSS' do feature 'Project Activity RSS' do
let(:user) { create(:user) } let(:project) { create(:project, :public) }
let(:project) { create(:project, visibility_level: Gitlab::VisibilityLevel::PUBLIC) } let(:user) { project.owner }
let(:path) { activity_project_path(project) } let(:path) { activity_project_path(project) }
before do before do
...@@ -11,8 +11,7 @@ feature 'Project Activity RSS' do ...@@ -11,8 +11,7 @@ feature 'Project Activity RSS' do
context 'when signed in' do context 'when signed in' do
before do before do
project.add_developer(user) sign_in(project.owner)
sign_in(user)
visit path visit path
end end
......
...@@ -15,22 +15,7 @@ feature 'Projects > Activity > User sees activity' do ...@@ -15,22 +15,7 @@ feature 'Projects > Activity > User sees activity' do
visit activity_project_path(project) visit activity_project_path(project)
end end
shared_examples 'push appears in activity' do it 'shows the last push in the activity page', :js do
it 'shows the last push in the activity page', :js do expect(page).to have_content "#{user.name} pushed new branch fix"
expect(page).to have_content "#{user.name} pushed new branch fix"
end
end
context 'when signed in' do
before do
project.add_developer(user)
sign_in(user)
end
it_behaves_like 'push appears in activity'
end
context 'when signed out' do
it_behaves_like 'push appears in activity'
end end
end end
require 'spec_helper' require 'spec_helper'
require 'fileutils'
describe 'Projects > Files > User wants to add a Dockerfile file' do describe 'Projects > Files > User wants to add a Dockerfile file' do
before do before do
user = create(:user)
project = create(:project, :repository) project = create(:project, :repository)
project.add_master(user) sign_in project.owner
sign_in user
visit project_new_blob_path(project, 'master', file_name: 'Dockerfile') visit project_new_blob_path(project, 'master', file_name: 'Dockerfile')
end end
it 'user can see Dockerfile dropdown' do it 'user can pick a Dockerfile file from the dropdown', :js do
expect(page).to have_css('.dockerfile-selector') expect(page).to have_css('.dockerfile-selector')
end
it 'user can pick a Dockerfile file from the dropdown', :js do
find('.js-dockerfile-selector').click find('.js-dockerfile-selector').click
wait_for_requests wait_for_requests
......
require 'spec_helper' require 'spec_helper'
describe 'Projects > Files > Download buttons in files tree' do describe 'Projects > Files > Download buttons in files tree' do
let(:user) { create(:user) }
let(:role) { :developer }
let(:status) { 'success' }
let(:project) { create(:project, :repository) } let(:project) { create(:project, :repository) }
let(:user) { project.creator }
let(:pipeline) do let(:pipeline) do
create(:ci_pipeline, create(:ci_pipeline,
project: project, project: project,
sha: project.commit.sha, sha: project.commit.sha,
ref: project.default_branch, ref: project.default_branch,
status: status) status: 'success')
end end
let!(:build) do let!(:build) do
...@@ -23,20 +21,16 @@ describe 'Projects > Files > Download buttons in files tree' do ...@@ -23,20 +21,16 @@ describe 'Projects > Files > Download buttons in files tree' do
before do before do
sign_in(user) sign_in(user)
project.add_role(user, role) project.add_developer(user)
end
describe 'when files tree' do visit project_tree_path(project, project.default_branch)
context 'with artifacts' do end
before do
visit project_tree_path(project, project.default_branch)
end
it 'shows download artifacts button' do context 'with artifacts' do
href = latest_succeeded_project_artifacts_path(project, "#{project.default_branch}/download", job: 'build') it 'shows download artifacts button' do
href = latest_succeeded_project_artifacts_path(project, "#{project.default_branch}/download", job: 'build')
expect(page).to have_link "Download '#{build.name}'", href: href expect(page).to have_link "Download '#{build.name}'", href: href
end
end end
end end
end end
...@@ -2,9 +2,8 @@ require 'spec_helper' ...@@ -2,9 +2,8 @@ require 'spec_helper'
describe 'Projects > Files > User uses soft wrap whilst editing file', :js do describe 'Projects > Files > User uses soft wrap whilst editing file', :js do
before do before do
user = create(:user)
project = create(:project, :repository) project = create(:project, :repository)
project.add_master(user) user = project.owner
sign_in user sign_in user
visit project_new_blob_path(project, 'master', file_name: 'test_file-name') visit project_new_blob_path(project, 'master', file_name: 'test_file-name')
page.within('.file-editor.code') do page.within('.file-editor.code') do
......
...@@ -2,7 +2,7 @@ require 'spec_helper' ...@@ -2,7 +2,7 @@ require 'spec_helper'
describe 'Projects > Files > User wants to edit a file' do describe 'Projects > Files > User wants to edit a file' do
let(:project) { create(:project, :repository) } let(:project) { create(:project, :repository) }
let(:user) { create(:user) } let(:user) { project.owner }
let(:commit_params) do let(:commit_params) do
{ {
start_branch: project.default_branch, start_branch: project.default_branch,
...@@ -16,7 +16,6 @@ describe 'Projects > Files > User wants to edit a file' do ...@@ -16,7 +16,6 @@ describe 'Projects > Files > User wants to edit a file' do
end end
before do before do
project.add_master(user)
sign_in user sign_in user
visit project_edit_blob_path(project, visit project_edit_blob_path(project,
File.join(project.default_branch, '.gitignore')) File.join(project.default_branch, '.gitignore'))
......
require 'spec_helper' require 'spec_helper'
describe 'Projects > Files > User views files page' do describe 'Projects > Files > User views files page' do
let(:user) { create(:user) }
let(:project) { create(:forked_project_with_submodules) } let(:project) { create(:forked_project_with_submodules) }
let(:user) { project.owner }
before do before do
project.add_master(user)
sign_in user sign_in user
visit project_tree_path(project, project.repository.root_ref) visit project_tree_path(project, project.repository.root_ref)
end end
......
require 'spec_helper' require 'spec_helper'
describe 'Projects > Files > Find file keyboard shortcuts', :js do describe 'Projects > Files > Find file keyboard shortcuts', :js do
let(:user) { create(:user) }
let(:project) { create(:project, :repository) } let(:project) { create(:project, :repository) }
let(:user) { project.owner }
before do before do
project.add_master(user)
sign_in user sign_in user
visit project_find_file_path(project, project.repository.root_ref) visit project_find_file_path(project, project.repository.root_ref)
......
...@@ -2,24 +2,23 @@ require 'spec_helper' ...@@ -2,24 +2,23 @@ require 'spec_helper'
describe 'Projects > Files > User wants to add a .gitignore file' do describe 'Projects > Files > User wants to add a .gitignore file' do
before do before do
user = create(:user)
project = create(:project, :repository) project = create(:project, :repository)
project.add_master(user) sign_in project.owner
sign_in user
visit project_new_blob_path(project, 'master', file_name: '.gitignore') visit project_new_blob_path(project, 'master', file_name: '.gitignore')
end end
it 'user can see .gitignore dropdown' do it 'user can pick a .gitignore file from the dropdown', :js do
expect(page).to have_css('.gitignore-selector') expect(page).to have_css('.gitignore-selector')
end
it 'user can pick a .gitignore file from the dropdown', :js do
find('.js-gitignore-selector').click find('.js-gitignore-selector').click
wait_for_requests wait_for_requests
within '.gitignore-selector' do within '.gitignore-selector' do
find('.dropdown-input-field').set('rails') find('.dropdown-input-field').set('rails')
find('.dropdown-content li', text: 'Rails').click find('.dropdown-content li', text: 'Rails').click
end end
wait_for_requests wait_for_requests
expect(page).to have_css('.gitignore-selector .dropdown-toggle-text', text: 'Rails') expect(page).to have_css('.gitignore-selector .dropdown-toggle-text', text: 'Rails')
......
...@@ -2,24 +2,23 @@ require 'spec_helper' ...@@ -2,24 +2,23 @@ require 'spec_helper'
describe 'Projects > Files > User wants to add a .gitlab-ci.yml file' do describe 'Projects > Files > User wants to add a .gitlab-ci.yml file' do
before do before do
user = create(:user)
project = create(:project, :repository) project = create(:project, :repository)
project.add_master(user) sign_in project.owner
sign_in user
visit project_new_blob_path(project, 'master', file_name: '.gitlab-ci.yml') visit project_new_blob_path(project, 'master', file_name: '.gitlab-ci.yml')
end end
it 'user can see .gitlab-ci.yml dropdown' do it 'user can pick a template from the dropdown', :js do
expect(page).to have_css('.gitlab-ci-yml-selector') expect(page).to have_css('.gitlab-ci-yml-selector')
end
it 'user can pick a template from the dropdown', :js do
find('.js-gitlab-ci-yml-selector').click find('.js-gitlab-ci-yml-selector').click
wait_for_requests wait_for_requests
within '.gitlab-ci-yml-selector' do within '.gitlab-ci-yml-selector' do
find('.dropdown-input-field').set('Jekyll') find('.dropdown-input-field').set('Jekyll')
find('.dropdown-content li', text: 'Jekyll').click find('.dropdown-content li', text: 'Jekyll').click
end end
wait_for_requests wait_for_requests
expect(page).to have_css('.gitlab-ci-yml-selector .dropdown-toggle-text', text: 'Jekyll') expect(page).to have_css('.gitlab-ci-yml-selector .dropdown-toggle-text', text: 'Jekyll')
......
require 'spec_helper' require 'spec_helper'
describe 'Projects > Files > Project owner creates a license file', :js do describe 'Projects > Files > Project owner creates a license file', :js do
let(:project_master) { create(:user) }
let(:project) { create(:project, :repository) } let(:project) { create(:project, :repository) }
let(:project_master) { project.owner }
before do before do
project.repository.delete_file(project_master, 'LICENSE', project.repository.delete_file(project_master, 'LICENSE',
message: 'Remove LICENSE', branch_name: 'master') message: 'Remove LICENSE', branch_name: 'master')
project.add_master(project_master)
sign_in(project_master) sign_in(project_master)
visit project_path(project) visit project_path(project)
end end
......
require 'spec_helper' require 'spec_helper'
describe 'Projects > Files > Project owner sees a link to create a license file in empty project', :js do describe 'Projects > Files > Project owner sees a link to create a license file in empty project', :js do
let(:project_master) { create(:user) }
let(:project) { create(:project_empty_repo) } let(:project) { create(:project_empty_repo) }
let(:project_master) { project.owner }
before do before do
project.add_master(project_master)
sign_in(project_master) sign_in(project_master)
end end
......
...@@ -2,10 +2,9 @@ require 'spec_helper' ...@@ -2,10 +2,9 @@ require 'spec_helper'
describe 'Projects > Files > Template type dropdown selector', :js do describe 'Projects > Files > Template type dropdown selector', :js do
let(:project) { create(:project, :repository) } let(:project) { create(:project, :repository) }
let(:user) { create(:user) } let(:user) { project.owner }
before do before do
project.add_master(user)
sign_in user sign_in user
end end
......
...@@ -2,10 +2,9 @@ require 'spec_helper' ...@@ -2,10 +2,9 @@ require 'spec_helper'
describe 'Projects > Files > Template Undo Button', :js do describe 'Projects > Files > Template Undo Button', :js do
let(:project) { create(:project, :repository) } let(:project) { create(:project, :repository) }
let(:user) { create(:user) } let(:user) { project.owner }
before do before do
project.add_master(user)
sign_in user sign_in user
end end
......
...@@ -3,7 +3,7 @@ require 'spec_helper' ...@@ -3,7 +3,7 @@ require 'spec_helper'
# This is a regression test for https://gitlab.com/gitlab-org/gitlab-ce/issues/37569 # This is a regression test for https://gitlab.com/gitlab-org/gitlab-ce/issues/37569
describe 'Projects > Files > User browses a tree with a folder containing only a folder' do describe 'Projects > Files > User browses a tree with a folder containing only a folder' do
let(:project) { create(:project, :empty_repo) } let(:project) { create(:project, :empty_repo) }
let(:user) { project.creator } let(:user) { project.owner }
before do before do
# We need to disable the tree.flat_path provided by Gitaly to reproduce the issue # We need to disable the tree.flat_path provided by Gitaly to reproduce the issue
......
...@@ -10,10 +10,9 @@ describe 'Projects > Files > User browses files' do ...@@ -10,10 +10,9 @@ describe 'Projects > Files > User browses files' do
let(:project2_tree_path_root_ref) { project_tree_path(project2, project2.repository.root_ref) } let(:project2_tree_path_root_ref) { project_tree_path(project2, project2.repository.root_ref) }
let(:tree_path_ref_6d39438) { project_tree_path(project, '6d39438') } let(:tree_path_ref_6d39438) { project_tree_path(project, '6d39438') }
let(:tree_path_root_ref) { project_tree_path(project, project.repository.root_ref) } let(:tree_path_root_ref) { project_tree_path(project, project.repository.root_ref) }
let(:user) { project.creator } let(:user) { project.owner }
before do before do
project.add_master(user)
sign_in(user) sign_in(user)
end end
......
...@@ -2,10 +2,9 @@ require 'spec_helper' ...@@ -2,10 +2,9 @@ require 'spec_helper'
describe 'Projects > Files > User browses LFS files' do describe 'Projects > Files > User browses LFS files' do
let(:project) { create(:project, :repository) } let(:project) { create(:project, :repository) }
let(:user) { project.creator } let(:user) { project.owner }
before do before do
project.add_master(user)
sign_in(user) sign_in(user)
end end
......
require 'spec_helper' require 'spec_helper'
describe 'Projects > Files > User searches for files' do describe 'Projects > Files > User searches for files' do
let(:user) { create(:user) } let(:user) { project.owner }
let(:project) { create(:project, :repository) }
before do before do
sign_in(user) sign_in(user)
...@@ -10,11 +9,10 @@ describe 'Projects > Files > User searches for files' do ...@@ -10,11 +9,10 @@ describe 'Projects > Files > User searches for files' do
describe 'project main screen' do describe 'project main screen' do
context 'when project is empty' do context 'when project is empty' do
let(:empty_project) { create(:project) } let(:project) { create(:project) }
before do before do
empty_project.add_developer(user) visit project_path(project)
visit project_path(empty_project)
end end
it 'does not show any result' do it 'does not show any result' do
...@@ -26,6 +24,8 @@ describe 'Projects > Files > User searches for files' do ...@@ -26,6 +24,8 @@ describe 'Projects > Files > User searches for files' do
end end
context 'when project is not empty' do context 'when project is not empty' do
let(:project) { create(:project, :repository) }
before do before do
project.add_developer(user) project.add_developer(user)
visit project_path(project) visit project_path(project)
...@@ -38,16 +38,16 @@ describe 'Projects > Files > User searches for files' do ...@@ -38,16 +38,16 @@ describe 'Projects > Files > User searches for files' do
end end
describe 'project tree screen' do describe 'project tree screen' do
let(:project) { create(:project, :repository) }
before do before do
project.add_developer(user) project.add_developer(user)
visit project_tree_path(project, project.default_branch) visit project_tree_path(project, project.default_branch)
end end
it 'shows "Find file" button' do it 'shows found files' do
expect(page).to have_selector('.tree-controls .shortcuts-find-file') expect(page).to have_selector('.tree-controls .shortcuts-find-file')
end
it 'shows found files' do
fill_in('search', with: 'coffee') fill_in('search', with: 'coffee')
click_button('Go') click_button('Go')
......
...@@ -6,11 +6,12 @@ describe 'Projects > Settings > LFS settings' do ...@@ -6,11 +6,12 @@ describe 'Projects > Settings > LFS settings' do
context 'LFS enabled setting' do context 'LFS enabled setting' do
before do before do
allow(Gitlab.config.lfs).to receive(:enabled).and_return(true)
sign_in(admin) sign_in(admin)
end end
it 'displays the correct elements', :js do it 'displays the correct elements', :js do
allow(Gitlab.config.lfs).to receive(:enabled).and_return(true)
visit edit_project_path(project) visit edit_project_path(project)
expect(page).to have_content('Git Large File Storage') expect(page).to have_content('Git Large File Storage')
......
require 'spec_helper' require 'spec_helper'
describe 'Projects > Show > User manages notifications' do describe 'Projects > Show > User manages notifications', :js do
let(:project) { create(:project, :public, :repository) } let(:project) { create(:project, :public, :repository) }
context 'when user is signed in', :js do before do
let(:user) { create(:user) } sign_in(project.owner)
visit project_path(project)
before do end
sign_in(user)
visit project_path(project)
end
it 'changes the notification setting' do it 'changes the notification setting' do
first('.notifications-btn').click first('.notifications-btn').click
click_link 'On mention' click_link 'On mention'
page.within '#notifications-button' do page.within '#notifications-button' do
expect(page).to have_content 'On mention' expect(page).to have_content 'On mention'
end
end end
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment