diff options
author | Raphael Tweitmann <r.tweity@gmx.de> | 2019-06-17 15:00:51 +0300 |
---|---|---|
committer | Fabio Pitino <fpitino@gitlab.com> | 2019-06-21 17:21:16 +0300 |
commit | a39277a4f9cd11029601bf863e09a127f8e82291 (patch) | |
tree | 610b5a4e79258a1dc9660fc0585d6af1fde9149f /spec/models/project_services | |
parent | 5f1038c8886ceb0e3879f29a074af7d4c6cb6171 (diff) |
Extract common validations from ci services
DroneCI and TeamCity shared the same validations methods
on the data received. These validations were extracted
into a concern
Diffstat (limited to 'spec/models/project_services')
-rw-r--r-- | spec/models/project_services/teamcity_service_spec.rb | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/spec/models/project_services/teamcity_service_spec.rb b/spec/models/project_services/teamcity_service_spec.rb index 1edb17932e5..3d875bc49e7 100644 --- a/spec/models/project_services/teamcity_service_spec.rb +++ b/spec/models/project_services/teamcity_service_spec.rb @@ -7,10 +7,11 @@ describe TeamcityService, :use_clean_rails_memory_store_caching do include StubRequests let(:teamcity_url) { 'http://gitlab.com/teamcity' } + let(:project) { create(:project) } subject(:service) do described_class.create( - project: create(:project), + project: project, properties: { teamcity_url: teamcity_url, username: 'mic', @@ -225,7 +226,7 @@ describe TeamcityService, :use_clean_rails_memory_store_caching do end it 'returns nil when ref is blank' do - data[:after] = "0000000000000000000000000000000000000000" + data[:after] = Gitlab::Git::BLANK_SHA expect(service.execute(data)).to be_nil end @@ -235,6 +236,12 @@ describe TeamcityService, :use_clean_rails_memory_store_caching do expect(service.execute(data)).to be_nil end + + it 'returns nil when a merge request is opened for the same ref' do + create(:merge_request, source_project: project, source_branch: 'dev-123_branch') + + expect(service.execute(data)).to be_nil + end end context 'when merge_request' do @@ -264,8 +271,8 @@ describe TeamcityService, :use_clean_rails_memory_store_caching do expect(service.execute(data)).to be_nil end - it 'returns nil when merge request is not unchecked or cannot_be_merged_recheck' do - data[:object_attributes][:merge_status] = 'checked' + it 'returns nil unless merge request is marked as unchecked' do + data[:object_attributes][:merge_status] = 'can_be_merged' expect(service.execute(data)).to be_nil end |