Merge commit '391c089d0db58d731765dba730a5e1f2fe8570a6' into glitch-soc/merge-upstream
Conflicts: - `.github/dependabot.yml`: We removed it from glitch-soc. Keep it deleted.
This commit is contained in:
@@ -19,7 +19,7 @@ RSpec.describe Admin::AccountModerationNotesController do
|
||||
let(:params) { { account_moderation_note: { target_account_id: target_account.id, content: 'test content' } } }
|
||||
|
||||
it 'successfully creates a note' do
|
||||
expect { subject }.to change { AccountModerationNote.count }.by(1)
|
||||
expect { subject }.to change(AccountModerationNote, :count).by(1)
|
||||
expect(subject).to redirect_to admin_account_path(target_account.id)
|
||||
end
|
||||
end
|
||||
@@ -28,7 +28,7 @@ RSpec.describe Admin::AccountModerationNotesController do
|
||||
let(:params) { { account_moderation_note: { target_account_id: target_account.id, content: '' } } }
|
||||
|
||||
it 'falls to create a note' do
|
||||
expect { subject }.to_not change { AccountModerationNote.count }
|
||||
expect { subject }.to_not change(AccountModerationNote, :count)
|
||||
expect(subject).to render_template 'admin/accounts/show'
|
||||
end
|
||||
end
|
||||
@@ -41,7 +41,7 @@ RSpec.describe Admin::AccountModerationNotesController do
|
||||
let(:account) { Fabricate(:account) }
|
||||
|
||||
it 'destroys note' do
|
||||
expect { subject }.to change { AccountModerationNote.count }.by(-1)
|
||||
expect { subject }.to change(AccountModerationNote, :count).by(-1)
|
||||
expect(subject).to redirect_to admin_account_path(target_account.id)
|
||||
end
|
||||
end
|
||||
|
@@ -42,7 +42,7 @@ describe Admin::CustomEmojisController do
|
||||
let(:params) { { shortcode: 'test', image: image } }
|
||||
|
||||
it 'creates custom emoji' do
|
||||
expect { subject }.to change { CustomEmoji.count }.by(1)
|
||||
expect { subject }.to change(CustomEmoji, :count).by(1)
|
||||
end
|
||||
end
|
||||
|
||||
|
@@ -26,7 +26,7 @@ describe Admin::InvitesController do
|
||||
subject { post :create, params: { invite: { max_uses: '10', expires_in: 1800 } } }
|
||||
|
||||
it 'succeeds to create a invite' do
|
||||
expect { subject }.to change { Invite.count }.by(1)
|
||||
expect { subject }.to change(Invite, :count).by(1)
|
||||
expect(subject).to redirect_to admin_invites_path
|
||||
expect(Invite.last).to have_attributes(user_id: user.id, max_uses: 10)
|
||||
end
|
||||
|
@@ -25,7 +25,7 @@ describe Admin::ReportNotesController do
|
||||
let(:params) { { report_note: { content: 'test content', report_id: report.id }, create_and_resolve: nil } }
|
||||
|
||||
it 'creates a report note and resolves report' do
|
||||
expect { subject }.to change { ReportNote.count }.by(1)
|
||||
expect { subject }.to change(ReportNote, :count).by(1)
|
||||
expect(report.reload).to be_action_taken
|
||||
expect(subject).to redirect_to admin_reports_path
|
||||
end
|
||||
@@ -35,7 +35,7 @@ describe Admin::ReportNotesController do
|
||||
let(:params) { { report_note: { content: 'test content', report_id: report.id } } }
|
||||
|
||||
it 'creates a report note and does not resolve report' do
|
||||
expect { subject }.to change { ReportNote.count }.by(1)
|
||||
expect { subject }.to change(ReportNote, :count).by(1)
|
||||
expect(report.reload).to_not be_action_taken
|
||||
expect(subject).to redirect_to admin_report_path(report)
|
||||
end
|
||||
@@ -50,7 +50,7 @@ describe Admin::ReportNotesController do
|
||||
let(:params) { { report_note: { content: 'test content', report_id: report.id }, create_and_unresolve: nil } }
|
||||
|
||||
it 'creates a report note and unresolves report' do
|
||||
expect { subject }.to change { ReportNote.count }.by(1)
|
||||
expect { subject }.to change(ReportNote, :count).by(1)
|
||||
expect(report.reload).to_not be_action_taken
|
||||
expect(subject).to redirect_to admin_report_path(report)
|
||||
end
|
||||
@@ -60,7 +60,7 @@ describe Admin::ReportNotesController do
|
||||
let(:params) { { report_note: { content: 'test content', report_id: report.id } } }
|
||||
|
||||
it 'creates a report note and does not unresolve report' do
|
||||
expect { subject }.to change { ReportNote.count }.by(1)
|
||||
expect { subject }.to change(ReportNote, :count).by(1)
|
||||
expect(report.reload).to be_action_taken
|
||||
expect(subject).to redirect_to admin_report_path(report)
|
||||
end
|
||||
@@ -85,7 +85,7 @@ describe Admin::ReportNotesController do
|
||||
let!(:report_note) { Fabricate(:report_note) }
|
||||
|
||||
it 'deletes note' do
|
||||
expect { subject }.to change { ReportNote.count }.by(-1)
|
||||
expect { subject }.to change(ReportNote, :count).by(-1)
|
||||
expect(subject).to redirect_to admin_report_path(report_note.report)
|
||||
end
|
||||
end
|
||||
|
@@ -22,7 +22,7 @@ RSpec.describe AccountableConcern do
|
||||
it 'creates Admin::ActionLog' do
|
||||
expect do
|
||||
hoge.log_action(:create, target)
|
||||
end.to change { Admin::ActionLog.count }.by(1)
|
||||
end.to change(Admin::ActionLog, :count).by(1)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@@ -52,7 +52,7 @@ describe InvitesController do
|
||||
end
|
||||
|
||||
it 'succeeds to create a invite' do
|
||||
expect { subject }.to change { Invite.count }.by(1)
|
||||
expect { subject }.to change(Invite, :count).by(1)
|
||||
expect(subject).to redirect_to invites_path
|
||||
expect(Invite.last).to have_attributes(user_id: user.id, max_uses: 10)
|
||||
end
|
||||
|
@@ -134,7 +134,7 @@ describe Settings::TwoFactorAuthentication::WebauthnCredentialsController do
|
||||
end
|
||||
|
||||
it 'does not change webauthn_id' do
|
||||
expect { get :options }.to_not change { user.webauthn_id }
|
||||
expect { get :options }.to_not change(user, :webauthn_id)
|
||||
end
|
||||
|
||||
it 'includes existing credentials in list of excluded credentials' do
|
||||
@@ -238,7 +238,7 @@ describe Settings::TwoFactorAuthentication::WebauthnCredentialsController do
|
||||
|
||||
expect do
|
||||
post :create, params: { credential: new_webauthn_credential, nickname: nickname }
|
||||
end.to_not change { user.webauthn_id }
|
||||
end.to_not change(user, :webauthn_id)
|
||||
end
|
||||
end
|
||||
|
||||
|
12
spec/lib/mastodon/cli/accounts_spec.rb
Normal file
12
spec/lib/mastodon/cli/accounts_spec.rb
Normal file
@@ -0,0 +1,12 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
require 'mastodon/cli/accounts'
|
||||
|
||||
describe Mastodon::CLI::Accounts do
|
||||
describe '.exit_on_failure?' do
|
||||
it 'returns true' do
|
||||
expect(described_class.exit_on_failure?).to be true
|
||||
end
|
||||
end
|
||||
end
|
12
spec/lib/mastodon/cli/cache_spec.rb
Normal file
12
spec/lib/mastodon/cli/cache_spec.rb
Normal file
@@ -0,0 +1,12 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
require 'mastodon/cli/cache'
|
||||
|
||||
describe Mastodon::CLI::Cache do
|
||||
describe '.exit_on_failure?' do
|
||||
it 'returns true' do
|
||||
expect(described_class.exit_on_failure?).to be true
|
||||
end
|
||||
end
|
||||
end
|
12
spec/lib/mastodon/cli/canonical_email_blocks_spec.rb
Normal file
12
spec/lib/mastodon/cli/canonical_email_blocks_spec.rb
Normal file
@@ -0,0 +1,12 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
require 'mastodon/cli/canonical_email_blocks'
|
||||
|
||||
describe Mastodon::CLI::CanonicalEmailBlocks do
|
||||
describe '.exit_on_failure?' do
|
||||
it 'returns true' do
|
||||
expect(described_class.exit_on_failure?).to be true
|
||||
end
|
||||
end
|
||||
end
|
12
spec/lib/mastodon/cli/domains_spec.rb
Normal file
12
spec/lib/mastodon/cli/domains_spec.rb
Normal file
@@ -0,0 +1,12 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
require 'mastodon/cli/domains'
|
||||
|
||||
describe Mastodon::CLI::Domains do
|
||||
describe '.exit_on_failure?' do
|
||||
it 'returns true' do
|
||||
expect(described_class.exit_on_failure?).to be true
|
||||
end
|
||||
end
|
||||
end
|
12
spec/lib/mastodon/cli/email_domain_blocks_spec.rb
Normal file
12
spec/lib/mastodon/cli/email_domain_blocks_spec.rb
Normal file
@@ -0,0 +1,12 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
require 'mastodon/cli/email_domain_blocks'
|
||||
|
||||
describe Mastodon::CLI::EmailDomainBlocks do
|
||||
describe '.exit_on_failure?' do
|
||||
it 'returns true' do
|
||||
expect(described_class.exit_on_failure?).to be true
|
||||
end
|
||||
end
|
||||
end
|
12
spec/lib/mastodon/cli/emoji_spec.rb
Normal file
12
spec/lib/mastodon/cli/emoji_spec.rb
Normal file
@@ -0,0 +1,12 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
require 'mastodon/cli/emoji'
|
||||
|
||||
describe Mastodon::CLI::Emoji do
|
||||
describe '.exit_on_failure?' do
|
||||
it 'returns true' do
|
||||
expect(described_class.exit_on_failure?).to be true
|
||||
end
|
||||
end
|
||||
end
|
12
spec/lib/mastodon/cli/feeds_spec.rb
Normal file
12
spec/lib/mastodon/cli/feeds_spec.rb
Normal file
@@ -0,0 +1,12 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
require 'mastodon/cli/feeds'
|
||||
|
||||
describe Mastodon::CLI::Feeds do
|
||||
describe '.exit_on_failure?' do
|
||||
it 'returns true' do
|
||||
expect(described_class.exit_on_failure?).to be true
|
||||
end
|
||||
end
|
||||
end
|
@@ -3,9 +3,15 @@
|
||||
require 'rails_helper'
|
||||
require 'mastodon/cli/ip_blocks'
|
||||
|
||||
RSpec.describe Mastodon::CLI::IpBlocks do
|
||||
describe Mastodon::CLI::IpBlocks do
|
||||
let(:cli) { described_class.new }
|
||||
|
||||
describe '.exit_on_failure?' do
|
||||
it 'returns true' do
|
||||
expect(described_class.exit_on_failure?).to be true
|
||||
end
|
||||
end
|
||||
|
||||
describe '#add' do
|
||||
let(:ip_list) do
|
||||
[
|
||||
|
@@ -4,6 +4,12 @@ require 'rails_helper'
|
||||
require 'mastodon/cli/main'
|
||||
|
||||
describe Mastodon::CLI::Main do
|
||||
describe '.exit_on_failure?' do
|
||||
it 'returns true' do
|
||||
expect(described_class.exit_on_failure?).to be true
|
||||
end
|
||||
end
|
||||
|
||||
describe 'version' do
|
||||
it 'returns the Mastodon version' do
|
||||
expect { described_class.new.invoke(:version) }.to output(
|
||||
|
12
spec/lib/mastodon/cli/maintenance_spec.rb
Normal file
12
spec/lib/mastodon/cli/maintenance_spec.rb
Normal file
@@ -0,0 +1,12 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
require 'mastodon/cli/maintenance'
|
||||
|
||||
describe Mastodon::CLI::Maintenance do
|
||||
describe '.exit_on_failure?' do
|
||||
it 'returns true' do
|
||||
expect(described_class.exit_on_failure?).to be true
|
||||
end
|
||||
end
|
||||
end
|
12
spec/lib/mastodon/cli/media_spec.rb
Normal file
12
spec/lib/mastodon/cli/media_spec.rb
Normal file
@@ -0,0 +1,12 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
require 'mastodon/cli/media'
|
||||
|
||||
describe Mastodon::CLI::Media do
|
||||
describe '.exit_on_failure?' do
|
||||
it 'returns true' do
|
||||
expect(described_class.exit_on_failure?).to be true
|
||||
end
|
||||
end
|
||||
end
|
12
spec/lib/mastodon/cli/preview_cards_spec.rb
Normal file
12
spec/lib/mastodon/cli/preview_cards_spec.rb
Normal file
@@ -0,0 +1,12 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
require 'mastodon/cli/preview_cards'
|
||||
|
||||
describe Mastodon::CLI::PreviewCards do
|
||||
describe '.exit_on_failure?' do
|
||||
it 'returns true' do
|
||||
expect(described_class.exit_on_failure?).to be true
|
||||
end
|
||||
end
|
||||
end
|
12
spec/lib/mastodon/cli/search_spec.rb
Normal file
12
spec/lib/mastodon/cli/search_spec.rb
Normal file
@@ -0,0 +1,12 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
require 'mastodon/cli/search'
|
||||
|
||||
describe Mastodon::CLI::Search do
|
||||
describe '.exit_on_failure?' do
|
||||
it 'returns true' do
|
||||
expect(described_class.exit_on_failure?).to be true
|
||||
end
|
||||
end
|
||||
end
|
@@ -3,7 +3,13 @@
|
||||
require 'rails_helper'
|
||||
require 'mastodon/cli/settings'
|
||||
|
||||
RSpec.describe Mastodon::CLI::Settings do
|
||||
describe Mastodon::CLI::Settings do
|
||||
describe '.exit_on_failure?' do
|
||||
it 'returns true' do
|
||||
expect(described_class.exit_on_failure?).to be true
|
||||
end
|
||||
end
|
||||
|
||||
describe 'subcommand "registrations"' do
|
||||
let(:cli) { Mastodon::CLI::Registrations.new }
|
||||
|
||||
|
12
spec/lib/mastodon/cli/statuses_spec.rb
Normal file
12
spec/lib/mastodon/cli/statuses_spec.rb
Normal file
@@ -0,0 +1,12 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
require 'mastodon/cli/statuses'
|
||||
|
||||
describe Mastodon::CLI::Statuses do
|
||||
describe '.exit_on_failure?' do
|
||||
it 'returns true' do
|
||||
expect(described_class.exit_on_failure?).to be true
|
||||
end
|
||||
end
|
||||
end
|
12
spec/lib/mastodon/cli/upgrade_spec.rb
Normal file
12
spec/lib/mastodon/cli/upgrade_spec.rb
Normal file
@@ -0,0 +1,12 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
require 'mastodon/cli/upgrade'
|
||||
|
||||
describe Mastodon::CLI::Upgrade do
|
||||
describe '.exit_on_failure?' do
|
||||
it 'returns true' do
|
||||
expect(described_class.exit_on_failure?).to be true
|
||||
end
|
||||
end
|
||||
end
|
@@ -58,7 +58,7 @@ RSpec.describe Admin::AccountAction do
|
||||
it 'creates Admin::ActionLog' do
|
||||
expect do
|
||||
subject
|
||||
end.to change { Admin::ActionLog.count }.by 1
|
||||
end.to change(Admin::ActionLog, :count).by 1
|
||||
end
|
||||
|
||||
it 'calls process_email!' do
|
||||
|
@@ -26,7 +26,7 @@ RSpec.describe SuspendAccountService, type: :service do
|
||||
end
|
||||
|
||||
it 'does not change the “suspended” flag' do
|
||||
expect { subject }.to_not change { account.suspended? }
|
||||
expect { subject }.to_not change(account, :suspended?)
|
||||
end
|
||||
end
|
||||
|
||||
|
@@ -33,7 +33,7 @@ RSpec.describe UnsuspendAccountService, type: :service do
|
||||
end
|
||||
|
||||
it 'does not change the “suspended” flag' do
|
||||
expect { subject }.to_not change { account.suspended? }
|
||||
expect { subject }.to_not change(account, :suspended?)
|
||||
end
|
||||
|
||||
include_examples 'with common context' do
|
||||
@@ -86,7 +86,7 @@ RSpec.describe UnsuspendAccountService, type: :service do
|
||||
end
|
||||
|
||||
it 'does not change the “suspended” flag' do
|
||||
expect { subject }.to_not change { account.suspended? }
|
||||
expect { subject }.to_not change(account, :suspended?)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -110,7 +110,7 @@ RSpec.describe UnsuspendAccountService, type: :service do
|
||||
end
|
||||
|
||||
it 'marks account as suspended' do
|
||||
expect { subject }.to change { account.suspended? }.from(false).to(true)
|
||||
expect { subject }.to change(account, :suspended?).from(false).to(true)
|
||||
end
|
||||
end
|
||||
|
||||
|
@@ -103,7 +103,7 @@ describe Scheduler::AccountsStatusesCleanupScheduler do
|
||||
describe '#perform' do
|
||||
context 'when the budget is lower than the number of toots to delete' do
|
||||
it 'deletes as many statuses as the given budget' do
|
||||
expect { subject.perform }.to change { Status.count }.by(-subject.compute_budget)
|
||||
expect { subject.perform }.to change(Status, :count).by(-subject.compute_budget)
|
||||
end
|
||||
|
||||
it 'does not delete from accounts with no cleanup policy' do
|
||||
@@ -117,7 +117,7 @@ describe Scheduler::AccountsStatusesCleanupScheduler do
|
||||
it 'eventually deletes every deletable toot given enough runs' do
|
||||
stub_const 'Scheduler::AccountsStatusesCleanupScheduler::MAX_BUDGET', 4
|
||||
|
||||
expect { 10.times { subject.perform } }.to change { Status.count }.by(-30)
|
||||
expect { 10.times { subject.perform } }.to change(Status, :count).by(-30)
|
||||
end
|
||||
|
||||
it 'correctly round-trips between users across several runs' do
|
||||
@@ -125,7 +125,7 @@ describe Scheduler::AccountsStatusesCleanupScheduler do
|
||||
stub_const 'Scheduler::AccountsStatusesCleanupScheduler::PER_ACCOUNT_BUDGET', 2
|
||||
|
||||
expect { 3.times { subject.perform } }
|
||||
.to change { Status.count }.by(-3 * 3)
|
||||
.to change(Status, :count).by(-3 * 3)
|
||||
.and change { account1.statuses.count }
|
||||
.and change { account3.statuses.count }
|
||||
.and change { account5.statuses.count }
|
||||
@@ -140,7 +140,7 @@ describe Scheduler::AccountsStatusesCleanupScheduler do
|
||||
|
||||
it 'correctly handles looping in a single run' do
|
||||
expect(subject.compute_budget).to eq(400)
|
||||
expect { subject.perform }.to change { Status.count }.by(-30)
|
||||
expect { subject.perform }.to change(Status, :count).by(-30)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -154,7 +154,7 @@ describe Scheduler::AccountsStatusesCleanupScheduler do
|
||||
|
||||
it 'does not get stuck' do
|
||||
expect(subject.compute_budget).to eq(400)
|
||||
expect { subject.perform }.to_not change { Status.count }
|
||||
expect { subject.perform }.to_not change(Status, :count)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user