From 67974f1dfb413452ca6fc048c856360f4a843eb1 Mon Sep 17 00:00:00 2001 From: Tiago Botelho Date: Tue, 25 Apr 2017 16:47:57 +0100 Subject: [PATCH] remove invalid services --- app/models/service.rb | 1 + spec/models/service_spec.rb | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/app/models/service.rb b/app/models/service.rb index dc76bf925d3..cbb75186206 100644 --- a/app/models/service.rb +++ b/app/models/service.rb @@ -26,6 +26,7 @@ class Service < ActiveRecord::Base has_one :service_hook validates :project_id, presence: true, unless: proc { |service| service.template? } + validates :type, presence: true scope :visible, -> { where.not(type: 'GitlabIssueTrackerService') } scope :issue_trackers, -> { where(category: 'issue_tracker') } diff --git a/spec/models/service_spec.rb b/spec/models/service_spec.rb index 0e2f07e945f..f5ba8f76f40 100644 --- a/spec/models/service_spec.rb +++ b/spec/models/service_spec.rb @@ -6,6 +6,10 @@ describe Service, models: true do it { is_expected.to have_one :service_hook } end + describe 'Validations' do + it { is_expected.to validate_presence_of(:type).on(:create) } + end + describe "Test Button" do before do @service = Service.new