Skip to content
Snippets Groups Projects
Commit 47ebeef9 authored by GitLab Bot's avatar GitLab Bot
Browse files

Add latest changes from gitlab-org/gitlab@master

parent 06bb4eba
No related branches found
No related tags found
No related merge requests found
# frozen_string_literal: true
require 'spec_helper'
describe Gitlab::Graphql::Timeout do
it 'inherits from ' do
expect(described_class.superclass).to eq GraphQL::Schema::Timeout
end
it 'sends the error to our GraphQL logger' do
parent_type = double(graphql_name: 'parent_type')
field = double(graphql_name: 'field')
query = double(query_string: 'query_string', provided_variables: 'provided_variables')
error = GraphQL::Schema::Timeout::TimeoutError.new(parent_type, field)
expect(Gitlab::GraphqlLogger)
.to receive(:error)
.with(message: 'Timeout on parent_type.field', query: 'query_string', query_variables: 'provided_variables')
timeout = described_class.new(max_seconds: 30)
timeout.handle_timeout(error, query)
end
end
Loading
Loading
@@ -137,29 +137,4 @@ describe CommitRange do
end
end
end
describe '#has_been_reverted?' do
let(:user) { create(:user) }
let(:issue) { create(:issue, author: user, project: project) }
it 'returns true if the commit has been reverted' do
create(:note_on_issue,
noteable: issue,
system: true,
note: commit1.revert_description(user),
project: issue.project)
expect_next_instance_of(Commit) do |commit|
expect(commit).to receive(:reverts_commit?)
.with(commit1, user)
.and_return(true)
end
expect(commit1.has_been_reverted?(user, issue.notes_with_associations)).to eq(true)
end
it 'returns false if the commit has not been reverted' do
expect(commit1.has_been_reverted?(user, issue.notes_with_associations)).to eq(false)
end
end
end
Loading
Loading
@@ -821,4 +821,29 @@ eos
expect(commit.has_signature?).to be_falsey
end
end
describe '#has_been_reverted?' do
let(:user) { create(:user) }
let(:issue) { create(:issue, author: user, project: project) }
it 'returns true if the commit has been reverted' do
create(:note_on_issue,
noteable: issue,
system: true,
note: commit.revert_description(user),
project: issue.project)
expect_next_instance_of(Commit) do |revert_commit|
expect(revert_commit).to receive(:reverts_commit?)
.with(commit, user)
.and_return(true)
end
expect(commit.has_been_reverted?(user, issue.notes_with_associations)).to eq(true)
end
it 'returns false if the commit has not been reverted' do
expect(commit.has_been_reverted?(user, issue.notes_with_associations)).to eq(false)
end
end
end
Loading
Loading
@@ -11,11 +11,11 @@ describe 'GitlabSchema configurations' do
describe 'timeouts' do
context 'when timeout is reached' do
it 'shows an error' do
Timecop.scale(50000000) do # ludicrously large number because the timeout has to happen before the query even begins
subject
allow_any_instance_of(Gitlab::Graphql::Timeout).to receive(:max_seconds).and_return(0)
 
expect_graphql_errors_to_include /Timeout/
end
subject
expect_graphql_errors_to_include /Timeout/
end
end
end
Loading
Loading
@@ -140,7 +140,7 @@ describe 'GitlabSchema configurations' do
end
 
it_behaves_like 'imposing query limits' do
it "fails all queries when only one of the queries is too complex" do
it 'fails all queries when only one of the queries is too complex' do
# The `project` query above has a complexity of 5
allow(GitlabSchema).to receive(:max_query_complexity).and_return 4
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment