2022-08-27 11:52:29 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
RSpec.describe 'Jobs (JavaScript fixtures)' do
|
|
|
|
include ApiHelpers
|
|
|
|
include JavaScriptFixturesHelpers
|
|
|
|
include GraphqlHelpers
|
|
|
|
|
2022-11-25 23:54:43 +05:30
|
|
|
describe API::Projects, type: :request do
|
2022-08-27 11:52:29 +05:30
|
|
|
let_it_be(:user) { create(:user) }
|
|
|
|
|
2022-11-25 23:54:43 +05:30
|
|
|
describe 'transfer_locations' do
|
|
|
|
let_it_be(:groups) { create_list(:group, 4) }
|
|
|
|
let_it_be(:project) { create(:project, namespace: user.namespace) }
|
2022-08-27 11:52:29 +05:30
|
|
|
|
2022-11-25 23:54:43 +05:30
|
|
|
before_all do
|
|
|
|
groups.each { |group| group.add_owner(user) }
|
|
|
|
end
|
2022-08-27 11:52:29 +05:30
|
|
|
|
2022-11-25 23:54:43 +05:30
|
|
|
it 'api/projects/transfer_locations_page_1.json' do
|
|
|
|
get api("/projects/#{project.id}/transfer_locations?per_page=2", user)
|
2022-08-27 11:52:29 +05:30
|
|
|
|
2022-11-25 23:54:43 +05:30
|
|
|
expect(response).to be_successful
|
|
|
|
end
|
2022-08-27 11:52:29 +05:30
|
|
|
|
2022-11-25 23:54:43 +05:30
|
|
|
it 'api/projects/transfer_locations_page_2.json' do
|
|
|
|
get api("/projects/#{project.id}/transfer_locations?per_page=2&page=2", user)
|
2022-08-27 11:52:29 +05:30
|
|
|
|
2022-11-25 23:54:43 +05:30
|
|
|
expect(response).to be_successful
|
|
|
|
end
|
2022-08-27 11:52:29 +05:30
|
|
|
end
|
2022-11-25 23:54:43 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
describe GraphQL::Query, type: :request do
|
|
|
|
let_it_be(:user) { create(:user) }
|
|
|
|
|
|
|
|
query_name = 'current_user_namespace.query.graphql'
|
2022-08-27 11:52:29 +05:30
|
|
|
|
2022-11-25 23:54:43 +05:30
|
|
|
input_path = "projects/settings/graphql/queries/#{query_name}"
|
|
|
|
output_path = "graphql/projects/settings/#{query_name}.json"
|
2022-08-27 11:52:29 +05:30
|
|
|
|
2022-11-25 23:54:43 +05:30
|
|
|
it output_path do
|
|
|
|
query = get_graphql_query_as_string(input_path)
|
2022-08-27 11:52:29 +05:30
|
|
|
|
2022-11-25 23:54:43 +05:30
|
|
|
post_graphql(query, current_user: user)
|
2022-08-27 11:52:29 +05:30
|
|
|
|
|
|
|
expect_graphql_errors_to_be_empty
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|