summaryrefslogtreecommitdiff
path: root/spec/requests/api
diff options
context:
space:
mode:
Diffstat (limited to 'spec/requests/api')
-rw-r--r--spec/requests/api/branches_spec.rb3
-rw-r--r--spec/requests/api/graphql/mutations/branches/create_spec.rb3
-rw-r--r--spec/requests/api/graphql/mutations/snippets/create_spec.rb4
-rw-r--r--spec/requests/api/project_snippets_spec.rb2
-rw-r--r--spec/requests/api/snippets_spec.rb2
5 files changed, 8 insertions, 6 deletions
diff --git a/spec/requests/api/branches_spec.rb b/spec/requests/api/branches_spec.rb
index 77bb2a5100f..54223291b25 100644
--- a/spec/requests/api/branches_spec.rb
+++ b/spec/requests/api/branches_spec.rb
@@ -727,10 +727,11 @@ RSpec.describe API::Branches do
end
it 'returns 400 if ref name is invalid' do
+ error_message = 'Failed to create branch \'new_design3\': invalid reference name \'foo\''
post api(route, user), params: { branch: 'new_design3', ref: 'foo' }
expect(response).to have_gitlab_http_status(:bad_request)
- expect(json_response['message']).to eq('Invalid reference name: foo')
+ expect(json_response['message']).to eq(error_message)
end
end
diff --git a/spec/requests/api/graphql/mutations/branches/create_spec.rb b/spec/requests/api/graphql/mutations/branches/create_spec.rb
index 2f19de2af54..6a098002963 100644
--- a/spec/requests/api/graphql/mutations/branches/create_spec.rb
+++ b/spec/requests/api/graphql/mutations/branches/create_spec.rb
@@ -35,11 +35,12 @@ RSpec.describe 'Creation of a new branch' do
end
context 'when ref is not correct' do
+ err_msg = 'Failed to create branch \'another_branch\': invalid reference name \'unknown\''
let(:new_branch) { 'another_branch' }
let(:ref) { 'unknown' }
it_behaves_like 'a mutation that returns errors in the response',
- errors: ['Invalid reference name: unknown']
+ errors: [err_msg]
end
end
end
diff --git a/spec/requests/api/graphql/mutations/snippets/create_spec.rb b/spec/requests/api/graphql/mutations/snippets/create_spec.rb
index d329b9aea6a..9a3cea3ca14 100644
--- a/spec/requests/api/graphql/mutations/snippets/create_spec.rb
+++ b/spec/requests/api/graphql/mutations/snippets/create_spec.rb
@@ -85,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])
diff --git a/spec/requests/api/project_snippets_spec.rb b/spec/requests/api/project_snippets_spec.rb
index 6a9cf6e16e2..8cd1f15a88d 100644
--- a/spec/requests/api/project_snippets_spec.rb
+++ b/spec/requests/api/project_snippets_spec.rb
@@ -138,7 +138,7 @@ RSpec.describe API::ProjectSnippets do
aggregate_failures do
expect(snippet.repository.exists?).to be_truthy
- blob = snippet.repository.blob_at('master', file_path)
+ blob = snippet.repository.blob_at(snippet.default_branch, file_path)
expect(blob.data).to eq file_content
end
diff --git a/spec/requests/api/snippets_spec.rb b/spec/requests/api/snippets_spec.rb
index 227c53f8fb9..f4d15d0525e 100644
--- a/spec/requests/api/snippets_spec.rb
+++ b/spec/requests/api/snippets_spec.rb
@@ -223,7 +223,7 @@ RSpec.describe API::Snippets, factory_default: :keep do
it 'commit the files to the repository' do
subject
- blob = snippet.repository.blob_at('master', file_path)
+ blob = snippet.repository.blob_at(snippet.default_branch, file_path)
expect(blob.data).to eq file_content
end