Commit c0024233 authored by Paul Slaughter's avatar Paul Slaughter

Add fixtures used in mock_server

These are the ones needed to support the IDE
starting up.
parent 79de7066
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe API::MergeRequests, '(JavaScript fixtures)', type: :request do
include ApiHelpers
include JavaScriptFixturesHelpers
let(:admin) { create(:admin, name: 'root') }
let(:namespace) { create(:namespace, name: 'gitlab-test' )}
let(:project) { create(:project, :repository, namespace: namespace, path: 'lorem-ipsum') }
before(:all) do
clean_frontend_fixtures('api/merge_requests')
end
it 'api/merge_requests/get.json' do
4.times { |i| create(:merge_request, source_project: project, source_branch: "branch-#{i}") }
get api("/projects/#{project.id}/merge_requests", admin)
expect(response).to be_successful
end
end
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe API::Projects, '(JavaScript fixtures)', type: :request do
include ApiHelpers
include JavaScriptFixturesHelpers
let(:admin) { create(:admin, name: 'root') }
let(:namespace) { create(:namespace, name: 'gitlab-test' )}
let(:project) { create(:project, :repository, namespace: namespace, path: 'lorem-ipsum') }
let(:project_empty) { create(:project_empty_repo, namespace: namespace, path: 'lorem-ipsum-empty') }
before(:all) do
clean_frontend_fixtures('api/projects')
end
it 'api/projects/get.json' do
get api("/projects/#{project.id}", admin)
expect(response).to be_successful
end
it 'api/projects/get_empty.json' do
get api("/projects/#{project_empty.id}", admin)
expect(response).to be_successful
end
it 'api/projects/branches/get.json' do
get api("/projects/#{project.id}/repository/branches/#{project.default_branch}", admin)
expect(response).to be_successful
end
end
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Projects JSON endpoints (JavaScript fixtures)', type: :controller do
include JavaScriptFixturesHelpers
let(:admin) { create(:admin, name: 'root') }
let(:project) { create(:project, :repository) }
before(:all) do
clean_frontend_fixtures('projects_json/')
end
before do
project.add_maintainer(admin)
sign_in(admin)
end
describe Projects::FindFileController, '(JavaScript fixtures)', type: :controller do
it 'projects_json/files.json' do
get :list,
params: {
namespace_id: project.namespace.to_param,
project_id: project,
id: project.default_branch
},
format: 'json'
expect(response).to be_successful
end
end
describe Projects::CommitController, '(JavaScript fixtures)', type: :controller do
it 'projects_json/pipelines_empty.json' do
get :pipelines,
params: {
namespace_id: project.namespace.to_param,
project_id: project,
id: project.commit(project.default_branch).id,
format: 'json'
}
expect(response).to be_successful
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment