Autofix Rubocop Style/StringLiterals (#23695)
This commit is contained in:
parent
ac3561098e
commit
81ad6c2e39
76 changed files with 277 additions and 359 deletions
|
@ -345,9 +345,9 @@ RSpec.describe Account, type: :model do
|
|||
before do
|
||||
_missing = Fabricate(
|
||||
:account,
|
||||
display_name: "Missing",
|
||||
username: "missing",
|
||||
domain: "missing.com"
|
||||
display_name: 'Missing',
|
||||
username: 'missing',
|
||||
domain: 'missing.com'
|
||||
)
|
||||
end
|
||||
|
||||
|
@ -405,58 +405,58 @@ RSpec.describe Account, type: :model do
|
|||
it 'finds accounts with matching display_name' do
|
||||
match = Fabricate(
|
||||
:account,
|
||||
display_name: "Display Name",
|
||||
username: "username",
|
||||
domain: "example.com"
|
||||
display_name: 'Display Name',
|
||||
username: 'username',
|
||||
domain: 'example.com'
|
||||
)
|
||||
|
||||
results = Account.search_for("display")
|
||||
results = Account.search_for('display')
|
||||
expect(results).to eq [match]
|
||||
end
|
||||
|
||||
it 'finds accounts with matching username' do
|
||||
match = Fabricate(
|
||||
:account,
|
||||
display_name: "Display Name",
|
||||
username: "username",
|
||||
domain: "example.com"
|
||||
display_name: 'Display Name',
|
||||
username: 'username',
|
||||
domain: 'example.com'
|
||||
)
|
||||
|
||||
results = Account.search_for("username")
|
||||
results = Account.search_for('username')
|
||||
expect(results).to eq [match]
|
||||
end
|
||||
|
||||
it 'finds accounts with matching domain' do
|
||||
match = Fabricate(
|
||||
:account,
|
||||
display_name: "Display Name",
|
||||
username: "username",
|
||||
domain: "example.com"
|
||||
display_name: 'Display Name',
|
||||
username: 'username',
|
||||
domain: 'example.com'
|
||||
)
|
||||
|
||||
results = Account.search_for("example")
|
||||
results = Account.search_for('example')
|
||||
expect(results).to eq [match]
|
||||
end
|
||||
|
||||
it 'limits by 10 by default' do
|
||||
11.times.each { Fabricate(:account, display_name: "Display Name") }
|
||||
results = Account.search_for("display")
|
||||
11.times.each { Fabricate(:account, display_name: 'Display Name') }
|
||||
results = Account.search_for('display')
|
||||
expect(results.size).to eq 10
|
||||
end
|
||||
|
||||
it 'accepts arbitrary limits' do
|
||||
2.times.each { Fabricate(:account, display_name: "Display Name") }
|
||||
results = Account.search_for("display", limit: 1)
|
||||
2.times.each { Fabricate(:account, display_name: 'Display Name') }
|
||||
results = Account.search_for('display', limit: 1)
|
||||
expect(results.size).to eq 1
|
||||
end
|
||||
|
||||
it 'ranks multiple matches higher' do
|
||||
matches = [
|
||||
{ username: "username", display_name: "username" },
|
||||
{ display_name: "Display Name", username: "username", domain: "example.com" },
|
||||
{ username: 'username', display_name: 'username' },
|
||||
{ display_name: 'Display Name', username: 'username', domain: 'example.com' },
|
||||
].map(&method(:Fabricate).curry(2).call(:account))
|
||||
|
||||
results = Account.search_for("username")
|
||||
results = Account.search_for('username')
|
||||
expect(results).to eq matches
|
||||
end
|
||||
end
|
||||
|
@ -582,23 +582,23 @@ RSpec.describe Account, type: :model do
|
|||
end
|
||||
|
||||
it 'limits by 10 by default' do
|
||||
11.times { Fabricate(:account, display_name: "Display Name") }
|
||||
results = Account.advanced_search_for("display", account)
|
||||
11.times { Fabricate(:account, display_name: 'Display Name') }
|
||||
results = Account.advanced_search_for('display', account)
|
||||
expect(results.size).to eq 10
|
||||
end
|
||||
|
||||
it 'accepts arbitrary limits' do
|
||||
2.times { Fabricate(:account, display_name: "Display Name") }
|
||||
results = Account.advanced_search_for("display", account, limit: 1)
|
||||
2.times { Fabricate(:account, display_name: 'Display Name') }
|
||||
results = Account.advanced_search_for('display', account, limit: 1)
|
||||
expect(results.size).to eq 1
|
||||
end
|
||||
|
||||
it 'ranks followed accounts higher' do
|
||||
match = Fabricate(:account, username: "Matching")
|
||||
followed_match = Fabricate(:account, username: "Matcher")
|
||||
match = Fabricate(:account, username: 'Matching')
|
||||
followed_match = Fabricate(:account, username: 'Matcher')
|
||||
Fabricate(:follow, account: account, target_account: followed_match)
|
||||
|
||||
results = Account.advanced_search_for("match", account)
|
||||
results = Account.advanced_search_for('match', account)
|
||||
expect(results).to eq [followed_match, match]
|
||||
expect(results.first.rank).to be > results.last.rank
|
||||
end
|
||||
|
|
|
@ -94,8 +94,8 @@ RSpec.describe MediaAttachment, type: :model do
|
|||
end
|
||||
|
||||
it 'sets meta' do
|
||||
expect(media.file.meta["original"]["width"]).to eq 128
|
||||
expect(media.file.meta["original"]["height"]).to eq 128
|
||||
expect(media.file.meta['original']['width']).to eq 128
|
||||
expect(media.file.meta['original']['height']).to eq 128
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -118,9 +118,9 @@ RSpec.describe MediaAttachment, type: :model do
|
|||
end
|
||||
|
||||
it 'sets meta' do
|
||||
expect(media.file.meta["original"]["width"]).to eq fixture[:width]
|
||||
expect(media.file.meta["original"]["height"]).to eq fixture[:height]
|
||||
expect(media.file.meta["original"]["aspect"]).to eq fixture[:aspect]
|
||||
expect(media.file.meta['original']['width']).to eq fixture[:width]
|
||||
expect(media.file.meta['original']['height']).to eq fixture[:height]
|
||||
expect(media.file.meta['original']['aspect']).to eq fixture[:aspect]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -154,12 +154,12 @@ RSpec.describe MediaAttachment, type: :model do
|
|||
let(:media) { MediaAttachment.create(account: Fabricate(:account), file: attachment_fixture('attachment.jpg')) }
|
||||
|
||||
it 'sets meta for different style' do
|
||||
expect(media.file.meta["original"]["width"]).to eq 600
|
||||
expect(media.file.meta["original"]["height"]).to eq 400
|
||||
expect(media.file.meta["original"]["aspect"]).to eq 1.5
|
||||
expect(media.file.meta["small"]["width"]).to eq 588
|
||||
expect(media.file.meta["small"]["height"]).to eq 392
|
||||
expect(media.file.meta["small"]["aspect"]).to eq 1.5
|
||||
expect(media.file.meta['original']['width']).to eq 600
|
||||
expect(media.file.meta['original']['height']).to eq 400
|
||||
expect(media.file.meta['original']['aspect']).to eq 1.5
|
||||
expect(media.file.meta['small']['width']).to eq 588
|
||||
expect(media.file.meta['small']['height']).to eq 392
|
||||
expect(media.file.meta['small']['aspect']).to eq 1.5
|
||||
end
|
||||
|
||||
it 'gives the file a random name' do
|
||||
|
|
|
@ -29,7 +29,7 @@ RSpec.describe Web::PushSubscription, type: :model do
|
|||
context "when notification is a #{type}" do
|
||||
let(:notification_type) { type }
|
||||
|
||||
it "returns boolean corresponding to alert setting" do
|
||||
it 'returns boolean corresponding to alert setting' do
|
||||
expect(subject.pushable?(notification)).to eq data[:alerts][type]
|
||||
end
|
||||
end
|
||||
|
|
|
@ -35,8 +35,8 @@ RSpec.describe WebauthnCredential, type: :model do
|
|||
end
|
||||
|
||||
it 'is invalid if already exist a webauthn credential with the same external id' do
|
||||
existing_webauthn_credential = Fabricate(:webauthn_credential, external_id: "_Typ0ygudDnk9YUVWLQayw")
|
||||
new_webauthn_credential = Fabricate.build(:webauthn_credential, external_id: "_Typ0ygudDnk9YUVWLQayw")
|
||||
existing_webauthn_credential = Fabricate(:webauthn_credential, external_id: '_Typ0ygudDnk9YUVWLQayw')
|
||||
new_webauthn_credential = Fabricate.build(:webauthn_credential, external_id: '_Typ0ygudDnk9YUVWLQayw')
|
||||
|
||||
new_webauthn_credential.valid?
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue