summaryrefslogtreecommitdiff
path: root/spec/requests/api/projects_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/requests/api/projects_spec.rb')
-rw-r--r--spec/requests/api/projects_spec.rb33
1 files changed, 33 insertions, 0 deletions
diff --git a/spec/requests/api/projects_spec.rb b/spec/requests/api/projects_spec.rb
index 76b0c04e32d..46340f86f69 100644
--- a/spec/requests/api/projects_spec.rb
+++ b/spec/requests/api/projects_spec.rb
@@ -70,12 +70,14 @@ RSpec.describe API::Projects do
builds_enabled: false,
snippets_enabled: false)
end
+
let(:project_member2) do
create(:project_member,
user: user4,
project: project3,
access_level: ProjectMember::MAINTAINER)
end
+
let(:project4) do
create(:project,
name: 'third_project',
@@ -386,6 +388,14 @@ RSpec.describe API::Projects do
let(:current_user) { user }
let(:projects) { [public_project, project, project2, project3].select { |p| p.id > project2.id } }
end
+
+ context 'regression: empty string is ignored' do
+ it_behaves_like 'projects response' do
+ let(:filter) { { id_after: '' } }
+ let(:current_user) { user }
+ let(:projects) { [public_project, project, project2, project3] }
+ end
+ end
end
context 'and using id_before' do
@@ -394,6 +404,14 @@ RSpec.describe API::Projects do
let(:current_user) { user }
let(:projects) { [public_project, project, project2, project3].select { |p| p.id < project2.id } }
end
+
+ context 'regression: empty string is ignored' do
+ it_behaves_like 'projects response' do
+ let(:filter) { { id_before: '' } }
+ let(:current_user) { user }
+ let(:projects) { [public_project, project, project2, project3] }
+ end
+ end
end
context 'and using both id_after and id_before' do
@@ -1586,6 +1604,7 @@ RSpec.describe API::Projects do
expect(json_response['ci_default_git_depth']).to eq(project.ci_default_git_depth)
expect(json_response['merge_method']).to eq(project.merge_method.to_s)
expect(json_response['readme_url']).to eq(project.readme_url)
+ expect(json_response).to have_key 'packages_enabled'
end
it 'returns a group link with expiration date' do
@@ -2339,6 +2358,20 @@ RSpec.describe API::Projects do
expect(project_member).to be_persisted
end
+ describe 'updating packages_enabled attribute' do
+ it 'is enabled by default' do
+ expect(project.packages_enabled).to be true
+ end
+
+ it 'disables project packages feature' do
+ put(api("/projects/#{project.id}", user), params: { packages_enabled: false })
+
+ expect(response).to have_gitlab_http_status(:ok)
+ expect(project.reload.packages_enabled).to be false
+ expect(json_response['packages_enabled']).to eq(false)
+ end
+ end
+
it 'returns 400 when nothing sent' do
project_param = {}