mirror of
https://git.kescher.at/CatCatNya/catstodon.git
synced 2024-11-22 05:58:07 +01:00
Expand coverage for Block
model (#32480)
This commit is contained in:
parent
0ff427fab3
commit
63df649fe5
1 changed files with 27 additions and 1 deletions
|
@ -3,11 +3,37 @@
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
RSpec.describe Block do
|
RSpec.describe Block do
|
||||||
describe 'validations' do
|
describe 'Associations' do
|
||||||
it { is_expected.to belong_to(:account).required }
|
it { is_expected.to belong_to(:account).required }
|
||||||
it { is_expected.to belong_to(:target_account).required }
|
it { is_expected.to belong_to(:target_account).required }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe '#local?' do
|
||||||
|
it { is_expected.to_not be_local }
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'Callbacks' do
|
||||||
|
describe 'Setting a URI' do
|
||||||
|
context 'when URI exists' do
|
||||||
|
subject { Fabricate.build :block, uri: 'https://uri/value' }
|
||||||
|
|
||||||
|
it 'does not change' do
|
||||||
|
expect { subject.save }
|
||||||
|
.to not_change(subject, :uri)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when URI is blank' do
|
||||||
|
subject { Fabricate.build :follow, uri: nil }
|
||||||
|
|
||||||
|
it 'populates the value' do
|
||||||
|
expect { subject.save }
|
||||||
|
.to change(subject, :uri).to(be_present)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
it 'removes blocking cache after creation' do
|
it 'removes blocking cache after creation' do
|
||||||
account = Fabricate(:account)
|
account = Fabricate(:account)
|
||||||
target_account = Fabricate(:account)
|
target_account = Fabricate(:account)
|
||||||
|
|
Loading…
Reference in a new issue