Merge branch 'master' into glitch-soc/merge-upstream

Conflicts:
	db/migrate/20170716191202_add_hide_notifications_to_mute.rb
	spec/controllers/application_controller_spec.rb

Took our version, upstream changes were only minor style linting.
This commit is contained in:
Thibaut Girka
2018-10-05 15:23:57 +02:00
93 changed files with 406 additions and 324 deletions

View File

@ -2,10 +2,10 @@ require 'rails_helper'
describe AccountFilter do
describe 'with empty params' do
it 'defaults to alphabetic account list' do
it 'defaults to recent account list' do
filter = described_class.new({})
expect(filter.results).to eq Account.alphabetic
expect(filter.results).to eq Account.recent
end
end
@ -60,7 +60,7 @@ describe AccountFilter do
end
describe 'that call account methods' do
%i(local remote silenced recent suspended).each do |option|
%i(local remote silenced alphabetic suspended).each do |option|
it "delegates the #{option} option" do
allow(Account).to receive(option).and_return(Account.none)
filter = described_class.new({ option => true })

View File

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

View File

@ -275,7 +275,7 @@ RSpec.describe Account, type: :model do
subject { Fabricate(:account) }
context 'when the status is a reblog of another status'do
context 'when the status is a reblog of another status' do
let(:original_reblog) do
author = Fabricate(:account, username: 'original_reblogger')
Fabricate(:status, reblog: original_status, account: author)

View File

@ -1,5 +1,4 @@
require 'rails_helper'
RSpec.describe Admin::ActionLog, type: :model do
end

View File

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

View File

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

View File

@ -4,7 +4,7 @@ RSpec.describe CustomEmoji, type: :model do
describe '#search' do
let(:custom_emoji) { Fabricate(:custom_emoji, shortcode: shortcode) }
subject { described_class.search(search_term) }
subject { described_class.search(search_term) }
context 'shortcode is exact' do
let(:shortcode) { 'blobpats' }

View File

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

View File

@ -23,6 +23,20 @@ RSpec.describe Follow, type: :model do
follow.valid?
expect(follow).to model_have_error_on_field(:target_account)
end
it 'is invalid if account already follows too many people' do
alice.update(following_count: FollowLimitValidator::LIMIT)
expect(subject).to_not be_valid
expect(subject).to model_have_error_on_field(:base)
end
it 'is valid if account is only on the brink of following too many people' do
alice.update(following_count: FollowLimitValidator::LIMIT - 1)
expect(subject).to be_valid
expect(subject).to_not model_have_error_on_field(:base)
end
end
describe 'recent' do

View File

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

View File

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

View File

@ -131,7 +131,7 @@ RSpec.describe MediaAttachment, type: :model do
expect(media.file.meta["original"]["aspect"]).to eq 1.5
expect(media.file.meta["small"]["width"]).to eq 490
expect(media.file.meta["small"]["height"]).to eq 327
expect(media.file.meta["small"]["aspect"]).to eq 490.0/327
expect(media.file.meta["small"]["aspect"]).to eq 490.0 / 327
end
end

View File

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

View File

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

View File

@ -34,7 +34,7 @@ RSpec.describe RemoteFollow do
subject { remote_follow.valid? }
context 'attrs with acct' do
let(:attrs) { { acct: 'gargron@quitter.no' }}
let(:attrs) { { acct: 'gargron@quitter.no' } }
it do
is_expected.to be true
@ -42,7 +42,7 @@ RSpec.describe RemoteFollow do
end
context 'attrs without acct' do
let(:attrs) { { } }
let(:attrs) { {} }
it do
is_expected.to be false

View File

@ -254,7 +254,7 @@ RSpec.describe User, type: :model do
it_behaves_like 'Settings-extended' do
def create!
User.create!(account: Fabricate(:account), email: 'foo@mastodon.space', password: 'abcd1234' )
User.create!(account: Fabricate(:account), email: 'foo@mastodon.space', password: 'abcd1234')
end
def fabricate

View File

@ -1,5 +1,4 @@
require 'rails_helper'
RSpec.describe Web::Setting, type: :model do
end