Fix RSpec/PredicateMatcher cop (#25102)
This commit is contained in:
parent
778e4a7bf7
commit
b896b16cb3
|
@ -556,15 +556,6 @@ RSpec/PendingWithoutReason:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'spec/models/account_spec.rb'
|
- 'spec/models/account_spec.rb'
|
||||||
|
|
||||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
||||||
# Configuration parameters: Strict, EnforcedStyle, AllowedExplicitMatchers.
|
|
||||||
# SupportedStyles: inflected, explicit
|
|
||||||
RSpec/PredicateMatcher:
|
|
||||||
Exclude:
|
|
||||||
- 'spec/controllers/api/v1/accounts/notes_controller_spec.rb'
|
|
||||||
- 'spec/models/user_spec.rb'
|
|
||||||
- 'spec/services/post_status_service_spec.rb'
|
|
||||||
|
|
||||||
RSpec/StubbedMock:
|
RSpec/StubbedMock:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'spec/controllers/api/base_controller_spec.rb'
|
- 'spec/controllers/api/base_controller_spec.rb'
|
||||||
|
|
|
@ -43,7 +43,7 @@ describe Api::V1::Accounts::NotesController do
|
||||||
|
|
||||||
it 'does not create account note' do
|
it 'does not create account note' do
|
||||||
subject
|
subject
|
||||||
expect(AccountNote.where(account_id: user.account.id, target_account_id: account.id).exists?).to be_falsey
|
expect(AccountNote.where(account_id: user.account.id, target_account_id: account.id)).to_not exist
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -115,19 +115,19 @@ RSpec.describe User do
|
||||||
it 'allows a non-blacklisted user to be created' do
|
it 'allows a non-blacklisted user to be created' do
|
||||||
user = User.new(email: 'foo@example.com', account: account, password: password, agreement: true)
|
user = User.new(email: 'foo@example.com', account: account, password: password, agreement: true)
|
||||||
|
|
||||||
expect(user.valid?).to be_truthy
|
expect(user).to be_valid
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'does not allow a blacklisted user to be created' do
|
it 'does not allow a blacklisted user to be created' do
|
||||||
user = User.new(email: 'foo@mvrht.com', account: account, password: password, agreement: true)
|
user = User.new(email: 'foo@mvrht.com', account: account, password: password, agreement: true)
|
||||||
|
|
||||||
expect(user.valid?).to be_falsey
|
expect(user).to_not be_valid
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'does not allow a subdomain blacklisted user to be created' do
|
it 'does not allow a subdomain blacklisted user to be created' do
|
||||||
user = User.new(email: 'foo@mvrht.com.topdomain.tld', account: account, password: password, agreement: true)
|
user = User.new(email: 'foo@mvrht.com.topdomain.tld', account: account, password: password, agreement: true)
|
||||||
|
|
||||||
expect(user.valid?).to be_falsey
|
expect(user).to_not be_valid
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -350,17 +350,17 @@ RSpec.describe User do
|
||||||
|
|
||||||
it 'does not allow a user to be created unless they are whitelisted' do
|
it 'does not allow a user to be created unless they are whitelisted' do
|
||||||
user = User.new(email: 'foo@example.com', account: account, password: password, agreement: true)
|
user = User.new(email: 'foo@example.com', account: account, password: password, agreement: true)
|
||||||
expect(user.valid?).to be_falsey
|
expect(user).to_not be_valid
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'allows a user to be created if they are whitelisted' do
|
it 'allows a user to be created if they are whitelisted' do
|
||||||
user = User.new(email: 'foo@mastodon.space', account: account, password: password, agreement: true)
|
user = User.new(email: 'foo@mastodon.space', account: account, password: password, agreement: true)
|
||||||
expect(user.valid?).to be_truthy
|
expect(user).to be_valid
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'does not allow a user with a whitelisted top domain as subdomain in their email address to be created' do
|
it 'does not allow a user with a whitelisted top domain as subdomain in their email address to be created' do
|
||||||
user = User.new(email: 'foo@mastodon.space.userdomain.com', account: account, password: password, agreement: true)
|
user = User.new(email: 'foo@mastodon.space.userdomain.com', account: account, password: password, agreement: true)
|
||||||
expect(user.valid?).to be_falsey
|
expect(user).to_not be_valid
|
||||||
end
|
end
|
||||||
|
|
||||||
context do
|
context do
|
||||||
|
@ -374,7 +374,7 @@ RSpec.describe User do
|
||||||
Rails.configuration.x.email_domains_blacklist = 'blacklisted.mastodon.space'
|
Rails.configuration.x.email_domains_blacklist = 'blacklisted.mastodon.space'
|
||||||
|
|
||||||
user = User.new(email: 'foo@blacklisted.mastodon.space', account: account, password: password)
|
user = User.new(email: 'foo@blacklisted.mastodon.space', account: account, password: password)
|
||||||
expect(user.valid?).to be_falsey
|
expect(user).to_not be_valid
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -48,7 +48,7 @@ RSpec.describe PostStatusService, type: :service do
|
||||||
expect(status.params['text']).to eq 'Hi future!'
|
expect(status.params['text']).to eq 'Hi future!'
|
||||||
expect(status.params['media_ids']).to eq [media.id]
|
expect(status.params['media_ids']).to eq [media.id]
|
||||||
expect(media.reload.status).to be_nil
|
expect(media.reload.status).to be_nil
|
||||||
expect(Status.where(text: 'Hi future!').exists?).to be_falsey
|
expect(Status.where(text: 'Hi future!')).to_not exist
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'does not change statuses count' do
|
it 'does not change statuses count' do
|
||||||
|
|
Reference in New Issue