diff options
Diffstat (limited to 'spec/contracts/provider')
16 files changed, 145 insertions, 63 deletions
diff --git a/spec/contracts/provider/pact_helpers/project/merge_request/diffs_batch_helper.rb b/spec/contracts/provider/pact_helpers/project/merge_request/show/diffs_batch_helper.rb index 7d1fbe91e86..f94ce47b1f3 100644 --- a/spec/contracts/provider/pact_helpers/project/merge_request/diffs_batch_helper.rb +++ b/spec/contracts/provider/pact_helpers/project/merge_request/show/diffs_batch_helper.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true -require_relative '../../../spec_helper' -require_relative '../../../states/project/merge_request/diffs_batch_state' +require_relative '../../../../spec_helper' +require_relative '../../../../states/project/merge_request/show_state' module Provider module DiffsBatchHelper diff --git a/spec/contracts/provider/pact_helpers/project/merge_request/diffs_metadata_helper.rb b/spec/contracts/provider/pact_helpers/project/merge_request/show/diffs_metadata_helper.rb index 5f0c58d18d4..61567214b7a 100644 --- a/spec/contracts/provider/pact_helpers/project/merge_request/diffs_metadata_helper.rb +++ b/spec/contracts/provider/pact_helpers/project/merge_request/show/diffs_metadata_helper.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true -require_relative '../../../spec_helper' -require_relative '../../../states/project/merge_request/diffs_metadata_state' +require_relative '../../../../spec_helper' +require_relative '../../../../states/project/merge_request/show_state' module Provider module DiffsMetadataHelper diff --git a/spec/contracts/provider/pact_helpers/project/merge_request/discussions_helper.rb b/spec/contracts/provider/pact_helpers/project/merge_request/show/discussions_helper.rb index 0f4244ba40a..fa76ce8889a 100644 --- a/spec/contracts/provider/pact_helpers/project/merge_request/discussions_helper.rb +++ b/spec/contracts/provider/pact_helpers/project/merge_request/show/discussions_helper.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true -require_relative '../../../spec_helper' -require_relative '../../../states/project/merge_request/discussions_state' +require_relative '../../../../spec_helper' +require_relative '../../../../states/project/merge_request/show_state' module Provider module DiscussionsHelper diff --git a/spec/contracts/provider/pact_helpers/project/pipeline/index/create_a_new_pipeline_helper.rb b/spec/contracts/provider/pact_helpers/project/pipeline/index/create_a_new_pipeline_helper.rb new file mode 100644 index 00000000000..247a7c4ca8e --- /dev/null +++ b/spec/contracts/provider/pact_helpers/project/pipeline/index/create_a_new_pipeline_helper.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +require_relative '../../../../spec_helper' +require_relative '../../../../states/project/pipeline/new_state' + +module Provider + module CreateNewPipelineHelper + Pact.service_provider "POST Create a new pipeline" do + app { Environments::Test.app } + + honours_pact_with 'Pipelines#new' do + pact_uri '../contracts/project/pipeline/new/pipelines#new-post_create_a_new_pipeline.json' + end + end + end +end diff --git a/spec/contracts/provider/pact_helpers/project/pipeline/get_list_project_pipelines_helper.rb b/spec/contracts/provider/pact_helpers/project/pipeline/index/get_list_project_pipelines_helper.rb index 5307468b7c6..80cbbe3b4dd 100644 --- a/spec/contracts/provider/pact_helpers/project/pipeline/get_list_project_pipelines_helper.rb +++ b/spec/contracts/provider/pact_helpers/project/pipeline/index/get_list_project_pipelines_helper.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true -require_relative '../../../spec_helper' -require_relative '../../../states/project/pipeline/pipelines_state' +require_relative '../../../../spec_helper' +require_relative '../../../../states/project/pipeline/index_state' module Provider module GetListProjectPipelinesHelper diff --git a/spec/contracts/provider/pact_helpers/project/pipeline/show/delete_pipeline_helper.rb b/spec/contracts/provider/pact_helpers/project/pipeline/show/delete_pipeline_helper.rb new file mode 100644 index 00000000000..2d29fabfeca --- /dev/null +++ b/spec/contracts/provider/pact_helpers/project/pipeline/show/delete_pipeline_helper.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +require_relative '../../../../spec_helper' +require_relative '../../../../states/project/pipeline/show_state' + +module Provider + module DeletePipelineHelper + Pact.service_provider "DELETE pipeline" do + app { Environments::Test.app } + + honours_pact_with 'Pipelines#show' do + pact_uri '../contracts/project/pipeline/show/pipelines#show-delete_pipeline.json' + end + end + end +end diff --git a/spec/contracts/provider/pact_helpers/project/pipeline/get_pipeline_header_data_helper.rb b/spec/contracts/provider/pact_helpers/project/pipeline/show/get_pipeline_header_data_helper.rb index abb2781f987..bc8c04cc455 100644 --- a/spec/contracts/provider/pact_helpers/project/pipeline/get_pipeline_header_data_helper.rb +++ b/spec/contracts/provider/pact_helpers/project/pipeline/show/get_pipeline_header_data_helper.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true -require_relative '../../../spec_helper' -require_relative '../../../states/project/pipeline/pipeline_state' +require_relative '../../../../spec_helper' +require_relative '../../../../states/project/pipeline/show_state' module Provider module GetPipelinesHeaderDataHelper diff --git a/spec/contracts/provider/pact_helpers/project/pipeline_schedule/update_pipeline_schedule_helper.rb b/spec/contracts/provider/pact_helpers/project/pipeline_schedule/update_pipeline_schedule_helper.rb new file mode 100644 index 00000000000..a83aa9524dc --- /dev/null +++ b/spec/contracts/provider/pact_helpers/project/pipeline_schedule/update_pipeline_schedule_helper.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +require_relative '../../../spec_helper' +require_relative '../../../states/project/pipeline_schedule/edit_state' + +module Provider + module CreateNewPipelineHelper + Pact.service_provider "PUT Edit a pipeline schedule" do + app { Environments::Test.app } + + honours_pact_with 'PipelineSchedule#edit' do + pact_uri '../contracts/project/pipeline_schedule/edit/pipelineschedules#edit-put_edit_a_pipeline_schedule.json' + end + end + end +end diff --git a/spec/contracts/provider/states/project/merge_request/diffs_batch_state.rb b/spec/contracts/provider/states/project/merge_request/diffs_batch_state.rb deleted file mode 100644 index ac20c17c187..00000000000 --- a/spec/contracts/provider/states/project/merge_request/diffs_batch_state.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -Pact.provider_states_for "MergeRequest#show" do - provider_state "a merge request with diffs exists" do - set_up do - user = User.find_by(name: Provider::UsersHelper::CONTRACT_USER_NAME) - namespace = create(:namespace, name: 'gitlab-org') - project = create(:project, :custom_repo, name: 'gitlab-qa', namespace: namespace, files: {}) - - project.add_maintainer(user) - - merge_request = create(:merge_request_with_multiple_diffs, source_project: project) - merge_request_diff = create(:merge_request_diff, merge_request: merge_request) - - create(:merge_request_diff_file, :new_file, merge_request_diff: merge_request_diff) - end - end -end diff --git a/spec/contracts/provider/states/project/merge_request/diffs_metadata_state.rb b/spec/contracts/provider/states/project/merge_request/diffs_metadata_state.rb deleted file mode 100644 index 8754232690c..00000000000 --- a/spec/contracts/provider/states/project/merge_request/diffs_metadata_state.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true - -Pact.provider_states_for "MergeRequest#show" do - provider_state "a merge request exists" do - set_up do - user = User.find_by(name: Provider::UsersHelper::CONTRACT_USER_NAME) - namespace = create(:namespace, name: 'gitlab-org') - project = create(:project, :custom_repo, name: 'gitlab-qa', namespace: namespace, files: {}) - - project.add_maintainer(user) - - merge_request = create(:merge_request, source_project: project) - merge_request_diff = create(:merge_request_diff, merge_request: merge_request) - - create(:merge_request_diff_file, :new_file, merge_request_diff: merge_request_diff) - end - end -end diff --git a/spec/contracts/provider/states/project/merge_request/discussions_state.rb b/spec/contracts/provider/states/project/merge_request/discussions_state.rb deleted file mode 100644 index 2d64f85eedf..00000000000 --- a/spec/contracts/provider/states/project/merge_request/discussions_state.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -Pact.provider_states_for "MergeRequest#show" do - provider_state "a merge request with discussions exists" do - set_up do - user = User.find_by(name: Provider::UsersHelper::CONTRACT_USER_NAME) - namespace = create(:namespace, name: 'gitlab-org') - project = create(:project, name: 'gitlab-qa', namespace: namespace) - - project.add_maintainer(user) - - merge_request = create(:merge_request_with_diffs, source_project: project, author: user) - - create(:discussion_note_on_merge_request, noteable: merge_request, project: project, author: user) - end - end -end diff --git a/spec/contracts/provider/states/project/merge_request/show_state.rb b/spec/contracts/provider/states/project/merge_request/show_state.rb new file mode 100644 index 00000000000..46f322f723a --- /dev/null +++ b/spec/contracts/provider/states/project/merge_request/show_state.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +Pact.provider_states_for "MergeRequest#show" do + provider_state "a merge request with diffs exists" do + set_up do + user = User.find_by(name: Provider::UsersHelper::CONTRACT_USER_NAME) + namespace = create(:namespace, name: 'gitlab-org') + project = create(:project, :custom_repo, name: 'gitlab-qa', namespace: namespace, files: {}) + + project.add_maintainer(user) + + merge_request = create(:merge_request_with_multiple_diffs, source_project: project) + merge_request_diff = create(:merge_request_diff, merge_request: merge_request) + + create(:merge_request_diff_file, :new_file, merge_request_diff: merge_request_diff) + end + end + + provider_state "a merge request exists" do + set_up do + user = User.find_by(name: Provider::UsersHelper::CONTRACT_USER_NAME) + namespace = create(:namespace, name: 'gitlab-org') + project = create(:project, :custom_repo, name: 'gitlab-qa', namespace: namespace, files: {}) + + project.add_maintainer(user) + + merge_request = create(:merge_request, source_project: project) + merge_request_diff = create(:merge_request_diff, merge_request: merge_request) + + create(:merge_request_diff_file, :new_file, merge_request_diff: merge_request_diff) + end + end + + provider_state "a merge request with discussions exists" do + set_up do + user = User.find_by(name: Provider::UsersHelper::CONTRACT_USER_NAME) + namespace = create(:namespace, name: 'gitlab-org') + project = create(:project, name: 'gitlab-qa', namespace: namespace) + + project.add_maintainer(user) + + merge_request = create(:merge_request_with_diffs, source_project: project, author: user) + + create(:discussion_note_on_merge_request, noteable: merge_request, project: project, author: user) + end + end +end diff --git a/spec/contracts/provider/states/project/pipeline/pipelines_state.rb b/spec/contracts/provider/states/project/pipeline/index_state.rb index 639c25e9894..639c25e9894 100644 --- a/spec/contracts/provider/states/project/pipeline/pipelines_state.rb +++ b/spec/contracts/provider/states/project/pipeline/index_state.rb diff --git a/spec/contracts/provider/states/project/pipeline/new_state.rb b/spec/contracts/provider/states/project/pipeline/new_state.rb new file mode 100644 index 00000000000..95914180bec --- /dev/null +++ b/spec/contracts/provider/states/project/pipeline/new_state.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +Pact.provider_states_for "Pipelines#new" do + provider_state "a project with a valid .gitlab-ci.yml configuration exists" do + set_up do + user = User.find_by(name: Provider::UsersHelper::CONTRACT_USER_NAME) + namespace = create(:namespace, name: 'gitlab-org') + project = create( + :project, + :custom_repo, + name: 'gitlab-qa', + namespace: namespace, + creator: user, + files: { + '.gitlab-ci.yml' => <<~YAML + test-success: + script: echo 'OK' + YAML + }) + + project.add_maintainer(user) + end + end +end diff --git a/spec/contracts/provider/states/project/pipeline/pipeline_state.rb b/spec/contracts/provider/states/project/pipeline/show_state.rb index d1a4cd34bdd..3365647cd13 100644 --- a/spec/contracts/provider/states/project/pipeline/pipeline_state.rb +++ b/spec/contracts/provider/states/project/pipeline/show_state.rb @@ -15,6 +15,7 @@ Pact.provider_states_for "Pipelines#show" do :ci_pipeline, :with_job, :success, + id: 316112, iid: 1, project: project, user: user, diff --git a/spec/contracts/provider/states/project/pipeline_schedule/edit_state.rb b/spec/contracts/provider/states/project/pipeline_schedule/edit_state.rb new file mode 100644 index 00000000000..4ee714f15f3 --- /dev/null +++ b/spec/contracts/provider/states/project/pipeline_schedule/edit_state.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +Pact.provider_states_for "PipelineSchedules#edit" do + provider_state "a project with a pipeline schedule exists" do + set_up do + user = User.find_by(name: Provider::UsersHelper::CONTRACT_USER_NAME) + namespace = create(:namespace, name: 'gitlab-org') + project = create(:project, :repository, name: 'gitlab-qa', namespace: namespace, creator: user) + + project.add_maintainer(user) + + create(:ci_pipeline_schedule, id: 25, project: project, owner: user) + end + end +end |