Fix RSpec/InstanceVariable
cop (#27766)
This commit is contained in:
parent
4329616c53
commit
69d00e2721
11 changed files with 97 additions and 124 deletions
|
@ -4,17 +4,15 @@ require 'rails_helper'
|
|||
|
||||
describe AccountFinderConcern do
|
||||
describe 'local finders' do
|
||||
before do
|
||||
@account = Fabricate(:account, username: 'Alice')
|
||||
end
|
||||
let!(:account) { Fabricate(:account, username: 'Alice') }
|
||||
|
||||
describe '.find_local' do
|
||||
it 'returns case-insensitive result' do
|
||||
expect(Account.find_local('alice')).to eq(@account)
|
||||
expect(Account.find_local('alice')).to eq(account)
|
||||
end
|
||||
|
||||
it 'returns correctly cased result' do
|
||||
expect(Account.find_local('Alice')).to eq(@account)
|
||||
expect(Account.find_local('Alice')).to eq(account)
|
||||
end
|
||||
|
||||
it 'returns nil without a match' do
|
||||
|
@ -36,7 +34,7 @@ describe AccountFinderConcern do
|
|||
|
||||
describe '.find_local!' do
|
||||
it 'returns matching result' do
|
||||
expect(Account.find_local!('alice')).to eq(@account)
|
||||
expect(Account.find_local!('alice')).to eq(account)
|
||||
end
|
||||
|
||||
it 'raises on non-matching result' do
|
||||
|
@ -54,17 +52,15 @@ describe AccountFinderConcern do
|
|||
end
|
||||
|
||||
describe 'remote finders' do
|
||||
before do
|
||||
@account = Fabricate(:account, username: 'Alice', domain: 'mastodon.social')
|
||||
end
|
||||
let!(:account) { Fabricate(:account, username: 'Alice', domain: 'mastodon.social') }
|
||||
|
||||
describe '.find_remote' do
|
||||
it 'returns exact match result' do
|
||||
expect(Account.find_remote('alice', 'mastodon.social')).to eq(@account)
|
||||
expect(Account.find_remote('alice', 'mastodon.social')).to eq(account)
|
||||
end
|
||||
|
||||
it 'returns case-insensitive result' do
|
||||
expect(Account.find_remote('ALICE', 'MASTODON.SOCIAL')).to eq(@account)
|
||||
expect(Account.find_remote('ALICE', 'MASTODON.SOCIAL')).to eq(account)
|
||||
end
|
||||
|
||||
it 'returns nil when username does not match' do
|
||||
|
@ -90,7 +86,7 @@ describe AccountFinderConcern do
|
|||
|
||||
describe '.find_remote!' do
|
||||
it 'returns matching result' do
|
||||
expect(Account.find_remote!('alice', 'mastodon.social')).to eq(@account)
|
||||
expect(Account.find_remote!('alice', 'mastodon.social')).to eq(account)
|
||||
end
|
||||
|
||||
it 'raises on non-matching result' do
|
||||
|
|
|
@ -648,38 +648,36 @@ describe AccountInteractions do
|
|||
end
|
||||
|
||||
describe 'ignoring reblogs from an account' do
|
||||
before do
|
||||
@me = Fabricate(:account, username: 'Me')
|
||||
@you = Fabricate(:account, username: 'You')
|
||||
end
|
||||
let!(:me) { Fabricate(:account, username: 'Me') }
|
||||
let!(:you) { Fabricate(:account, username: 'You') }
|
||||
|
||||
context 'with the reblogs option unspecified' do
|
||||
before do
|
||||
@me.follow!(@you)
|
||||
me.follow!(you)
|
||||
end
|
||||
|
||||
it 'defaults to showing reblogs' do
|
||||
expect(@me.muting_reblogs?(@you)).to be(false)
|
||||
expect(me.muting_reblogs?(you)).to be(false)
|
||||
end
|
||||
end
|
||||
|
||||
context 'with the reblogs option set to false' do
|
||||
before do
|
||||
@me.follow!(@you, reblogs: false)
|
||||
me.follow!(you, reblogs: false)
|
||||
end
|
||||
|
||||
it 'does mute reblogs' do
|
||||
expect(@me.muting_reblogs?(@you)).to be(true)
|
||||
expect(me.muting_reblogs?(you)).to be(true)
|
||||
end
|
||||
end
|
||||
|
||||
context 'with the reblogs option set to true' do
|
||||
before do
|
||||
@me.follow!(@you, reblogs: true)
|
||||
me.follow!(you, reblogs: true)
|
||||
end
|
||||
|
||||
it 'does not mute reblogs' do
|
||||
expect(@me.muting_reblogs?(@you)).to be(false)
|
||||
expect(me.muting_reblogs?(you)).to be(false)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue