diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2024-01-22 21:10:33 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2024-01-22 21:10:33 +0300 |
commit | a9a2f9257eae40935e03ca4185d5263bcb7ba45f (patch) | |
tree | f12875873819442e10ab04bd15fd975bf4bb7b64 /spec/requests/api/graphql/mutations/snippets/update_spec.rb | |
parent | 917d93d86da4dffd96abcfcf3aa83b0d6fa45286 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/requests/api/graphql/mutations/snippets/update_spec.rb')
-rw-r--r-- | spec/requests/api/graphql/mutations/snippets/update_spec.rb | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/spec/requests/api/graphql/mutations/snippets/update_spec.rb b/spec/requests/api/graphql/mutations/snippets/update_spec.rb index 0bc475c7105..c84aad85598 100644 --- a/spec/requests/api/graphql/mutations/snippets/update_spec.rb +++ b/spec/requests/api/graphql/mutations/snippets/update_spec.rb @@ -43,7 +43,8 @@ RSpec.describe 'Updating a Snippet', feature_category: :source_code_management d shared_examples 'graphql update actions' do context 'when the user does not have permission' do - let(:current_user) { create(:user) } + let(:user) { create(:user) } + let(:current_user) { user } it_behaves_like 'a mutation that returns top-level errors', errors: [Gitlab::Graphql::Authorize::AuthorizeResource::RESOURCE_ACCESS_ERROR] @@ -131,14 +132,18 @@ RSpec.describe 'Updating a Snippet', feature_category: :source_code_management d it_behaves_like 'graphql update actions' it_behaves_like 'when the snippet is not found' - it_behaves_like 'snippet edit usage data counters' + it_behaves_like 'snippet edit usage data counters' do + let(:user) { current_user } + end + it_behaves_like 'has spam protection' do let(:mutation_class) { ::Mutations::Snippets::Update } end end describe 'ProjectSnippet' do - let_it_be(:project) { create(:project, :private) } + let_it_be(:namespace) { create(:namespace) } + let_it_be(:project) { create(:project, :private, namespace: namespace) } let(:snippet) do create( @@ -181,7 +186,9 @@ RSpec.describe 'Updating a Snippet', feature_category: :source_code_management d end end - it_behaves_like 'snippet edit usage data counters' + it_behaves_like 'snippet edit usage data counters' do + let(:user) { current_user } + end it_behaves_like 'has spam protection' do let(:mutation_class) { ::Mutations::Snippets::Update } @@ -193,9 +200,8 @@ RSpec.describe 'Updating a Snippet', feature_category: :source_code_management d end it_behaves_like 'internal event tracking' do - let(:event) { ::Gitlab::UsageDataCounters::EditorUniqueCounter::EDIT_BY_SNIPPET_EDITOR } + let(:event) { 'g_edit_by_snippet_ide' } let(:user) { current_user } - let(:namespace) { project.namespace } end end end |