remove invalid services

This commit is contained in:
Tiago Botelho 2017-04-25 16:47:57 +01:00
parent 3ff8d8020e
commit 67974f1dfb
2 changed files with 5 additions and 0 deletions

View file

@ -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') }

View file

@ -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