debian-mirror-gitlab/spec/frontend/fixtures/pipeline_schedules.rb

76 lines
2.5 KiB
Ruby
Raw Normal View History

2019-12-21 20:55:43 +05:30
# frozen_string_literal: true
2018-03-17 18:26:18 +05:30
require 'spec_helper'
2022-11-25 23:54:43 +05:30
RSpec.describe 'Pipeline schedules (JavaScript fixtures)' do
include ApiHelpers
2018-03-17 18:26:18 +05:30
include JavaScriptFixturesHelpers
2022-11-25 23:54:43 +05:30
include GraphqlHelpers
2018-03-17 18:26:18 +05:30
2022-10-11 01:57:18 +05:30
let(:namespace) { create(:namespace, name: 'frontend-fixtures' ) }
2018-03-17 18:26:18 +05:30
let(:project) { create(:project, :public, :repository) }
2022-04-04 11:22:00 +05:30
let(:user) { project.first_owner }
2021-02-22 17:27:13 +05:30
let!(:pipeline_schedule) { create(:ci_pipeline_schedule, project: project, owner: user) }
2022-11-25 23:54:43 +05:30
let!(:pipeline_schedule_inactive) { create(:ci_pipeline_schedule, :inactive, project: project, owner: user) }
2021-02-22 17:27:13 +05:30
let!(:pipeline_schedule_populated) { create(:ci_pipeline_schedule, project: project, owner: user) }
2018-03-17 18:26:18 +05:30
let!(:pipeline_schedule_variable1) { create(:ci_pipeline_schedule_variable, key: 'foo', value: 'foovalue', pipeline_schedule: pipeline_schedule_populated) }
let!(:pipeline_schedule_variable2) { create(:ci_pipeline_schedule_variable, key: 'bar', value: 'barvalue', pipeline_schedule: pipeline_schedule_populated) }
2022-11-25 23:54:43 +05:30
describe Projects::PipelineSchedulesController, type: :controller do
render_views
2018-03-17 18:26:18 +05:30
2022-11-25 23:54:43 +05:30
before do
sign_in(user)
stub_feature_flags(pipeline_schedules_vue: false)
end
it 'pipeline_schedules/edit.html' do
get :edit, params: {
namespace_id: project.namespace.to_param,
project_id: project,
id: pipeline_schedule.id
}
expect(response).to be_successful
end
2018-03-17 18:26:18 +05:30
2022-11-25 23:54:43 +05:30
it 'pipeline_schedules/edit_with_variables.html' do
get :edit, params: {
namespace_id: project.namespace.to_param,
project_id: project,
id: pipeline_schedule_populated.id
}
2018-03-17 18:26:18 +05:30
2022-11-25 23:54:43 +05:30
expect(response).to be_successful
end
2018-03-17 18:26:18 +05:30
end
2022-11-25 23:54:43 +05:30
describe GraphQL::Query, type: :request do
before do
pipeline_schedule.pipelines << build(:ci_pipeline, project: project)
end
fixtures_path = 'graphql/pipeline_schedules/'
get_pipeline_schedules_query = 'get_pipeline_schedules.query.graphql'
let_it_be(:query) do
get_graphql_query_as_string("pipeline_schedules/graphql/queries/#{get_pipeline_schedules_query}")
end
it "#{fixtures_path}#{get_pipeline_schedules_query}.json" do
post_graphql(query, current_user: user, variables: { projectPath: project.full_path })
expect_graphql_errors_to_be_empty
end
it "#{fixtures_path}#{get_pipeline_schedules_query}.as_guest.json" do
guest = create(:user)
project.add_guest(user)
post_graphql(query, current_user: guest, variables: { projectPath: project.full_path })
2018-03-17 18:26:18 +05:30
2022-11-25 23:54:43 +05:30
expect_graphql_errors_to_be_empty
end
2018-03-17 18:26:18 +05:30
end
end