Merge tag 'v2.6.5' into instance_only_statuses
This commit is contained in:
@ -99,10 +99,12 @@ describe AuthorizeInteractionsController do
|
||||
|
||||
allow(ResolveAccountService).to receive(:new).and_return(service)
|
||||
allow(service).to receive(:call).with('user@hostname').and_return(target_account)
|
||||
allow(service).to receive(:call).with(target_account, skip_webfinger: true).and_return(target_account)
|
||||
|
||||
|
||||
post :create, params: { acct: 'acct:user@hostname' }
|
||||
|
||||
expect(service).to have_received(:call).with('user@hostname')
|
||||
expect(service).to have_received(:call).with(target_account, skip_webfinger: true)
|
||||
expect(account.following?(target_account)).to be true
|
||||
expect(response).to render_template(:success)
|
||||
end
|
||||
|
@ -514,7 +514,7 @@ RSpec.describe Formatter do
|
||||
subject { Formatter.instance.sanitize(html, Sanitize::Config::MASTODON_STRICT) }
|
||||
|
||||
it 'sanitizes' do
|
||||
is_expected.to eq 'alert("Hello")'
|
||||
is_expected.to eq ''
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -48,9 +48,11 @@ describe Request do
|
||||
end
|
||||
|
||||
it 'executes a HTTP request when the first address is private' do
|
||||
allow(Addrinfo).to receive(:foreach).with('example.com', nil, nil, :SOCK_STREAM)
|
||||
.and_yield(Addrinfo.new(["AF_INET", 0, "example.com", "0.0.0.0"], :PF_INET, :SOCK_STREAM))
|
||||
.and_yield(Addrinfo.new(["AF_INET6", 0, "example.com", "2001:4860:4860::8844"], :PF_INET6, :SOCK_STREAM))
|
||||
resolver = double
|
||||
|
||||
allow(resolver).to receive(:getaddresses).with('example.com').and_return(%w(0.0.0.0 2001:4860:4860::8844))
|
||||
allow(resolver).to receive(:timeouts=).and_return(nil)
|
||||
allow(Resolv::DNS).to receive(:open).and_yield(resolver)
|
||||
|
||||
expect { |block| subject.perform &block }.to yield_control
|
||||
expect(a_request(:get, 'http://example.com')).to have_been_made.once
|
||||
@ -81,9 +83,12 @@ describe Request do
|
||||
end
|
||||
|
||||
it 'raises Mastodon::ValidationError' do
|
||||
allow(Addrinfo).to receive(:foreach).with('example.com', nil, nil, :SOCK_STREAM)
|
||||
.and_yield(Addrinfo.new(["AF_INET", 0, "example.com", "0.0.0.0"], :PF_INET, :SOCK_STREAM))
|
||||
.and_yield(Addrinfo.new(["AF_INET6", 0, "example.com", "2001:db8::face"], :PF_INET6, :SOCK_STREAM))
|
||||
resolver = double
|
||||
|
||||
allow(resolver).to receive(:getaddresses).with('example.com').and_return(%w(0.0.0.0 2001:db8::face))
|
||||
allow(resolver).to receive(:timeouts=).and_return(nil)
|
||||
allow(Resolv::DNS).to receive(:open).and_yield(resolver)
|
||||
|
||||
expect { subject.perform }.to raise_error Mastodon::ValidationError
|
||||
end
|
||||
end
|
||||
|
@ -618,9 +618,15 @@ RSpec.describe Account, type: :model do
|
||||
expect(account).not_to model_have_error_on_field(:username)
|
||||
end
|
||||
|
||||
it 'is invalid if the username doesn\'t only contains letters, numbers and underscores' do
|
||||
it 'is valid even if the username contains hyphens' do
|
||||
account = Fabricate.build(:account, domain: 'domain', username: 'the-doctor')
|
||||
account.valid?
|
||||
expect(account).to_not model_have_error_on_field(:username)
|
||||
end
|
||||
|
||||
it 'is invalid if the username doesn\'t only contains letters, numbers, underscores and hyphens' do
|
||||
account = Fabricate.build(:account, domain: 'domain', username: 'the doctor')
|
||||
account.valid?
|
||||
expect(account).to model_have_error_on_field(:username)
|
||||
end
|
||||
|
||||
|
@ -101,7 +101,7 @@ RSpec.describe Notification, type: :model do
|
||||
before do
|
||||
allow(accounts_with_ids).to receive(:[]).with(stale_account1.id).and_return(account1)
|
||||
allow(accounts_with_ids).to receive(:[]).with(stale_account2.id).and_return(account2)
|
||||
allow(Account).to receive_message_chain(:where, :map, :to_h).and_return(accounts_with_ids)
|
||||
allow(Account).to receive_message_chain(:where, :each_with_object).and_return(accounts_with_ids)
|
||||
end
|
||||
|
||||
let(:cached_items) do
|
||||
|
@ -60,8 +60,15 @@ RSpec.describe FetchAtomService, type: :service do
|
||||
it { is_expected.to eq [url, { :prefetched_body => "" }, :ostatus] }
|
||||
end
|
||||
|
||||
context 'content_type is json' do
|
||||
let(:content_type) { 'application/activity+json' }
|
||||
context 'content_type is activity+json' do
|
||||
let(:content_type) { 'application/activity+json; charset=utf-8' }
|
||||
let(:body) { json }
|
||||
|
||||
it { is_expected.to eq [1, { prefetched_body: body, id: true }, :activitypub] }
|
||||
end
|
||||
|
||||
context 'content_type is ld+json with profile' do
|
||||
let(:content_type) { 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"' }
|
||||
let(:body) { json }
|
||||
|
||||
it { is_expected.to eq [1, { prefetched_body: body, id: true }, :activitypub] }
|
||||
|
@ -104,9 +104,9 @@ RSpec.describe NotifyService, type: :service do
|
||||
is_expected.to change(Notification, :count)
|
||||
end
|
||||
|
||||
it 'hides reblogs when disabled' do
|
||||
recipient.follow!(sender, reblogs: false)
|
||||
is_expected.to_not change(Notification, :count)
|
||||
it 'shows reblogs when disabled' do
|
||||
recipient.follow!(sender, reblogs: true)
|
||||
is_expected.to change(Notification, :count)
|
||||
end
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user