Commit fef030c2 authored by Alexis Reigel's avatar Alexis Reigel

validate the foreign_key instead of the relation

parent a5f04df8
......@@ -8,7 +8,7 @@ class GpgSignature < ActiveRecord::Base
belongs_to :gpg_key
validates :commit_sha, presence: true
validates :project, presence: true
validates :project_id, presence: true
validates :gpg_key_primary_keyid, presence: true
def gpg_key_primary_keyid
......
......@@ -9,7 +9,7 @@ RSpec.describe GpgSignature do
describe 'validation' do
subject { described_class.new }
it { is_expected.to validate_presence_of(:commit_sha) }
it { is_expected.to validate_presence_of(:project) }
it { is_expected.to validate_presence_of(:project_id) }
it { is_expected.to validate_presence_of(:gpg_key_primary_keyid) }
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