Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTiago Botelho <tiagonbotelho@hotmail.com>2018-03-27 18:33:29 +0300
committerTiago Botelho <tiagonbotelho@hotmail.com>2018-03-28 18:28:55 +0300
commit7fd9e39d885c7d7520ba0a7e45e8c58847f1c11d (patch)
tree9de4174e5fb03ecb2f324ef2b2c8e622cc51656a /spec/models/service_spec.rb
parentbf4a3af06ac4cb7f321267bf395022420e0c14a2 (diff)
When a Service templates are invalid newly created projects will have them inactive
Diffstat (limited to 'spec/models/service_spec.rb')
-rw-r--r--spec/models/service_spec.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/spec/models/service_spec.rb b/spec/models/service_spec.rb
index 79f25dc4360..83ed3b203e6 100644
--- a/spec/models/service_spec.rb
+++ b/spec/models/service_spec.rb
@@ -58,6 +58,21 @@ describe Service do
end
describe "Template" do
+ describe '.build_from_template' do
+ context 'when template is invalid' do
+ it 'sets service template to inactive when template is invalid' do
+ project = create(:project)
+ template = JiraService.new(template: true, active: true)
+ template.save(validate: false)
+
+ service = described_class.build_from_template(project.id, template)
+
+ expect(service).to be_valid
+ expect(service.active).to be false
+ end
+ end
+ end
+
describe "for pushover service" do
let!(:service_template) do
PushoverService.create(