From 669f6d2c0af969268c76e389ed626bce0cc9f998 Mon Sep 17 00:00:00 2001 From: Nick Schonning Date: Fri, 17 Feb 2023 16:56:20 -0500 Subject: Run rubocop formatting except line length (#23632) --- spec/lib/activitypub/activity/create_spec.rb | 1 - 1 file changed, 1 deletion(-) (limited to 'spec/lib/activitypub/activity') diff --git a/spec/lib/activitypub/activity/create_spec.rb b/spec/lib/activitypub/activity/create_spec.rb index 1a25395fa..cd0f2df6e 100644 --- a/spec/lib/activitypub/activity/create_spec.rb +++ b/spec/lib/activitypub/activity/create_spec.rb @@ -408,7 +408,6 @@ RSpec.describe ActivityPub::Activity::Create do end end - context 'with media attachments with long description' do let(:object_json) do { -- cgit From 634368c491c8e89d93b54dd2dc170f0873beafcb Mon Sep 17 00:00:00 2001 From: Nick Schonning Date: Fri, 17 Feb 2023 21:23:49 -0500 Subject: Autofix Rubocop Lint/SymbolConversion (#23683) --- .rubocop_todo.yml | 14 ------- app/lib/translation_service/deepl.rb | 2 +- app/services/backup_service.rb | 2 +- .../auth/registrations_controller_spec.rb | 4 +- spec/controllers/auth/sessions_controller_spec.rb | 2 +- spec/lib/activitypub/activity/announce_spec.rb | 6 +-- spec/lib/activitypub/activity/create_spec.rb | 6 +-- .../activitypub/process_collection_service_spec.rb | 48 +++++++++++----------- 8 files changed, 35 insertions(+), 49 deletions(-) (limited to 'spec/lib/activitypub/activity') diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index ddfe5c36b..b9971a610 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -298,20 +298,6 @@ Lint/ParenthesesAsGroupedExpression: - 'spec/lib/activitypub/activity/flag_spec.rb' - 'spec/models/import_spec.rb' -# Offense count: 35 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle. -# SupportedStyles: strict, consistent -Lint/SymbolConversion: - Exclude: - - 'app/lib/translation_service/deepl.rb' - - 'app/services/backup_service.rb' - - 'spec/controllers/auth/registrations_controller_spec.rb' - - 'spec/controllers/auth/sessions_controller_spec.rb' - - 'spec/lib/activitypub/activity/announce_spec.rb' - - 'spec/lib/activitypub/activity/create_spec.rb' - - 'spec/services/activitypub/process_collection_service_spec.rb' - # Offense count: 3 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: IgnoreEmptyBlocks, AllowUnusedKeywordArguments. diff --git a/app/lib/translation_service/deepl.rb b/app/lib/translation_service/deepl.rb index 537fd24c0..151d33d90 100644 --- a/app/lib/translation_service/deepl.rb +++ b/app/lib/translation_service/deepl.rb @@ -29,7 +29,7 @@ class TranslationService::DeepL < TranslationService def request(text, source_language, target_language) req = Request.new(:post, endpoint_url, form: { text: text, source_lang: source_language&.upcase, target_lang: target_language, tag_handling: 'html' }) - req.add_headers('Authorization': "DeepL-Auth-Key #{@api_key}") + req.add_headers(Authorization: "DeepL-Auth-Key #{@api_key}") req end diff --git a/app/services/backup_service.rb b/app/services/backup_service.rb index 037f519d3..b880dfbe7 100644 --- a/app/services/backup_service.rb +++ b/app/services/backup_service.rb @@ -23,7 +23,7 @@ class BackupService < BaseService account.statuses.with_includes.reorder(nil).find_in_batches do |statuses| statuses.each do |status| item = serialize_payload(ActivityPub::ActivityPresenter.from_status(status), ActivityPub::ActivitySerializer, signer: @account) - item.delete(:'@context') + item.delete(:@context) unless item[:type] == 'Announce' || item[:object][:attachment].blank? item[:object][:attachment].each do |attachment| diff --git a/spec/controllers/auth/registrations_controller_spec.rb b/spec/controllers/auth/registrations_controller_spec.rb index 0ebf6641f..38c003b53 100644 --- a/spec/controllers/auth/registrations_controller_spec.rb +++ b/spec/controllers/auth/registrations_controller_spec.rb @@ -178,7 +178,7 @@ RSpec.describe Auth::RegistrationsController, type: :controller do Setting.registrations_mode = 'approved' request.headers["Accept-Language"] = accept_language invite = Fabricate(:invite, max_uses: nil, expires_at: 1.hour.ago) - post :create, params: { user: { account_attributes: { username: 'test' }, email: 'test@example.com', password: '12345678', password_confirmation: '12345678', 'invite_code': invite.code, agreement: 'true' } } + post :create, params: { user: { account_attributes: { username: 'test' }, email: 'test@example.com', password: '12345678', password_confirmation: '12345678', invite_code: invite.code, agreement: 'true' } } end it 'redirects to setup' do @@ -210,7 +210,7 @@ RSpec.describe Auth::RegistrationsController, type: :controller do Setting.require_invite_text = true request.headers["Accept-Language"] = accept_language invite = Fabricate(:invite, user: inviter, max_uses: nil, expires_at: 1.hour.from_now) - post :create, params: { user: { account_attributes: { username: 'test' }, email: 'test@example.com', password: '12345678', password_confirmation: '12345678', 'invite_code': invite.code, agreement: 'true' } } + post :create, params: { user: { account_attributes: { username: 'test' }, email: 'test@example.com', password: '12345678', password_confirmation: '12345678', invite_code: invite.code, agreement: 'true' } } end it 'redirects to setup' do diff --git a/spec/controllers/auth/sessions_controller_spec.rb b/spec/controllers/auth/sessions_controller_spec.rb index 64433ddf4..8f898ad1f 100644 --- a/spec/controllers/auth/sessions_controller_spec.rb +++ b/spec/controllers/auth/sessions_controller_spec.rb @@ -127,7 +127,7 @@ RSpec.describe Auth::SessionsController, type: :controller do before do allow_any_instance_of(ActionDispatch::Request).to receive(:remote_ip).and_return(current_ip) - allow(UserMailer).to receive(:suspicious_sign_in).and_return(double('email', 'deliver_later!': nil)) + allow(UserMailer).to receive(:suspicious_sign_in).and_return(double('email', deliver_later!: nil)) user.update(current_sign_in_at: 1.month.ago) post :create, params: { user: { email: user.email, password: user.password } } end diff --git a/spec/lib/activitypub/activity/announce_spec.rb b/spec/lib/activitypub/activity/announce_spec.rb index e9cd6c68c..1b3485384 100644 --- a/spec/lib/activitypub/activity/announce_spec.rb +++ b/spec/lib/activitypub/activity/announce_spec.rb @@ -82,9 +82,9 @@ RSpec.describe ActivityPub::Activity::Announce do content: 'Lorem ipsum', attributedTo: 'https://example.com/actor', to: { - 'type': 'OrderedCollection', - 'id': 'http://example.com/followers', - 'first': 'http://example.com/followers?page=true', + type: 'OrderedCollection', + id: 'http://example.com/followers', + first: 'http://example.com/followers?page=true', } } end diff --git a/spec/lib/activitypub/activity/create_spec.rb b/spec/lib/activitypub/activity/create_spec.rb index cd0f2df6e..074aa54ca 100644 --- a/spec/lib/activitypub/activity/create_spec.rb +++ b/spec/lib/activitypub/activity/create_spec.rb @@ -252,9 +252,9 @@ RSpec.describe ActivityPub::Activity::Create do type: 'Note', content: 'Lorem ipsum', to: { - 'type': 'OrderedCollection', - 'id': 'http://example.com/followers', - 'first': 'http://example.com/followers?page=true', + type: 'OrderedCollection', + id: 'http://example.com/followers', + first: 'http://example.com/followers?page=true', } } end diff --git a/spec/services/activitypub/process_collection_service_spec.rb b/spec/services/activitypub/process_collection_service_spec.rb index cb60e1cb8..cb7deb626 100644 --- a/spec/services/activitypub/process_collection_service_spec.rb +++ b/spec/services/activitypub/process_collection_service_spec.rb @@ -107,23 +107,23 @@ RSpec.describe ActivityPub::ProcessCollectionService, type: :service do '@context': [ 'https://www.w3.org/ns/activitystreams', nil, - { 'object': 'https://www.w3.org/ns/activitystreams#object' } + { object: 'https://www.w3.org/ns/activitystreams#object' } ], - 'id': 'https://example.com/users/bob/fake-status/activity', - 'type': 'Create', - 'actor': 'https://example.com/users/bob', - 'published': '2022-01-22T15:00:00Z', - 'to': [ + id: 'https://example.com/users/bob/fake-status/activity', + type: 'Create', + actor: 'https://example.com/users/bob', + published: '2022-01-22T15:00:00Z', + to: [ 'https://www.w3.org/ns/activitystreams#Public' ], - 'cc': [ + cc: [ 'https://example.com/users/bob/followers' ], - 'signature': { - 'type': 'RsaSignature2017', - 'creator': 'https://example.com/users/bob#main-key', - 'created': '2022-03-09T21:57:25Z', - 'signatureValue': 'WculK0LelTQ0MvGwU9TPoq5pFzFfGYRDCJqjZ232/Udj4CHqDTGOSw5UTDLShqBOyycCkbZGrQwXG+dpyDpQLSe1UVPZ5TPQtc/9XtI57WlS2nMNpdvRuxGnnb2btPdesXZ7n3pCxo0zjaXrJMe0mqQh5QJO22mahb4bDwwmfTHgbD3nmkD+fBfGi+UV2qWwqr+jlV4L4JqNkh0gWljF5KTePLRRZCuWiQ/FAt7c67636cdIPf7fR+usjuZltTQyLZKEGuK8VUn2Gkfsx5qns7Vcjvlz1JqlAjyO8HPBbzTTHzUG2nUOIgC3PojCSWv6mNTmRGoLZzOscCAYQA6cKw==' + signature: { + type: 'RsaSignature2017', + creator: 'https://example.com/users/bob#main-key', + created: '2022-03-09T21:57:25Z', + signatureValue: 'WculK0LelTQ0MvGwU9TPoq5pFzFfGYRDCJqjZ232/Udj4CHqDTGOSw5UTDLShqBOyycCkbZGrQwXG+dpyDpQLSe1UVPZ5TPQtc/9XtI57WlS2nMNpdvRuxGnnb2btPdesXZ7n3pCxo0zjaXrJMe0mqQh5QJO22mahb4bDwwmfTHgbD3nmkD+fBfGi+UV2qWwqr+jlV4L4JqNkh0gWljF5KTePLRRZCuWiQ/FAt7c67636cdIPf7fR+usjuZltTQyLZKEGuK8VUn2Gkfsx5qns7Vcjvlz1JqlAjyO8HPBbzTTHzUG2nUOIgC3PojCSWv6mNTmRGoLZzOscCAYQA6cKw==' }, '@id': 'https://example.com/users/bob/statuses/107928807471117876/activity', '@type': 'https://www.w3.org/ns/activitystreams#Create', @@ -133,22 +133,22 @@ RSpec.describe ActivityPub::ProcessCollectionService, type: :service do 'https://www.w3.org/ns/activitystreams#cc': { '@id': 'https://example.com/users/bob/followers' }, - 'object': { - 'id': 'https://example.com/users/bob/fake-status', - 'type': 'Note', - 'published': '2022-01-22T15:00:00Z', - 'url': 'https://www.youtube.com/watch?v=dQw4w9WgXcQ&feature=puck-was-here', - 'attributedTo': 'https://example.com/users/bob', - 'to': [ + object: { + id: 'https://example.com/users/bob/fake-status', + type: 'Note', + published: '2022-01-22T15:00:00Z', + url: 'https://www.youtube.com/watch?v=dQw4w9WgXcQ&feature=puck-was-here', + attributedTo: 'https://example.com/users/bob', + to: [ 'https://www.w3.org/ns/activitystreams#Public' ], - 'cc': [ + cc: [ 'https://example.com/users/bob/followers' ], - 'sensitive': false, - 'atomUri': 'https://example.com/users/bob/fake-status', - 'conversation': 'tag:example.com,2022-03-09:objectId=15:objectType=Conversation', - 'content': '

puck was here

', + sensitive: false, + atomUri: 'https://example.com/users/bob/fake-status', + conversation: 'tag:example.com,2022-03-09:objectId=15:objectType=Conversation', + content: '

puck was here

', '@id': 'https://example.com/users/bob/statuses/107928807471117876', '@type': 'https://www.w3.org/ns/activitystreams#Note', -- cgit From a7db0b41cdb2e7ab50e638ec546b2c5dd2d633c7 Mon Sep 17 00:00:00 2001 From: Nick Schonning Date: Fri, 17 Feb 2023 22:00:05 -0500 Subject: Autofix Rubocop Lint/ParenthesesAsGroupedExpression (#23682) --- .rubocop_todo.yml | 9 --------- spec/controllers/api/v1/admin/accounts_controller_spec.rb | 2 +- spec/controllers/api/v2/admin/accounts_controller_spec.rb | 2 +- spec/lib/activitypub/activity/flag_spec.rb | 2 +- spec/models/import_spec.rb | 6 +++--- 5 files changed, 6 insertions(+), 15 deletions(-) (limited to 'spec/lib/activitypub/activity') diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 91d600497..5319d6ace 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -289,15 +289,6 @@ Lint/OrAssignmentToConstant: Exclude: - 'lib/sanitize_ext/sanitize_config.rb' -# Offense count: 6 -# This cop supports safe autocorrection (--autocorrect). -Lint/ParenthesesAsGroupedExpression: - Exclude: - - 'spec/controllers/api/v1/admin/accounts_controller_spec.rb' - - 'spec/controllers/api/v2/admin/accounts_controller_spec.rb' - - 'spec/lib/activitypub/activity/flag_spec.rb' - - 'spec/models/import_spec.rb' - # Offense count: 3 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: IgnoreEmptyBlocks, AllowUnusedKeywordArguments. diff --git a/spec/controllers/api/v1/admin/accounts_controller_spec.rb b/spec/controllers/api/v1/admin/accounts_controller_spec.rb index 8d35b86cb..a4c509c60 100644 --- a/spec/controllers/api/v1/admin/accounts_controller_spec.rb +++ b/spec/controllers/api/v1/admin/accounts_controller_spec.rb @@ -65,7 +65,7 @@ RSpec.describe Api::V1::Admin::AccountsController, type: :controller do it "returns the correct accounts (#{expected_results.inspect})" do json = body_as_json - expect(json.map { |a| a[:id].to_i }).to eq (expected_results.map { |symbol| send(symbol).id }) + expect(json.map { |a| a[:id].to_i }).to eq(expected_results.map { |symbol| send(symbol).id }) end end end diff --git a/spec/controllers/api/v2/admin/accounts_controller_spec.rb b/spec/controllers/api/v2/admin/accounts_controller_spec.rb index 2508a9e05..1477049a1 100644 --- a/spec/controllers/api/v2/admin/accounts_controller_spec.rb +++ b/spec/controllers/api/v2/admin/accounts_controller_spec.rb @@ -65,7 +65,7 @@ RSpec.describe Api::V2::Admin::AccountsController, type: :controller do it "returns the correct accounts (#{expected_results.inspect})" do json = body_as_json - expect(json.map { |a| a[:id].to_i }).to eq (expected_results.map { |symbol| send(symbol).id }) + expect(json.map { |a| a[:id].to_i }).to eq(expected_results.map { |symbol| send(symbol).id }) end end end diff --git a/spec/lib/activitypub/activity/flag_spec.rb b/spec/lib/activitypub/activity/flag_spec.rb index 2f2d13876..7890fd1e8 100644 --- a/spec/lib/activitypub/activity/flag_spec.rb +++ b/spec/lib/activitypub/activity/flag_spec.rb @@ -110,7 +110,7 @@ RSpec.describe ActivityPub::Activity::Flag do describe '#perform with a defined uri' do subject { described_class.new(json, sender) } - let (:flag_id) { 'http://example.com/reports/1' } + let(:flag_id) { 'http://example.com/reports/1' } before do subject.perform diff --git a/spec/models/import_spec.rb b/spec/models/import_spec.rb index a5eec1722..4280b3237 100644 --- a/spec/models/import_spec.rb +++ b/spec/models/import_spec.rb @@ -1,9 +1,9 @@ require 'rails_helper' RSpec.describe Import, type: :model do - let (:account) { Fabricate(:account) } - let (:type) { 'following' } - let (:data) { attachment_fixture('imports.txt') } + let(:account) { Fabricate(:account) } + let(:type) { 'following' } + let(:data) { attachment_fixture('imports.txt') } describe 'validations' do it 'has a valid parameters' do -- cgit From 5069769cbe7295268e8b87ce34fa0a753bfbb233 Mon Sep 17 00:00:00 2001 From: Nick Schonning Date: Sat, 18 Feb 2023 09:33:41 -0500 Subject: Autofix Rubocop Style/TrailingCommaInHashLiteral (#23693) --- .rubocop_todo.yml | 28 ------------------ spec/controllers/admin/accounts_controller_spec.rb | 2 +- .../admin/domain_blocks_controller_spec.rb | 6 ++-- .../api/v1/accounts/credentials_controller_spec.rb | 2 +- .../api/v1/push/subscriptions_controller_spec.rb | 6 ++-- .../api/web/push_subscriptions_controller_spec.rb | 6 ++-- .../settings/applications_controller_spec.rb | 20 ++++++------- .../settings/imports_controller_spec.rb | 8 ++--- .../preferences/notifications_controller_spec.rb | 2 +- .../settings/preferences/other_controller_spec.rb | 2 +- spec/lib/activitypub/activity/announce_spec.rb | 2 +- spec/lib/activitypub/activity/create_spec.rb | 8 ++--- .../fetch_featured_collection_service_spec.rb | 2 +- .../fetch_featured_tags_collection_service_spec.rb | 2 +- .../fetch_remote_status_service_spec.rb | 2 +- .../activitypub/fetch_replies_service_spec.rb | 2 +- .../activitypub/process_account_service_spec.rb | 2 +- .../activitypub/process_collection_service_spec.rb | 34 +++++++++++----------- .../process_status_update_service_spec.rb | 8 ++--- .../synchronize_followers_service_spec.rb | 2 +- spec/services/fetch_resource_service_spec.rb | 2 +- spec/spec_helper.rb | 2 +- 22 files changed, 61 insertions(+), 89 deletions(-) (limited to 'spec/lib/activitypub/activity') diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index f35336332..ca2b085c9 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -3417,34 +3417,6 @@ Style/TrailingCommaInArrayLiteral: - 'spec/services/activitypub/process_collection_service_spec.rb' - 'spec/workers/activitypub/move_distribution_worker_spec.rb' -# Offense count: 61 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyleForMultiline. -# SupportedStylesForMultiline: comma, consistent_comma, no_comma -Style/TrailingCommaInHashLiteral: - Exclude: - - 'spec/controllers/admin/accounts_controller_spec.rb' - - 'spec/controllers/admin/domain_blocks_controller_spec.rb' - - 'spec/controllers/api/v1/accounts/credentials_controller_spec.rb' - - 'spec/controllers/api/v1/push/subscriptions_controller_spec.rb' - - 'spec/controllers/api/web/push_subscriptions_controller_spec.rb' - - 'spec/controllers/settings/applications_controller_spec.rb' - - 'spec/controllers/settings/imports_controller_spec.rb' - - 'spec/controllers/settings/preferences/notifications_controller_spec.rb' - - 'spec/controllers/settings/preferences/other_controller_spec.rb' - - 'spec/lib/activitypub/activity/announce_spec.rb' - - 'spec/lib/activitypub/activity/create_spec.rb' - - 'spec/services/activitypub/fetch_featured_collection_service_spec.rb' - - 'spec/services/activitypub/fetch_featured_tags_collection_service_spec.rb' - - 'spec/services/activitypub/fetch_remote_status_service_spec.rb' - - 'spec/services/activitypub/fetch_replies_service_spec.rb' - - 'spec/services/activitypub/process_account_service_spec.rb' - - 'spec/services/activitypub/process_collection_service_spec.rb' - - 'spec/services/activitypub/process_status_update_service_spec.rb' - - 'spec/services/activitypub/synchronize_followers_service_spec.rb' - - 'spec/services/fetch_resource_service_spec.rb' - - 'spec/spec_helper.rb' - # Offense count: 4 # This cop supports safe autocorrection (--autocorrect). Style/UnpackFirst: diff --git a/spec/controllers/admin/accounts_controller_spec.rb b/spec/controllers/admin/accounts_controller_spec.rb index 81d592ddd..48204b7b6 100644 --- a/spec/controllers/admin/accounts_controller_spec.rb +++ b/spec/controllers/admin/accounts_controller_spec.rb @@ -39,7 +39,7 @@ RSpec.describe Admin::AccountsController, type: :controller do username: 'username', display_name: 'display name', email: 'local-part@domain', - ip: '0.0.0.42' + ip: '0.0.0.42', } end diff --git a/spec/controllers/admin/domain_blocks_controller_spec.rb b/spec/controllers/admin/domain_blocks_controller_spec.rb index f432060d9..3b2fd6c5d 100644 --- a/spec/controllers/admin/domain_blocks_controller_spec.rb +++ b/spec/controllers/admin/domain_blocks_controller_spec.rb @@ -26,9 +26,9 @@ RSpec.describe Admin::DomainBlocksController, type: :controller do domain_blocks_attributes: { '0' => { enabled: '1', domain: 'example.com', severity: 'silence' }, '1' => { enabled: '0', domain: 'mastodon.social', severity: 'suspend' }, - '2' => { enabled: '1', domain: 'mastodon.online', severity: 'suspend' } - } - } + '2' => { enabled: '1', domain: 'mastodon.online', severity: 'suspend' }, + }, + }, } expect(DomainBlockWorker).to have_received(:perform_async).exactly(2).times diff --git a/spec/controllers/api/v1/accounts/credentials_controller_spec.rb b/spec/controllers/api/v1/accounts/credentials_controller_spec.rb index 89cc8acad..d8aa00a07 100644 --- a/spec/controllers/api/v1/accounts/credentials_controller_spec.rb +++ b/spec/controllers/api/v1/accounts/credentials_controller_spec.rb @@ -35,7 +35,7 @@ describe Api::V1::Accounts::CredentialsController do source: { privacy: 'unlisted', sensitive: true, - } + }, } end diff --git a/spec/controllers/api/v1/push/subscriptions_controller_spec.rb b/spec/controllers/api/v1/push/subscriptions_controller_spec.rb index 9487251e1..67f09da2d 100644 --- a/spec/controllers/api/v1/push/subscriptions_controller_spec.rb +++ b/spec/controllers/api/v1/push/subscriptions_controller_spec.rb @@ -20,7 +20,7 @@ describe Api::V1::Push::SubscriptionsController do p256dh: 'BEm_a0bdPDhf0SOsrnB2-ategf1hHoCnpXgQsFj5JCkcoMrMt2WHoPfEYOYPzOIs9mZE8ZUaD7VA5vouy0kEkr8=', auth: 'eH_C8rq2raXqlcBVDa1gLg==', }, - } + }, }.with_indifferent_access end @@ -37,8 +37,8 @@ describe Api::V1::Push::SubscriptionsController do mention: false, poll: true, status: false, - } - } + }, + }, }.with_indifferent_access end diff --git a/spec/controllers/api/web/push_subscriptions_controller_spec.rb b/spec/controllers/api/web/push_subscriptions_controller_spec.rb index bda4a7661..9f027ede9 100644 --- a/spec/controllers/api/web/push_subscriptions_controller_spec.rb +++ b/spec/controllers/api/web/push_subscriptions_controller_spec.rb @@ -15,7 +15,7 @@ describe Api::Web::PushSubscriptionsController do p256dh: 'BEm_a0bdPDhf0SOsrnB2-ategf1hHoCnpXgQsFj5JCkcoMrMt2WHoPfEYOYPzOIs9mZE8ZUaD7VA5vouy0kEkr8=', auth: 'eH_C8rq2raXqlcBVDa1gLg==', }, - } + }, } end @@ -32,8 +32,8 @@ describe Api::Web::PushSubscriptionsController do mention: false, poll: true, status: false, - } - } + }, + }, } end diff --git a/spec/controllers/settings/applications_controller_spec.rb b/spec/controllers/settings/applications_controller_spec.rb index b79a38ea1..75d3240f9 100644 --- a/spec/controllers/settings/applications_controller_spec.rb +++ b/spec/controllers/settings/applications_controller_spec.rb @@ -51,8 +51,8 @@ describe Settings::ApplicationsController do name: 'My New App', redirect_uri: 'urn:ietf:wg:oauth:2.0:oob', website: 'http://google.com', - scopes: 'read write follow' - } + scopes: 'read write follow', + }, } response end @@ -73,8 +73,8 @@ describe Settings::ApplicationsController do name: 'My New App', redirect_uri: 'urn:ietf:wg:oauth:2.0:oob', website: 'http://google.com', - scopes: ['read', 'write', 'follow'] - } + scopes: ['read', 'write', 'follow'], + }, } response end @@ -95,8 +95,8 @@ describe Settings::ApplicationsController do name: '', redirect_uri: '', website: '', - scopes: [] - } + scopes: [], + }, } end @@ -114,14 +114,14 @@ describe Settings::ApplicationsController do context 'success' do let(:opts) { { - website: 'https://foo.bar/' + website: 'https://foo.bar/', } } def call_update patch :update, params: { id: app.id, - doorkeeper_application: opts + doorkeeper_application: opts, } response end @@ -144,8 +144,8 @@ describe Settings::ApplicationsController do name: '', redirect_uri: '', website: '', - scopes: [] - } + scopes: [], + }, } end diff --git a/spec/controllers/settings/imports_controller_spec.rb b/spec/controllers/settings/imports_controller_spec.rb index b8caf5941..8070a35db 100644 --- a/spec/controllers/settings/imports_controller_spec.rb +++ b/spec/controllers/settings/imports_controller_spec.rb @@ -21,8 +21,8 @@ RSpec.describe Settings::ImportsController, type: :controller do post :create, params: { import: { type: 'following', - data: fixture_file_upload('imports.txt') - } + data: fixture_file_upload('imports.txt'), + }, } expect(response).to redirect_to(settings_import_path) @@ -34,8 +34,8 @@ RSpec.describe Settings::ImportsController, type: :controller do post :create, params: { import: { type: 'blocking', - data: fixture_file_upload('imports.txt') - } + data: fixture_file_upload('imports.txt'), + }, } expect(response).to redirect_to(settings_import_path) diff --git a/spec/controllers/settings/preferences/notifications_controller_spec.rb b/spec/controllers/settings/preferences/notifications_controller_spec.rb index 02180b383..a821052ed 100644 --- a/spec/controllers/settings/preferences/notifications_controller_spec.rb +++ b/spec/controllers/settings/preferences/notifications_controller_spec.rb @@ -25,7 +25,7 @@ describe Settings::Preferences::NotificationsController do user: { notification_emails: { follow: '1' }, interactions: { must_be_follower: '0' }, - } + }, } expect(response).to redirect_to(settings_preferences_notifications_path) diff --git a/spec/controllers/settings/preferences/other_controller_spec.rb b/spec/controllers/settings/preferences/other_controller_spec.rb index 960378a01..dd7f01847 100644 --- a/spec/controllers/settings/preferences/other_controller_spec.rb +++ b/spec/controllers/settings/preferences/other_controller_spec.rb @@ -34,7 +34,7 @@ describe Settings::Preferences::OtherController do user: { setting_boost_modal: '1', setting_delete_modal: '0', - } + }, } expect(response).to redirect_to(settings_preferences_other_path) diff --git a/spec/lib/activitypub/activity/announce_spec.rb b/spec/lib/activitypub/activity/announce_spec.rb index 1b3485384..461c3757b 100644 --- a/spec/lib/activitypub/activity/announce_spec.rb +++ b/spec/lib/activitypub/activity/announce_spec.rb @@ -85,7 +85,7 @@ RSpec.describe ActivityPub::Activity::Announce do type: 'OrderedCollection', id: 'http://example.com/followers', first: 'http://example.com/followers?page=true', - } + }, } end diff --git a/spec/lib/activitypub/activity/create_spec.rb b/spec/lib/activitypub/activity/create_spec.rb index 074aa54ca..132e0c31c 100644 --- a/spec/lib/activitypub/activity/create_spec.rb +++ b/spec/lib/activitypub/activity/create_spec.rb @@ -255,7 +255,7 @@ RSpec.describe ActivityPub::Activity::Create do type: 'OrderedCollection', id: 'http://example.com/followers', first: 'http://example.com/followers?page=true', - } + }, } end @@ -686,7 +686,7 @@ RSpec.describe ActivityPub::Activity::Create do replies: { type: 'Collection', totalItems: 3, - } + }, }, ], } @@ -716,7 +716,7 @@ RSpec.describe ActivityPub::Activity::Create do id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join, type: 'Note', name: 'Yellow', - inReplyTo: ActivityPub::TagManager.instance.uri_for(local_status) + inReplyTo: ActivityPub::TagManager.instance.uri_for(local_status), } end @@ -741,7 +741,7 @@ RSpec.describe ActivityPub::Activity::Create do id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join, type: 'Note', name: 'Yellow', - inReplyTo: ActivityPub::TagManager.instance.uri_for(local_status) + inReplyTo: ActivityPub::TagManager.instance.uri_for(local_status), } end diff --git a/spec/services/activitypub/fetch_featured_collection_service_spec.rb b/spec/services/activitypub/fetch_featured_collection_service_spec.rb index e6336dc1b..23d90a9a2 100644 --- a/spec/services/activitypub/fetch_featured_collection_service_spec.rb +++ b/spec/services/activitypub/fetch_featured_collection_service_spec.rb @@ -109,7 +109,7 @@ RSpec.describe ActivityPub::FetchFeaturedCollectionService, type: :service do type: 'CollectionPage', partOf: actor.featured_collection_url, items: items, - } + }, }.with_indifferent_access end diff --git a/spec/services/activitypub/fetch_featured_tags_collection_service_spec.rb b/spec/services/activitypub/fetch_featured_tags_collection_service_spec.rb index 6ca22c9fc..692866bce 100644 --- a/spec/services/activitypub/fetch_featured_tags_collection_service_spec.rb +++ b/spec/services/activitypub/fetch_featured_tags_collection_service_spec.rb @@ -81,7 +81,7 @@ RSpec.describe ActivityPub::FetchFeaturedTagsCollectionService, type: :service d type: 'CollectionPage', partOf: collection_url, items: items, - } + }, }.with_indifferent_access end diff --git a/spec/services/activitypub/fetch_remote_status_service_spec.rb b/spec/services/activitypub/fetch_remote_status_service_spec.rb index d6145c9b8..e02054672 100644 --- a/spec/services/activitypub/fetch_remote_status_service_spec.rb +++ b/spec/services/activitypub/fetch_remote_status_service_spec.rb @@ -115,7 +115,7 @@ RSpec.describe ActivityPub::FetchRemoteStatusService, type: :service do id: "https://foo.bar/@foo/1234", type: 'Event', name: "Let's change the world", - attributedTo: ActivityPub::TagManager.instance.uri_for(sender) + attributedTo: ActivityPub::TagManager.instance.uri_for(sender), } end diff --git a/spec/services/activitypub/fetch_replies_service_spec.rb b/spec/services/activitypub/fetch_replies_service_spec.rb index fe49b18c1..5741e0c3f 100644 --- a/spec/services/activitypub/fetch_replies_service_spec.rb +++ b/spec/services/activitypub/fetch_replies_service_spec.rb @@ -90,7 +90,7 @@ RSpec.describe ActivityPub::FetchRepliesService, type: :service do type: 'CollectionPage', partOf: collection_uri, items: items, - } + }, }.with_indifferent_access end diff --git a/spec/services/activitypub/process_account_service_spec.rb b/spec/services/activitypub/process_account_service_spec.rb index 40caa6eb0..8e6ed178e 100644 --- a/spec/services/activitypub/process_account_service_spec.rb +++ b/spec/services/activitypub/process_account_service_spec.rb @@ -175,7 +175,7 @@ RSpec.describe ActivityPub::ProcessAccountService, type: :service do name: "@user#{i + 1}", } ], - to: ['as:Public', "https://foo.test/users/#{i + 1}"] + to: ['as:Public', "https://foo.test/users/#{i + 1}"], }.with_indifferent_access featured_json = { '@context': ['https://www.w3.org/ns/activitystreams'], diff --git a/spec/services/activitypub/process_collection_service_spec.rb b/spec/services/activitypub/process_collection_service_spec.rb index cb7deb626..0fa5321bc 100644 --- a/spec/services/activitypub/process_collection_service_spec.rb +++ b/spec/services/activitypub/process_collection_service_spec.rb @@ -123,15 +123,15 @@ RSpec.describe ActivityPub::ProcessCollectionService, type: :service do type: 'RsaSignature2017', creator: 'https://example.com/users/bob#main-key', created: '2022-03-09T21:57:25Z', - signatureValue: 'WculK0LelTQ0MvGwU9TPoq5pFzFfGYRDCJqjZ232/Udj4CHqDTGOSw5UTDLShqBOyycCkbZGrQwXG+dpyDpQLSe1UVPZ5TPQtc/9XtI57WlS2nMNpdvRuxGnnb2btPdesXZ7n3pCxo0zjaXrJMe0mqQh5QJO22mahb4bDwwmfTHgbD3nmkD+fBfGi+UV2qWwqr+jlV4L4JqNkh0gWljF5KTePLRRZCuWiQ/FAt7c67636cdIPf7fR+usjuZltTQyLZKEGuK8VUn2Gkfsx5qns7Vcjvlz1JqlAjyO8HPBbzTTHzUG2nUOIgC3PojCSWv6mNTmRGoLZzOscCAYQA6cKw==' + signatureValue: 'WculK0LelTQ0MvGwU9TPoq5pFzFfGYRDCJqjZ232/Udj4CHqDTGOSw5UTDLShqBOyycCkbZGrQwXG+dpyDpQLSe1UVPZ5TPQtc/9XtI57WlS2nMNpdvRuxGnnb2btPdesXZ7n3pCxo0zjaXrJMe0mqQh5QJO22mahb4bDwwmfTHgbD3nmkD+fBfGi+UV2qWwqr+jlV4L4JqNkh0gWljF5KTePLRRZCuWiQ/FAt7c67636cdIPf7fR+usjuZltTQyLZKEGuK8VUn2Gkfsx5qns7Vcjvlz1JqlAjyO8HPBbzTTHzUG2nUOIgC3PojCSWv6mNTmRGoLZzOscCAYQA6cKw==', }, '@id': 'https://example.com/users/bob/statuses/107928807471117876/activity', '@type': 'https://www.w3.org/ns/activitystreams#Create', 'https://www.w3.org/ns/activitystreams#actor': { - '@id': 'https://example.com/users/bob' + '@id': 'https://example.com/users/bob', }, 'https://www.w3.org/ns/activitystreams#cc': { - '@id': 'https://example.com/users/bob/followers' + '@id': 'https://example.com/users/bob/followers', }, object: { id: 'https://example.com/users/bob/fake-status', @@ -156,21 +156,21 @@ RSpec.describe ActivityPub::ProcessCollectionService, type: :service do 'http://ostatus.org#conversation': 'tag:example.com,2022-03-09:objectId=15:objectType=Conversation', 'https://www.w3.org/ns/activitystreams#attachment': [], 'https://www.w3.org/ns/activitystreams#attributedTo': { - '@id': 'https://example.com/users/bob' + '@id': 'https://example.com/users/bob', }, 'https://www.w3.org/ns/activitystreams#cc': { - '@id': 'https://example.com/users/bob/followers' + '@id': 'https://example.com/users/bob/followers', }, 'https://www.w3.org/ns/activitystreams#content': [ '

hello world

', { '@value': '

hello world

', - '@language': 'en' + '@language': 'en', } ], 'https://www.w3.org/ns/activitystreams#published': { '@type': 'http://www.w3.org/2001/XMLSchema#dateTime', - '@value': '2022-03-09T21:55:07Z' + '@value': '2022-03-09T21:55:07Z', }, 'https://www.w3.org/ns/activitystreams#replies': { '@id': 'https://example.com/users/bob/statuses/107928807471117876/replies', @@ -179,29 +179,29 @@ RSpec.describe ActivityPub::ProcessCollectionService, type: :service do '@type': 'https://www.w3.org/ns/activitystreams#CollectionPage', 'https://www.w3.org/ns/activitystreams#items': [], 'https://www.w3.org/ns/activitystreams#next': { - '@id': 'https://example.com/users/bob/statuses/107928807471117876/replies?only_other_accounts=true&page=true' + '@id': 'https://example.com/users/bob/statuses/107928807471117876/replies?only_other_accounts=true&page=true', }, 'https://www.w3.org/ns/activitystreams#partOf': { - '@id': 'https://example.com/users/bob/statuses/107928807471117876/replies' - } - } + '@id': 'https://example.com/users/bob/statuses/107928807471117876/replies', + }, + }, }, 'https://www.w3.org/ns/activitystreams#sensitive': false, 'https://www.w3.org/ns/activitystreams#tag': [], 'https://www.w3.org/ns/activitystreams#to': { - '@id': 'https://www.w3.org/ns/activitystreams#Public' + '@id': 'https://www.w3.org/ns/activitystreams#Public', }, 'https://www.w3.org/ns/activitystreams#url': { - '@id': 'https://example.com/@bob/107928807471117876' - } + '@id': 'https://example.com/@bob/107928807471117876', + }, }, 'https://www.w3.org/ns/activitystreams#published': { '@type': 'http://www.w3.org/2001/XMLSchema#dateTime', - '@value': '2022-03-09T21:55:07Z' + '@value': '2022-03-09T21:55:07Z', }, 'https://www.w3.org/ns/activitystreams#to': { - '@id': 'https://www.w3.org/ns/activitystreams#Public' - } + '@id': 'https://www.w3.org/ns/activitystreams#Public', + }, } end diff --git a/spec/services/activitypub/process_status_update_service_spec.rb b/spec/services/activitypub/process_status_update_service_spec.rb index 04292c507..5d15f6ffe 100644 --- a/spec/services/activitypub/process_status_update_service_spec.rb +++ b/spec/services/activitypub/process_status_update_service_spec.rb @@ -115,7 +115,7 @@ RSpec.describe ActivityPub::ProcessStatusUpdateService, type: :service do account: account, multiple: false, hide_totals: false, - expires_at: expiration + expires_at: expiration, }) end @@ -166,7 +166,7 @@ RSpec.describe ActivityPub::ProcessStatusUpdateService, type: :service do account: account, multiple: false, hide_totals: false, - expires_at: expiration + expires_at: expiration, }) end @@ -342,7 +342,7 @@ RSpec.describe ActivityPub::ProcessStatusUpdateService, type: :service do updated: '2021-09-08T22:39:25Z', attachment: [ { type: 'Image', mediaType: 'image/png', url: 'https://example.com/foo.png' }, - ] + ], } end @@ -374,7 +374,7 @@ RSpec.describe ActivityPub::ProcessStatusUpdateService, type: :service do updated: '2021-09-08T22:39:25Z', attachment: [ { type: 'Image', mediaType: 'image/png', url: 'https://example.com/foo.png', name: 'A picture' }, - ] + ], } end diff --git a/spec/services/activitypub/synchronize_followers_service_spec.rb b/spec/services/activitypub/synchronize_followers_service_spec.rb index 75dcf204b..5a37f0733 100644 --- a/spec/services/activitypub/synchronize_followers_service_spec.rb +++ b/spec/services/activitypub/synchronize_followers_service_spec.rb @@ -91,7 +91,7 @@ RSpec.describe ActivityPub::SynchronizeFollowersService, type: :service do type: 'CollectionPage', partOf: collection_uri, items: items, - } + }, }.with_indifferent_access end diff --git a/spec/services/fetch_resource_service_spec.rb b/spec/services/fetch_resource_service_spec.rb index 8cd4a3bfb..6f24e6418 100644 --- a/spec/services/fetch_resource_service_spec.rb +++ b/spec/services/fetch_resource_service_spec.rb @@ -91,7 +91,7 @@ RSpec.describe FetchResourceService, type: :service do end context 'when link header is present' do - let(:headers) { { 'Link' => '; rel="alternate"; type="application/activity+json"', } } + let(:headers) { { 'Link' => '; rel="alternate"; type="application/activity+json"' } } it { is_expected.to eq [1, { prefetched_body: json, id: true }] } end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 0414ba9ed..72c9ce8ae 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -61,6 +61,6 @@ end def expect_push_bulk_to_match(klass, matcher) expect(Sidekiq::Client).to receive(:push_bulk).with(hash_including({ "class" => klass, - "args" => matcher + "args" => matcher, })) end -- cgit