debian-mirror-gitlab/spec/features/projects/show/user_uploads_files_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

59 lines
1.5 KiB
Ruby
Raw Permalink Normal View History

2020-04-22 19:07:51 +05:30
# frozen_string_literal: true
require 'spec_helper'
2023-03-04 22:38:38 +05:30
RSpec.describe 'Projects > Show > User uploads files', feature_category: :projects do
2020-04-22 19:07:51 +05:30
include DropzoneHelper
let(:user) { create(:user) }
let(:project) { create(:project, :repository, name: 'Shop', creator: user) }
let(:project2) { create(:project, :repository, name: 'Another Project', path: 'another-project') }
before do
project.add_maintainer(user)
sign_in(user)
end
context 'when a user has write access' do
before do
visit(project_path(project))
2021-04-29 21:17:54 +05:30
wait_for_requests
2020-04-22 19:07:51 +05:30
end
2021-11-18 22:05:49 +05:30
[true, false].each do |value|
include_examples 'it uploads and commits a new text file', drop: value
2021-04-29 21:17:54 +05:30
2021-11-18 22:05:49 +05:30
include_examples 'it uploads and commits a new image file', drop: value
2021-04-29 21:17:54 +05:30
2021-11-18 22:05:49 +05:30
include_examples 'it uploads and commits a new pdf file', drop: value
2020-04-22 19:07:51 +05:30
2021-11-18 22:05:49 +05:30
include_examples 'it uploads a file to a sub-directory', drop: value
end
2020-04-22 19:07:51 +05:30
end
context 'when a user does not have write access' do
before do
project2.add_reporter(user)
visit(project_path(project2))
end
2021-11-18 22:05:49 +05:30
[true, false].each do |value|
include_examples 'it uploads and commits a new file to a forked project', drop: value
end
2020-04-22 19:07:51 +05:30
end
2021-04-17 20:07:23 +05:30
2021-12-11 22:18:48 +05:30
context 'with an empty repo' do
let(:project) { create(:project, :empty_repo, creator: user) }
2021-04-17 20:07:23 +05:30
2021-12-11 22:18:48 +05:30
before do
2021-04-17 20:07:23 +05:30
visit(project_path(project))
end
2021-12-11 22:18:48 +05:30
[true, false].each do |value|
include_examples 'uploads and commits a new text file via "upload file" button', drop: value
2021-04-17 20:07:23 +05:30
end
2021-12-11 22:18:48 +05:30
end
2020-04-22 19:07:51 +05:30
end