Merge commit '389a6cc4c0' into upstream-20231108

This commit is contained in:
KMY 2023-11-08 10:41:10 +09:00
commit 08f86bcb8f
107 changed files with 970 additions and 703 deletions

View file

@ -18,21 +18,8 @@ RSpec.describe Admin::AccountsController do
end
it 'filters with parameters' do
new = AccountFilter.method(:new)
expect(AccountFilter).to receive(:new) do |params|
h = params.to_h
expect(h[:origin]).to eq 'local'
expect(h[:by_domain]).to eq 'domain'
expect(h[:status]).to eq 'active'
expect(h[:username]).to eq 'username'
expect(h[:display_name]).to eq 'display name'
expect(h[:email]).to eq 'local-part@domain'
expect(h[:ip]).to eq '0.0.0.42'
new.call({})
end
account_filter = instance_double(AccountFilter, results: Account.all)
allow(AccountFilter).to receive(:new).and_return(account_filter)
get :index, params: {
origin: 'local',
@ -43,6 +30,18 @@ RSpec.describe Admin::AccountsController do
email: 'local-part@domain',
ip: '0.0.0.42',
}
expect(AccountFilter).to have_received(:new) do |params|
h = params.to_h
expect(h[:origin]).to eq 'local'
expect(h[:by_domain]).to eq 'domain'
expect(h[:status]).to eq 'active'
expect(h[:username]).to eq 'username'
expect(h[:display_name]).to eq 'display name'
expect(h[:email]).to eq 'local-part@domain'
expect(h[:ip]).to eq '0.0.0.42'
end
end
it 'paginates accounts' do

View file

@ -19,10 +19,6 @@ RSpec.describe Admin::Settings::BrandingController do
end
describe 'PUT #update' do
before do
allow_any_instance_of(Form::AdminSettings).to receive(:valid?).and_return(true)
end
around do |example|
before = Setting.site_short_description
Setting.site_short_description = nil

View file

@ -3,14 +3,14 @@
require 'rails_helper'
describe Api::V1::StreamingController do
around(:each) do |example|
around do |example|
before = Rails.configuration.x.streaming_api_base_url
Rails.configuration.x.streaming_api_base_url = Rails.configuration.x.web_domain
example.run
Rails.configuration.x.streaming_api_base_url = before
end
before(:each) do
before do
request.headers.merge! Host: Rails.configuration.x.web_domain
end
@ -24,7 +24,7 @@ describe Api::V1::StreamingController do
end
context 'with streaming api on different host' do
before(:each) do
before do
Rails.configuration.x.streaming_api_base_url = "wss://streaming-#{Rails.configuration.x.web_domain}"
@streaming_host = URI.parse(Rails.configuration.x.streaming_api_base_url).host
end

View file

@ -53,7 +53,7 @@ RSpec.describe Api::V2::SearchController do
context 'without token' do
describe 'GET #index' do
let(:search_params) {}
let(:search_params) { nil }
before do
get :index, params: search_params

View file

@ -8,13 +8,11 @@ describe EmojisController do
let(:emoji) { Fabricate(:custom_emoji) }
describe 'GET #show' do
subject(:body) { JSON.parse(response.body, symbolize_names: true) }
let(:response) { get :show, params: { id: emoji.id, format: :json } }
it 'returns the right response' do
expect(response).to have_http_status 200
expect(body[:name]).to eq ':coolcat:'
expect(body_as_json[:name]).to eq ':coolcat:'
end
end
end

View file

@ -16,7 +16,7 @@ describe WellKnown::WebfingerController do
let(:alice) { Fabricate(:account, username: 'alice') }
let(:resource) { nil }
around(:each) do |example|
around do |example|
tmp = Rails.configuration.x.alternate_domains
Rails.configuration.x.alternate_domains = alternate_domains
example.run