diff options
Diffstat (limited to 'spec/requests/api/graphql/mutations/snippets/create_spec.rb')
-rw-r--r-- | spec/requests/api/graphql/mutations/snippets/create_spec.rb | 33 |
1 files changed, 4 insertions, 29 deletions
diff --git a/spec/requests/api/graphql/mutations/snippets/create_spec.rb b/spec/requests/api/graphql/mutations/snippets/create_spec.rb index 214c804c519..9a3cea3ca14 100644 --- a/spec/requests/api/graphql/mutations/snippets/create_spec.rb +++ b/spec/requests/api/graphql/mutations/snippets/create_spec.rb @@ -17,7 +17,6 @@ RSpec.describe 'Creating a Snippet' do let(:actions) { [{ action: action }.merge(file_1), { action: action }.merge(file_2)] } let(:project_path) { nil } let(:uploaded_files) { nil } - let(:spam_mutation_vars) { {} } let(:mutation_vars) do { description: description, @@ -26,7 +25,7 @@ RSpec.describe 'Creating a Snippet' do project_path: project_path, uploaded_files: uploaded_files, blob_actions: actions - }.merge(spam_mutation_vars) + } end let(:mutation) do @@ -77,21 +76,6 @@ RSpec.describe 'Creating a Snippet' do expect(mutation_response['snippet']).to be_nil end - - context 'when snippet_spam flag is disabled' do - before do - stub_feature_flags(snippet_spam: false) - end - - it 'passes disable_spam_action_service param to service' do - expect(::Snippets::CreateService) - .to receive(:new) - .with(project: anything, current_user: anything, params: hash_including(disable_spam_action_service: true)) - .and_call_original - - subject - end - end end shared_examples 'creates snippet' do @@ -101,8 +85,8 @@ RSpec.describe 'Creating a Snippet' do end.to change { Snippet.count }.by(1) snippet = Snippet.last - created_file_1 = snippet.repository.blob_at('HEAD', file_1[:filePath]) - created_file_2 = snippet.repository.blob_at('HEAD', file_2[:filePath]) + created_file_1 = snippet.repository.blob_at(snippet.default_branch, file_1[:filePath]) + created_file_2 = snippet.repository.blob_at(snippet.default_branch, file_2[:filePath]) expect(created_file_1.data).to match(file_1[:content]) expect(created_file_2.data).to match(file_2[:content]) @@ -121,15 +105,6 @@ RSpec.describe 'Creating a Snippet' do it_behaves_like 'snippet edit usage data counters' it_behaves_like 'a mutation which can mutate a spammable' do - let(:captcha_response) { 'abc123' } - let(:spam_log_id) { 1234 } - let(:spam_mutation_vars) do - { - captcha_response: captcha_response, - spam_log_id: spam_log_id - } - end - let(:service) { Snippets::CreateService } end end @@ -190,7 +165,7 @@ RSpec.describe 'Creating a Snippet' do it do expect(::Snippets::CreateService).to receive(:new) - .with(project: nil, current_user: user, params: hash_including(files: expected_value)) + .with(project: nil, current_user: user, params: hash_including(files: expected_value), spam_params: instance_of(::Spam::SpamParams)) .and_return(double(execute: creation_response)) subject |