mirror of
https://github.com/glitch-soc/mastodon.git
synced 2025-12-15 00:38:27 +00:00
Merge commit 'e0648a916ab81925545504173bf4f43ec64d4f3c' into glitch-soc/merge-upstream
Conflicts: - `app/models/custom_emoji.rb`: An upstream refactor touched lines adjacent to ones modified in glitch-soc. Ported upstream's changes.
This commit is contained in:
43
spec/models/bookmark_spec.rb
Normal file
43
spec/models/bookmark_spec.rb
Normal file
@@ -0,0 +1,43 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Bookmark do
|
||||
describe 'Associations' do
|
||||
it { is_expected.to belong_to(:account).required }
|
||||
it { is_expected.to belong_to(:status).required }
|
||||
end
|
||||
|
||||
describe 'Validations' do
|
||||
subject { Fabricate.build :bookmark }
|
||||
|
||||
it { is_expected.to validate_uniqueness_of(:status_id).scoped_to(:account_id) }
|
||||
end
|
||||
|
||||
describe 'Callbacks' do
|
||||
describe 'reblog statuses' do
|
||||
context 'when status is not a reblog' do
|
||||
let(:status) { Fabricate :status }
|
||||
|
||||
it 'keeps status set to assigned value' do
|
||||
bookmark = Fabricate.build :bookmark, status: status
|
||||
|
||||
expect { bookmark.valid? }
|
||||
.to_not change(bookmark, :status)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when status is a reblog' do
|
||||
let(:original) { Fabricate :status }
|
||||
let(:status) { Fabricate :status, reblog: original }
|
||||
|
||||
it 'keeps status set to assigned value' do
|
||||
bookmark = Fabricate.build :bookmark, status: status
|
||||
|
||||
expect { bookmark.valid? }
|
||||
.to change(bookmark, :status).to(original)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -84,4 +84,13 @@ RSpec.describe CustomEmoji, :attachment_processing do
|
||||
it { is_expected.to normalize(:domain).from(nil).to(nil) }
|
||||
end
|
||||
end
|
||||
|
||||
describe 'Validations' do
|
||||
subject { Fabricate.build :custom_emoji }
|
||||
|
||||
it { is_expected.to validate_uniqueness_of(:shortcode).scoped_to(:domain) }
|
||||
it { is_expected.to validate_length_of(:shortcode).is_at_least(described_class::MINIMUM_SHORTCODE_SIZE) }
|
||||
it { is_expected.to allow_values('cats').for(:shortcode) }
|
||||
it { is_expected.to_not allow_values('@#$@#$', 'X').for(:shortcode) }
|
||||
end
|
||||
end
|
||||
|
||||
@@ -9,7 +9,7 @@ RSpec.describe ListAccount do
|
||||
let(:list) { Fabricate :list, account: follow.account }
|
||||
|
||||
it 'finds and sets the follow with the list account' do
|
||||
list_account = described_class.create list: list, account: follow.target_account
|
||||
list_account = Fabricate :list_account, list: list, account: follow.target_account
|
||||
expect(list_account)
|
||||
.to have_attributes(
|
||||
follow: eq(follow),
|
||||
@@ -23,7 +23,7 @@ RSpec.describe ListAccount do
|
||||
let(:list) { Fabricate :list, account: follow_request.account }
|
||||
|
||||
it 'finds and sets the follow request with the list account' do
|
||||
list_account = described_class.create list: list, account: follow_request.target_account
|
||||
list_account = Fabricate :list_account, list: list, account: follow_request.target_account
|
||||
expect(list_account)
|
||||
.to have_attributes(
|
||||
follow: be_nil,
|
||||
@@ -33,10 +33,8 @@ RSpec.describe ListAccount do
|
||||
end
|
||||
|
||||
context 'when list owner is the account' do
|
||||
let(:list) { Fabricate :list }
|
||||
|
||||
it 'does not set follow or follow request' do
|
||||
list_account = described_class.create list: list, account: list.account
|
||||
list_account = Fabricate :list_account
|
||||
expect(list_account)
|
||||
.to have_attributes(
|
||||
follow: be_nil,
|
||||
|
||||
@@ -3,6 +3,12 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe PreviewCard do
|
||||
describe 'file size limit', :attachment_processing do
|
||||
it 'is set differently whether vips is enabled or not' do
|
||||
expect(described_class::LIMIT).to eq(Rails.configuration.x.use_vips ? 8.megabytes : 2.megabytes)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'validations' do
|
||||
describe 'urls' do
|
||||
it 'allows http schemes' do
|
||||
|
||||
Reference in New Issue
Block a user