summaryrefslogtreecommitdiff
path: root/spec/models/project_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/models/project_spec.rb')
-rw-r--r--spec/models/project_spec.rb12
1 files changed, 11 insertions, 1 deletions
diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb
index 453f9761602..875ad59d556 100644
--- a/spec/models/project_spec.rb
+++ b/spec/models/project_spec.rb
@@ -4543,7 +4543,7 @@ describe Project do
end
describe "#find_or_initialize_services" do
- subject { build(:project) }
+ subject { create(:project) }
it 'returns only enabled services' do
allow(Service).to receive(:available_services_names).and_return(%w(prometheus pushover))
@@ -4554,6 +4554,16 @@ describe Project do
expect(services.count).to eq 1
expect(services).to include(PushoverService)
end
+
+ it 'returns only available services' do
+ allow(Service).to receive(:available_services_names).and_return(%w(pushover))
+ create(Service, type: 'UnavailableService', project: subject)
+
+ services = subject.find_or_initialize_services
+
+ expect(services.count).to eq 1
+ expect(services).to include(PushoverService)
+ end
end
describe "#find_or_initialize_service" do