Merge remote-tracking branch 'parent/main' into upstream-20241119

This commit is contained in:
KMY 2024-11-19 08:49:55 +09:00
commit 055045981f
221 changed files with 2006 additions and 1127 deletions

View file

@ -0,0 +1,19 @@
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe DomainResource do
describe '#mx' do
subject { described_class.new(domain) }
let(:domain) { 'example.host' }
let(:exchange) { 'mx.host' }
before { configure_mx(domain: domain, exchange: exchange) }
it 'returns array of hostnames' do
expect(subject.mx)
.to eq([exchange])
end
end
end

View file

@ -63,6 +63,22 @@ RSpec.describe Mastodon::CLI::EmailDomainBlocks do
.and(change(EmailDomainBlock, :count).by(1))
end
end
context 'with --with-dns-records true' do
let(:domain) { 'host.example' }
let(:arguments) { [domain] }
let(:options) { { with_dns_records: true } }
before do
configure_mx(domain: domain, exchange: 'other.host')
end
it 'adds a new block for parent and children' do
expect { subject }
.to output_results('Added 2')
.and(change(EmailDomainBlock, :count).by(2))
end
end
end
describe '#remove' do

View file

@ -16,6 +16,7 @@ RSpec.describe SearchQueryTransformer do
['"2022-01-01"', '2022-01-01'],
['12345678', '12345678'],
['"12345678"', '12345678'],
['"2024-10-31T23:47:20Z"', '2024-10-31T23:47:20Z'],
].each do |value, parsed|
context "with #{operator}:#{value}" do
let(:query) { "#{operator}:#{value}" }
@ -34,7 +35,7 @@ RSpec.describe SearchQueryTransformer do
let(:query) { "#{operator}:\"abc\"" }
it 'raises an exception' do
expect { subject }.to raise_error(Mastodon::FilterValidationError, 'Invalid date abc')
expect { subject }.to raise_error(Date::Error)
end
end
end