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

45 lines
1.2 KiB
Ruby
Raw Normal View History

2019-10-12 21:52:04 +05:30
# frozen_string_literal: true
2017-09-10 17:25:29 +05:30
require 'spec_helper'
2020-06-23 00:09:42 +05:30
RSpec.describe 'Projects > Files > User uploads files' do
2018-10-15 14:42:47 +05:30
let(:user) { create(:user) }
let(:project) { create(:project, :repository, name: 'Shop', creator: user) }
2017-09-10 17:25:29 +05:30
let(:project2) { create(:project, :repository, name: 'Another Project', path: 'another-project') }
before do
2018-11-18 11:00:15 +05:30
project.add_maintainer(user)
2017-09-10 17:25:29 +05:30
sign_in(user)
end
2020-04-22 19:07:51 +05:30
context 'when a user has write access' do
2017-09-10 17:25:29 +05:30
before do
2020-04-22 19:07:51 +05:30
visit(project_tree_path(project))
2018-10-15 14:42:47 +05:30
2021-04-29 21:17:54 +05:30
wait_for_requests
end
2017-09-10 17:25:29 +05:30
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
2017-09-10 17:25:29 +05:30
2021-11-18 22:05:49 +05:30
include_examples 'it uploads and commits a new image file', drop: value
2017-09-10 17:25:29 +05:30
2021-11-18 22:05:49 +05:30
include_examples 'it uploads and commits a new pdf file', drop: value
2017-09-10 17:25:29 +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
2018-03-17 18:26:18 +05:30
2020-04-22 19:07:51 +05:30
context 'when a user does not have write access' do
before do
project2.add_reporter(user)
2017-09-10 17:25:29 +05:30
2020-04-22 19:07:51 +05:30
visit(project_tree_path(project2))
2017-09-10 17:25:29 +05:30
end
2020-04-22 19:07:51 +05:30
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
2017-09-10 17:25:29 +05:30
end
end