Commit 67974f1d authored by Tiago Botelho's avatar Tiago Botelho

remove invalid services

parent 3ff8d802
...@@ -26,6 +26,7 @@ class Service < ActiveRecord::Base ...@@ -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 ...@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment