mirror of https://github.com/Siphonay/mastodon
Fix `RSpec/HookArgument` cop (#27747)
This commit is contained in:
parent
1b28ab7263
commit
b06284c572
|
@ -94,20 +94,6 @@ RSpec/AnyInstance:
|
||||||
RSpec/ExampleLength:
|
RSpec/ExampleLength:
|
||||||
Max: 22
|
Max: 22
|
||||||
|
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
|
||||||
# Configuration parameters: EnforcedStyle.
|
|
||||||
# SupportedStyles: implicit, each, example
|
|
||||||
RSpec/HookArgument:
|
|
||||||
Exclude:
|
|
||||||
- 'spec/controllers/api/v1/streaming_controller_spec.rb'
|
|
||||||
- 'spec/controllers/well_known/webfinger_controller_spec.rb'
|
|
||||||
- 'spec/helpers/instance_helper_spec.rb'
|
|
||||||
- 'spec/models/user_spec.rb'
|
|
||||||
- 'spec/rails_helper.rb'
|
|
||||||
- 'spec/serializers/activitypub/note_serializer_spec.rb'
|
|
||||||
- 'spec/serializers/activitypub/update_poll_serializer_spec.rb'
|
|
||||||
- 'spec/services/import_service_spec.rb'
|
|
||||||
|
|
||||||
# Configuration parameters: AssignmentOnly.
|
# Configuration parameters: AssignmentOnly.
|
||||||
RSpec/InstanceVariable:
|
RSpec/InstanceVariable:
|
||||||
Exclude:
|
Exclude:
|
||||||
|
|
|
@ -3,14 +3,14 @@
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
describe Api::V1::StreamingController do
|
describe Api::V1::StreamingController do
|
||||||
around(:each) do |example|
|
around do |example|
|
||||||
before = Rails.configuration.x.streaming_api_base_url
|
before = Rails.configuration.x.streaming_api_base_url
|
||||||
Rails.configuration.x.streaming_api_base_url = Rails.configuration.x.web_domain
|
Rails.configuration.x.streaming_api_base_url = Rails.configuration.x.web_domain
|
||||||
example.run
|
example.run
|
||||||
Rails.configuration.x.streaming_api_base_url = before
|
Rails.configuration.x.streaming_api_base_url = before
|
||||||
end
|
end
|
||||||
|
|
||||||
before(:each) do
|
before do
|
||||||
request.headers.merge! Host: Rails.configuration.x.web_domain
|
request.headers.merge! Host: Rails.configuration.x.web_domain
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ describe Api::V1::StreamingController do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with streaming api on different host' do
|
context 'with streaming api on different host' do
|
||||||
before(:each) do
|
before do
|
||||||
Rails.configuration.x.streaming_api_base_url = "wss://streaming-#{Rails.configuration.x.web_domain}"
|
Rails.configuration.x.streaming_api_base_url = "wss://streaming-#{Rails.configuration.x.web_domain}"
|
||||||
@streaming_host = URI.parse(Rails.configuration.x.streaming_api_base_url).host
|
@streaming_host = URI.parse(Rails.configuration.x.streaming_api_base_url).host
|
||||||
end
|
end
|
||||||
|
|
|
@ -16,7 +16,7 @@ describe WellKnown::WebfingerController do
|
||||||
let(:alice) { Fabricate(:account, username: 'alice') }
|
let(:alice) { Fabricate(:account, username: 'alice') }
|
||||||
let(:resource) { nil }
|
let(:resource) { nil }
|
||||||
|
|
||||||
around(:each) do |example|
|
around do |example|
|
||||||
tmp = Rails.configuration.x.alternate_domains
|
tmp = Rails.configuration.x.alternate_domains
|
||||||
Rails.configuration.x.alternate_domains = alternate_domains
|
Rails.configuration.x.alternate_domains = alternate_domains
|
||||||
example.run
|
example.run
|
||||||
|
|
|
@ -18,7 +18,7 @@ describe InstanceHelper do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'site_hostname' do
|
describe 'site_hostname' do
|
||||||
around(:each) do |example|
|
around do |example|
|
||||||
before = Rails.configuration.x.local_domain
|
before = Rails.configuration.x.local_domain
|
||||||
example.run
|
example.run
|
||||||
Rails.configuration.x.local_domain = before
|
Rails.configuration.x.local_domain = before
|
||||||
|
|
|
@ -102,7 +102,7 @@ RSpec.describe User do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'blacklist' do
|
describe 'blacklist' do
|
||||||
around(:each) do |example|
|
around do |example|
|
||||||
old_blacklist = Rails.configuration.x.email_blacklist
|
old_blacklist = Rails.configuration.x.email_blacklist
|
||||||
|
|
||||||
Rails.configuration.x.email_domains_blacklist = 'mvrht.com'
|
Rails.configuration.x.email_domains_blacklist = 'mvrht.com'
|
||||||
|
@ -169,7 +169,7 @@ RSpec.describe User do
|
||||||
let(:user) { Fabricate(:user, confirmed_at: nil, unconfirmed_email: new_email) }
|
let(:user) { Fabricate(:user, confirmed_at: nil, unconfirmed_email: new_email) }
|
||||||
|
|
||||||
context 'when the user is already approved' do
|
context 'when the user is already approved' do
|
||||||
around(:example) do |example|
|
around do |example|
|
||||||
registrations_mode = Setting.registrations_mode
|
registrations_mode = Setting.registrations_mode
|
||||||
Setting.registrations_mode = 'approved'
|
Setting.registrations_mode = 'approved'
|
||||||
|
|
||||||
|
@ -193,7 +193,7 @@ RSpec.describe User do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when the user does not require explicit approval' do
|
context 'when the user does not require explicit approval' do
|
||||||
around(:example) do |example|
|
around do |example|
|
||||||
registrations_mode = Setting.registrations_mode
|
registrations_mode = Setting.registrations_mode
|
||||||
Setting.registrations_mode = 'open'
|
Setting.registrations_mode = 'open'
|
||||||
|
|
||||||
|
@ -213,7 +213,7 @@ RSpec.describe User do
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when the user requires explicit approval but is not approved' do
|
context 'when the user requires explicit approval but is not approved' do
|
||||||
around(:example) do |example|
|
around do |example|
|
||||||
registrations_mode = Setting.registrations_mode
|
registrations_mode = Setting.registrations_mode
|
||||||
Setting.registrations_mode = 'approved'
|
Setting.registrations_mode = 'approved'
|
||||||
|
|
||||||
|
@ -237,7 +237,7 @@ RSpec.describe User do
|
||||||
describe '#approve!' do
|
describe '#approve!' do
|
||||||
subject { user.approve! }
|
subject { user.approve! }
|
||||||
|
|
||||||
around(:example) do |example|
|
around do |example|
|
||||||
registrations_mode = Setting.registrations_mode
|
registrations_mode = Setting.registrations_mode
|
||||||
Setting.registrations_mode = 'approved'
|
Setting.registrations_mode = 'approved'
|
||||||
|
|
||||||
|
@ -338,7 +338,7 @@ RSpec.describe User do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'whitelist' do
|
describe 'whitelist' do
|
||||||
around(:each) do |example|
|
around do |example|
|
||||||
old_whitelist = Rails.configuration.x.email_domains_whitelist
|
old_whitelist = Rails.configuration.x.email_domains_whitelist
|
||||||
|
|
||||||
Rails.configuration.x.email_domains_whitelist = 'mastodon.space'
|
Rails.configuration.x.email_domains_whitelist = 'mastodon.space'
|
||||||
|
|
|
@ -142,13 +142,13 @@ RSpec.configure do |config|
|
||||||
search_data_manager.remove_indexes
|
search_data_manager.remove_indexes
|
||||||
end
|
end
|
||||||
|
|
||||||
config.before(:each) do |example|
|
config.before do |example|
|
||||||
unless example.metadata[:paperclip_processing]
|
unless example.metadata[:paperclip_processing]
|
||||||
allow_any_instance_of(Paperclip::Attachment).to receive(:post_process).and_return(true) # rubocop:disable RSpec/AnyInstance
|
allow_any_instance_of(Paperclip::Attachment).to receive(:post_process).and_return(true) # rubocop:disable RSpec/AnyInstance
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
config.after :each do
|
config.after do
|
||||||
Rails.cache.clear
|
Rails.cache.clear
|
||||||
redis.del(redis.keys)
|
redis.del(redis.keys)
|
||||||
end
|
end
|
||||||
|
|
|
@ -14,7 +14,7 @@ describe ActivityPub::NoteSerializer do
|
||||||
let!(:reply_by_account_third) { Fabricate(:status, account: account, thread: parent, visibility: :public) }
|
let!(:reply_by_account_third) { Fabricate(:status, account: account, thread: parent, visibility: :public) }
|
||||||
let!(:reply_by_account_visibility_direct) { Fabricate(:status, account: account, thread: parent, visibility: :direct) }
|
let!(:reply_by_account_visibility_direct) { Fabricate(:status, account: account, thread: parent, visibility: :direct) }
|
||||||
|
|
||||||
before(:each) do
|
before do
|
||||||
@serialization = ActiveModelSerializers::SerializableResource.new(parent, serializer: described_class, adapter: ActivityPub::Adapter)
|
@serialization = ActiveModelSerializers::SerializableResource.new(parent, serializer: described_class, adapter: ActivityPub::Adapter)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ describe ActivityPub::UpdatePollSerializer do
|
||||||
let(:poll) { Fabricate(:poll, account: account) }
|
let(:poll) { Fabricate(:poll, account: account) }
|
||||||
let!(:status) { Fabricate(:status, account: account, poll: poll) }
|
let!(:status) { Fabricate(:status, account: account, poll: poll) }
|
||||||
|
|
||||||
before(:each) do
|
before do
|
||||||
@serialization = ActiveModelSerializers::SerializableResource.new(status, serializer: described_class, adapter: ActivityPub::Adapter)
|
@serialization = ActiveModelSerializers::SerializableResource.new(status, serializer: described_class, adapter: ActivityPub::Adapter)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -208,7 +208,7 @@ RSpec.describe ImportService, type: :service do
|
||||||
let!(:remote_status) { Fabricate(:status, uri: 'https://example.com/statuses/1312') }
|
let!(:remote_status) { Fabricate(:status, uri: 'https://example.com/statuses/1312') }
|
||||||
let!(:direct_status) { Fabricate(:status, uri: 'https://example.com/statuses/direct', visibility: :direct) }
|
let!(:direct_status) { Fabricate(:status, uri: 'https://example.com/statuses/direct', visibility: :direct) }
|
||||||
|
|
||||||
around(:each) do |example|
|
around do |example|
|
||||||
local_before = Rails.configuration.x.local_domain
|
local_before = Rails.configuration.x.local_domain
|
||||||
web_before = Rails.configuration.x.web_domain
|
web_before = Rails.configuration.x.web_domain
|
||||||
Rails.configuration.x.local_domain = 'local.com'
|
Rails.configuration.x.local_domain = 'local.com'
|
||||||
|
|
Loading…
Reference in New Issue