Merge branch 'main' into glitch-soc/merge-upstream
- `app/views/statuses/_simple_status.html.haml`: Small markup change in glitch-soc, on a line that has been modified by upstream. Ported upstream changes.
This commit is contained in:
@ -1,38 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe AccountTagStat, type: :model do
|
||||
key = 'accounts_count'
|
||||
let(:account_tag_stat) { Fabricate(:tag).account_tag_stat }
|
||||
|
||||
describe '#increment_count!' do
|
||||
it 'calls #update' do
|
||||
args = { key => account_tag_stat.public_send(key) + 1 }
|
||||
expect(account_tag_stat).to receive(:update).with(args)
|
||||
account_tag_stat.increment_count!(key)
|
||||
end
|
||||
|
||||
it 'increments value by 1' do
|
||||
expect do
|
||||
account_tag_stat.increment_count!(key)
|
||||
end.to change { account_tag_stat.accounts_count }.by(1)
|
||||
end
|
||||
end
|
||||
|
||||
describe '#decrement_count!' do
|
||||
it 'calls #update' do
|
||||
args = { key => [account_tag_stat.public_send(key) - 1, 0].max }
|
||||
expect(account_tag_stat).to receive(:update).with(args)
|
||||
account_tag_stat.decrement_count!(key)
|
||||
end
|
||||
|
||||
it 'decrements value by 1' do
|
||||
account_tag_stat.update(key => 1)
|
||||
|
||||
expect do
|
||||
account_tag_stat.decrement_count!(key)
|
||||
end.to change { account_tag_stat.accounts_count }.by(-1)
|
||||
end
|
||||
end
|
||||
end
|
@ -7,7 +7,7 @@ RSpec.describe FollowRequest, type: :model do
|
||||
let(:target_account) { Fabricate(:account) }
|
||||
|
||||
it 'calls Account#follow!, MergeWorker.perform_async, and #destroy!' do
|
||||
expect(account).to receive(:follow!).with(target_account, reblogs: true, notify: false, uri: follow_request.uri)
|
||||
expect(account).to receive(:follow!).with(target_account, reblogs: true, notify: false, uri: follow_request.uri, bypass_limit: true)
|
||||
expect(MergeWorker).to receive(:perform_async).with(target_account.id, account.id)
|
||||
expect(follow_request).to receive(:destroy!)
|
||||
follow_request.authorize!
|
||||
|
@ -74,13 +74,13 @@ RSpec.describe SessionActivation, type: :model do
|
||||
let(:options) { { user: Fabricate(:user), session_id: '1' } }
|
||||
|
||||
it 'calls create! and purge_old' do
|
||||
expect(described_class).to receive(:create!).with(options)
|
||||
expect(described_class).to receive(:create!).with(**options)
|
||||
expect(described_class).to receive(:purge_old)
|
||||
described_class.activate(options)
|
||||
described_class.activate(**options)
|
||||
end
|
||||
|
||||
it 'returns an instance of SessionActivation' do
|
||||
expect(described_class.activate(options)).to be_kind_of SessionActivation
|
||||
expect(described_class.activate(**options)).to be_kind_of SessionActivation
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -96,6 +96,20 @@ RSpec.describe Tag, type: :model do
|
||||
end
|
||||
end
|
||||
|
||||
describe '.matches_name' do
|
||||
it 'returns tags for multibyte case-insensitive names' do
|
||||
upcase_string = 'abcABCabcABCやゆよ'
|
||||
downcase_string = 'abcabcabcabcやゆよ';
|
||||
|
||||
tag = Fabricate(:tag, name: downcase_string)
|
||||
expect(Tag.matches_name(upcase_string)).to eq [tag]
|
||||
end
|
||||
|
||||
it 'uses the LIKE operator' do
|
||||
expect(Tag.matches_name('100%abc').to_sql).to eq %q[SELECT "tags".* FROM "tags" WHERE LOWER("tags"."name") LIKE LOWER('100\\%abc%')]
|
||||
end
|
||||
end
|
||||
|
||||
describe '.matching_name' do
|
||||
it 'returns tags for multibyte case-insensitive names' do
|
||||
upcase_string = 'abcABCabcABCやゆよ'
|
||||
|
@ -7,9 +7,9 @@ RSpec.describe TrendingTags do
|
||||
|
||||
describe '.update!' do
|
||||
let!(:at_time) { Time.now.utc }
|
||||
let!(:tag1) { Fabricate(:tag, name: 'Catstodon') }
|
||||
let!(:tag2) { Fabricate(:tag, name: 'DogsOfMastodon') }
|
||||
let!(:tag3) { Fabricate(:tag, name: 'OCs') }
|
||||
let!(:tag1) { Fabricate(:tag, name: 'Catstodon', trendable: true) }
|
||||
let!(:tag2) { Fabricate(:tag, name: 'DogsOfMastodon', trendable: true) }
|
||||
let!(:tag3) { Fabricate(:tag, name: 'OCs', trendable: true) }
|
||||
|
||||
before do
|
||||
allow(Redis.current).to receive(:pfcount) do |key|
|
||||
|
Reference in New Issue
Block a user