Add belongs_to :project to Geo::ProjectRegistry

parent 2aae3142
class Geo::ProjectRegistry < Geo::BaseRegistry class Geo::ProjectRegistry < Geo::BaseRegistry
validates :project_id, presence: true belongs_to :project
validates :project, presence: true
scope :failed, -> { where.not(last_repository_synced_at: nil).where(last_repository_successful_sync_at: nil) } scope :failed, -> { where.not(last_repository_synced_at: nil).where(last_repository_successful_sync_at: nil) }
scope :synced, -> { where.not(last_repository_synced_at: nil, last_repository_successful_sync_at: nil) } scope :synced, -> { where.not(last_repository_synced_at: nil, last_repository_successful_sync_at: nil) }
......
require 'spec_helper' require 'spec_helper'
describe Geo::ProjectRegistry, models: true do describe Geo::ProjectRegistry, models: true do
describe 'relationships' do
it { is_expected.to belong_to(:project) }
end
describe 'validations' do describe 'validations' do
it { is_expected.to validate_presence_of(:project_id) } it { is_expected.to validate_presence_of(:project) }
end end
end end
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