Merge upstream 2.0ish #165

This commit is contained in:
kibigo!
2017-10-11 10:43:10 -07:00
322 changed files with 8478 additions and 2587 deletions

View File

@@ -0,0 +1,5 @@
require 'rails_helper'
RSpec.describe AccountModerationNote, type: :model do
pending "add some examples to (or delete) #{__FILE__}"
end

View File

@@ -0,0 +1,21 @@
require 'rails_helper'
RSpec.describe EmailDomainBlock, type: :model do
describe 'validations' do
it 'has a valid fabricator' do
email_domain_block = Fabricate.build(:email_domain_block)
expect(email_domain_block).to be_valid
end
end
describe 'block?' do
it 'returns true if the domain is registed' do
Fabricate(:email_domain_block, domain: 'example.com')
expect(EmailDomainBlock.block?('nyarn@example.com')).to eq true
end
it 'returns true if the domain is not registed' do
Fabricate(:email_domain_block, domain: 'domain')
expect(EmailDomainBlock.block?('example')).to eq false
end
end
end

View File

@@ -9,7 +9,7 @@ RSpec.describe Feed, type: :model do
Fabricate(:status, account: account, id: 3)
Fabricate(:status, account: account, id: 10)
Redis.current.zadd(FeedManager.instance.key(:home, account.id),
[[4, 'deleted'], [3, 'val3'], [2, 'val2'], [1, 'val1']])
[[4, 4], [3, 3], [2, 2], [1, 1]])
feed = Feed.new(:home, account)
results = feed.get(3)

View File

@@ -17,7 +17,6 @@ RSpec.describe MediaAttachment, type: :model do
expect(media.file.meta["original"]["height"]).to eq 128
expect(media.file.meta["original"]["aspect"]).to eq 1.0
end
end
describe 'non-animated gif non-conversion' do
@@ -50,4 +49,12 @@ RSpec.describe MediaAttachment, type: :model do
expect(media.file.meta["small"]["aspect"]).to eq 400.0/267
end
end
describe 'descriptions for remote attachments' do
it 'are cut off at 140 characters' do
media = Fabricate(:media_attachment, description: 'foo' * 1000, remote_url: 'http://example.com/blah.jpg')
expect(media.description.size).to be <= 420
end
end
end