Merge tag 'v1.6.0rc4' into sync/upstream-1.6.0rc4

Conflicts:
      app/javascript/mastodon/features/getting_started/index.js
      app/javascript/packs/public.js
      app/javascript/styles/components.scss
This commit is contained in:
David Yip
2017-09-09 23:56:21 -05:00
67 changed files with 698 additions and 363 deletions

View File

@@ -4,10 +4,10 @@ require 'rails_helper'
describe SettingsHelper do
describe 'the HUMAN_LOCALES constant' do
it 'has the same number of keys as I18n locales exist' do
it 'includes all I18n locales' do
options = I18n.available_locales
expect(described_class::HUMAN_LOCALES.keys).to eq(options)
expect(described_class::HUMAN_LOCALES.keys).to include(*options)
end
end

View File

@@ -2,12 +2,16 @@ require 'rails_helper'
RSpec.describe ActivityPub::Activity::Update do
let!(:sender) { Fabricate(:account) }
before do
stub_request(:get, actor_json[:outbox]).to_return(status: 404)
stub_request(:get, actor_json[:followers]).to_return(status: 404)
stub_request(:get, actor_json[:following]).to_return(status: 404)
sender.update!(uri: ActivityPub::TagManager.instance.uri_for(sender))
end
let(:modified_sender) do
let(:modified_sender) do
sender.dup.tap do |modified_sender|
modified_sender.display_name = 'Totally modified now'
end

View File

@@ -91,9 +91,35 @@ RSpec.describe ActivityPub::TagManager do
end
describe '#uri_to_resource' do
it 'returns the local resource' do
it 'returns the local account' do
account = Fabricate(:account)
expect(subject.uri_to_resource(subject.uri_for(account), Account)).to eq account
end
it 'returns the remote account by matching URI without fragment part' do
account = Fabricate(:account, uri: 'https://example.com/123')
expect(subject.uri_to_resource('https://example.com/123#456', Account)).to eq account
end
it 'returns the local status for ActivityPub URI' do
status = Fabricate(:status)
expect(subject.uri_to_resource(subject.uri_for(status), Status)).to eq status
end
it 'returns the local status for OStatus tag: URI' do
status = Fabricate(:status)
expect(subject.uri_to_resource(::TagManager.instance.uri_for(status), Status)).to eq status
end
it 'returns the local status for OStatus StreamEntry URL' do
status = Fabricate(:status)
stream_entry_url = account_stream_entry_url(status.account, status.stream_entry)
expect(subject.uri_to_resource(stream_entry_url, Status)).to eq status
end
it 'returns the remote status by matching URI without fragment part' do
status = Fabricate(:status, uri: 'https://example.com/123')
expect(subject.uri_to_resource('https://example.com/123#456', Status)).to eq status
end
end
end

View File

@@ -21,4 +21,18 @@ describe Report do
expect(report.media_attachments).to eq [media_attachment]
end
end
describe 'validatiions' do
it 'has a valid fabricator' do
report = Fabricate(:report)
report.valid?
expect(report).to be_valid
end
it 'is invalid if comment is longer than 1000 characters' do
report = Fabricate.build(:report, comment: Faker::Lorem.characters(1001))
report.valid?
expect(report).to model_have_error_on_field(:comment)
end
end
end

View File

@@ -41,7 +41,7 @@ RSpec.describe ActivityPub::FetchRemoteAccountService do
before do
actor[:inbox] = nil
stub_request(:get, 'https://example.com/alice').to_return(body: Oj.dump(actor))
stub_request(:get, 'https://example.com/.well-known/webfinger?resource=acct:alice@example.com').to_return(body: Oj.dump(webfinger), headers: { 'Content-Type': 'application/jrd+json' })
end

View File

@@ -26,7 +26,7 @@ RSpec.describe UnsubscribeService do
stub_request(:post, 'http://hub.example.com/').to_raise(HTTP::Error)
subject.call(account)
expect(logger).to have_received(:debug).with(/PuSH subscription request for bob@example.com could not be made due to HTTP or SSL error/)
expect(logger).to have_received(:debug).with(/unsubscribe for bob@example.com failed/)
end
def stub_logger