mirror of
https://git.kescher.at/CatCatNya/catstodon.git
synced 2024-11-25 00:28:07 +01:00
Add model spec for Tombstone
(#32697)
This commit is contained in:
parent
917a799c67
commit
a20ac20302
3 changed files with 23 additions and 0 deletions
|
@ -14,4 +14,6 @@
|
||||||
|
|
||||||
class Tombstone < ApplicationRecord
|
class Tombstone < ApplicationRecord
|
||||||
belongs_to :account
|
belongs_to :account
|
||||||
|
|
||||||
|
validates :uri, presence: true
|
||||||
end
|
end
|
||||||
|
|
6
spec/fabricators/tombstone_fabricator.rb
Normal file
6
spec/fabricators/tombstone_fabricator.rb
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
Fabricator(:tombstone) do
|
||||||
|
account
|
||||||
|
uri { sequence(:uri) { |i| "https://host.example/value/#{i}" } }
|
||||||
|
end
|
15
spec/models/tombstone_spec.rb
Normal file
15
spec/models/tombstone_spec.rb
Normal file
|
@ -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
|
Loading…
Reference in a new issue