Merge commit '4aea3f88a6d30f102a79c2da7fcfac96465ba1a8' into merging-upstream

This commit is contained in:
Ondřej Hruška
2017-09-28 09:12:17 +02:00
282 changed files with 4626 additions and 1622 deletions

View File

@@ -0,0 +1,25 @@
require 'rails_helper'
RSpec.describe CustomEmoji, type: :model do
describe '.from_text' do
let!(:emojo) { Fabricate(:custom_emoji) }
subject { described_class.from_text(text, nil) }
context 'with plain text' do
let(:text) { 'Hello :coolcat:' }
it 'returns records used via shortcodes in text' do
is_expected.to include(emojo)
end
end
context 'with html' do
let(:text) { '<p>Hello :coolcat:</p>' }
it 'returns records used via shortcodes in text' do
is_expected.to include(emojo)
end
end
end
end

View File

@@ -0,0 +1,5 @@
require 'rails_helper'
RSpec.describe SiteUpload, type: :model do
end

View File

@@ -173,19 +173,6 @@ RSpec.describe Status, type: :model do
end
end
describe '.local_only' do
it 'returns only statuses from local accounts' do
local_account = Fabricate(:account, domain: nil)
remote_account = Fabricate(:account, domain: 'test.com')
local_status = Fabricate(:status, account: local_account)
remote_status = Fabricate(:status, account: remote_account)
results = described_class.local_only
expect(results).to include(local_status)
expect(results).not_to include(remote_status)
end
end
describe '.as_home_timeline' do
let(:account) { Fabricate(:account) }
let(:followed) { Fabricate(:account) }
@@ -529,6 +516,14 @@ RSpec.describe Status, type: :model do
end
end
describe 'validation' do
it 'disallow empty uri for remote status' do
alice.update(domain: 'example.com')
status = Fabricate.build(:status, uri: '', account: alice)
expect(status).to model_have_error_on_field(:uri)
end
end
describe 'after_create' do
it 'saves ActivityPub uri as uri for local status' do
status = Status.create(account: alice, text: 'foo')