diff --git a/app/models/tombstone.rb b/app/models/tombstone.rb index bf666c43ac..92eddfc626 100644 --- a/app/models/tombstone.rb +++ b/app/models/tombstone.rb @@ -14,4 +14,6 @@ class Tombstone < ApplicationRecord belongs_to :account + + validates :uri, presence: true end diff --git a/spec/fabricators/tombstone_fabricator.rb b/spec/fabricators/tombstone_fabricator.rb new file mode 100644 index 0000000000..b4cab086af --- /dev/null +++ b/spec/fabricators/tombstone_fabricator.rb @@ -0,0 +1,6 @@ +# frozen_string_literal: true + +Fabricator(:tombstone) do + account + uri { sequence(:uri) { |i| "https://host.example/value/#{i}" } } +end diff --git a/spec/models/tombstone_spec.rb b/spec/models/tombstone_spec.rb new file mode 100644 index 0000000000..ba0603fe3d --- /dev/null +++ b/spec/models/tombstone_spec.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +require 'rails_helper' + +RSpec.describe Tombstone do + describe 'Associations' do + it { is_expected.to belong_to(:account).required } + end + + describe 'Validations' do + subject { Fabricate.build :tombstone } + + it { is_expected.to validate_presence_of(:uri) } + end +end