summaryrefslogtreecommitdiff
path: root/spec/frontend/fixtures/projects_json.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/frontend/fixtures/projects_json.rb')
-rw-r--r--spec/frontend/fixtures/projects_json.rb47
1 files changed, 47 insertions, 0 deletions
diff --git a/spec/frontend/fixtures/projects_json.rb b/spec/frontend/fixtures/projects_json.rb
new file mode 100644
index 00000000000..c081d4f08dc
--- /dev/null
+++ b/spec/frontend/fixtures/projects_json.rb
@@ -0,0 +1,47 @@
+# 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