remove invalid services
This commit is contained in:
parent
3ff8d8020e
commit
67974f1dfb
2 changed files with 5 additions and 0 deletions
|
@ -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') }
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue