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
|
has_one :service_hook
|
||||||
|
|
||||||
validates :project_id, presence: true, unless: proc { |service| service.template? }
|
validates :project_id, presence: true, unless: proc { |service| service.template? }
|
||||||
|
validates :type, presence: true
|
||||||
|
|
||||||
scope :visible, -> { where.not(type: 'GitlabIssueTrackerService') }
|
scope :visible, -> { where.not(type: 'GitlabIssueTrackerService') }
|
||||||
scope :issue_trackers, -> { where(category: 'issue_tracker') }
|
scope :issue_trackers, -> { where(category: 'issue_tracker') }
|
||||||
|
|
|
@ -6,6 +6,10 @@ describe Service, models: true do
|
||||||
it { is_expected.to have_one :service_hook }
|
it { is_expected.to have_one :service_hook }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe 'Validations' do
|
||||||
|
it { is_expected.to validate_presence_of(:type).on(:create) }
|
||||||
|
end
|
||||||
|
|
||||||
describe "Test Button" do
|
describe "Test Button" do
|
||||||
before do
|
before do
|
||||||
@service = Service.new
|
@service = Service.new
|
||||||
|
|
Loading…
Reference in a new issue