diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-19 09:08:42 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-19 09:08:42 +0000 |
commit | b76ae638462ab0f673e5915986070518dd3f9ad3 (patch) | |
tree | bdab0533383b52873be0ec0eb4d3c66598ff8b91 /spec/controllers/projects_controller_spec.rb | |
parent | 434373eabe7b4be9593d18a585fb763f1e5f1a6f (diff) | |
download | gitlab-ce-b76ae638462ab0f673e5915986070518dd3f9ad3.tar.gz |
Add latest changes from gitlab-org/gitlab@14-2-stable-eev14.2.0-rc42
Diffstat (limited to 'spec/controllers/projects_controller_spec.rb')
-rw-r--r-- | spec/controllers/projects_controller_spec.rb | 57 |
1 files changed, 28 insertions, 29 deletions
diff --git a/spec/controllers/projects_controller_spec.rb b/spec/controllers/projects_controller_spec.rb index 46c17d6a6fe..8afb80d9cc5 100644 --- a/spec/controllers/projects_controller_spec.rb +++ b/spec/controllers/projects_controller_spec.rb @@ -435,32 +435,6 @@ RSpec.describe ProjectsController do end end - describe 'POST create' do - let!(:project_params) do - { - path: 'foo', - description: 'bar', - namespace_id: user.namespace.id, - visibility_level: Gitlab::VisibilityLevel::PUBLIC, - initialize_with_readme: 1 - } - end - - before do - sign_in(user) - end - - it 'tracks a created event for the new_project_readme experiment', :experiment do - expect(experiment(:new_project_readme)).to track( - :created, - property: 'blank', - value: 1 - ).with_context(actor: user).on_next_instance - - post :create, params: { project: project_params } - end - end - describe 'POST #archive' do let_it_be(:group) { create(:group) } let_it_be(:project) { create(:project, group: group) } @@ -793,8 +767,7 @@ RSpec.describe ProjectsController do id: project.path, project: { project_setting_attributes: { - show_default_award_emojis: boolean_value, - allow_editing_commit_messages: boolean_value + show_default_award_emojis: boolean_value } } } @@ -802,7 +775,33 @@ RSpec.describe ProjectsController do project.reload expect(project.show_default_award_emojis?).to eq(result) - expect(project.allow_editing_commit_messages?).to eq(result) + end + end + end + + context 'with project feature attributes' do + using RSpec::Parameterized::TableSyntax + + where(:feature, :initial_value, :update_to) do + :metrics_dashboard_access_level | ProjectFeature::PRIVATE | ProjectFeature::ENABLED + :container_registry_access_level | ProjectFeature::ENABLED | ProjectFeature::PRIVATE + end + + with_them do + it "updates the project_feature new" do + params = { + namespace_id: project.namespace, + id: project.path, + project: { + project_feature_attributes: { + "#{feature}": update_to + } + } + } + + expect { put :update, params: params }.to change { + project.reload.project_feature.public_send(feature) + }.from(initial_value).to(update_to) end end end |