@ -13,14 +13,14 @@ describe AccountInteractions do
describe '.following_map' do
subject { Account . following_map ( target_account_ids , account_id ) }
context ' a ccount with Follow' do
context ' when A ccount with Follow' do
it 'returns { target_account_id => true }' do
Fabricate ( :follow , account : account , target_account : target_account )
expect ( subject ) . to eq ( target_account_id = > { reblogs : true , notify : false , languages : nil } )
end
end
context ' a ccount without Follow' do
context ' when A ccount without Follow' do
it 'returns {}' do
expect ( subject ) . to eq ( { } )
end
@ -30,14 +30,14 @@ describe AccountInteractions do
describe '.followed_by_map' do
subject { Account . followed_by_map ( target_account_ids , account_id ) }
context ' a ccount with Follow' do
context ' when A ccount with Follow' do
it 'returns { target_account_id => true }' do
Fabricate ( :follow , account : target_account , target_account : account )
expect ( subject ) . to eq ( target_account_id = > true )
end
end
context ' a ccount without Follow' do
context ' when A ccount without Follow' do
it 'returns {}' do
expect ( subject ) . to eq ( { } )
end
@ -47,14 +47,14 @@ describe AccountInteractions do
describe '.blocking_map' do
subject { Account . blocking_map ( target_account_ids , account_id ) }
context ' a ccount with Block' do
context ' when A ccount with Block' do
it 'returns { target_account_id => true }' do
Fabricate ( :block , account : account , target_account : target_account )
expect ( subject ) . to eq ( target_account_id = > true )
end
end
context ' a ccount without Block' do
context ' when A ccount without Block' do
it 'returns {}' do
expect ( subject ) . to eq ( { } )
end
@ -64,12 +64,12 @@ describe AccountInteractions do
describe '.muting_map' do
subject { Account . muting_map ( target_account_ids , account_id ) }
context ' a ccount with Mute' do
context ' when A ccount with Mute' do
before do
Fabricate ( :mute , target_account : target_account , account : account , hide_notifications : hide )
end
context ' if Mute#hide_notifications?' do
context ' when Mute#hide_notifications?' do
let ( :hide ) { true }
it 'returns { target_account_id => { notifications: true } }' do
@ -77,7 +77,7 @@ describe AccountInteractions do
end
end
context ' unless Mute#hide_notifications?' do
context ' when not Mute#hide_notifications?' do
let ( :hide ) { false }
it 'returns { target_account_id => { notifications: false } }' do
@ -86,7 +86,7 @@ describe AccountInteractions do
end
end
context ' a ccount without Mute' do
context ' when A ccount without Mute' do
it 'returns {}' do
expect ( subject ) . to eq ( { } )
end
@ -112,8 +112,8 @@ describe AccountInteractions do
describe '#mute!' do
subject { account . mute! ( target_account , notifications : arg_notifications ) }
context ' Mute does not exist yet' do
context ' arg :notifications is nil' do
context ' when Mute does not exist yet' do
context ' when arg :notifications is nil' do
let ( :arg_notifications ) { nil }
it 'creates Mute, and returns Mute' do
@ -123,7 +123,7 @@ describe AccountInteractions do
end
end
context ' arg :notifications is false' do
context ' when arg :notifications is false' do
let ( :arg_notifications ) { false }
it 'creates Mute, and returns Mute' do
@ -133,7 +133,7 @@ describe AccountInteractions do
end
end
context ' arg :notifications is true' do
context ' when arg :notifications is true' do
let ( :arg_notifications ) { true }
it 'creates Mute, and returns Mute' do
@ -144,7 +144,7 @@ describe AccountInteractions do
end
end
context ' Mute already exists' do
context ' when Mute already exists' do
before do
account . mute_relationships << mute
end
@ -156,10 +156,10 @@ describe AccountInteractions do
hide_notifications : hide_notifications )
end
context ' mute.hide_notifications is true' do
context ' when mute.hide_notifications is true' do
let ( :hide_notifications ) { true }
context ' arg :notifications is nil' do
context ' when arg :notifications is nil' do
let ( :arg_notifications ) { nil }
it 'returns Mute without updating mute.hide_notifications' do
@ -169,7 +169,7 @@ describe AccountInteractions do
end
end
context ' arg :notifications is false' do
context ' when arg :notifications is false' do
let ( :arg_notifications ) { false }
it 'returns Mute, and updates mute.hide_notifications false' do
@ -179,7 +179,7 @@ describe AccountInteractions do
end
end
context ' arg :notifications is true' do
context ' when arg :notifications is true' do
let ( :arg_notifications ) { true }
it 'returns Mute without updating mute.hide_notifications' do
@ -190,10 +190,10 @@ describe AccountInteractions do
end
end
context ' mute.hide_notifications is false' do
context ' when mute.hide_notifications is false' do
let ( :hide_notifications ) { false }
context ' arg :notifications is nil' do
context ' when arg :notifications is nil' do
let ( :arg_notifications ) { nil }
it 'returns Mute, and updates mute.hide_notifications true' do
@ -203,7 +203,7 @@ describe AccountInteractions do
end
end
context ' arg :notifications is false' do
context ' when arg :notifications is false' do
let ( :arg_notifications ) { false }
it 'returns Mute without updating mute.hide_notifications' do
@ -213,7 +213,7 @@ describe AccountInteractions do
end
end
context ' arg :notifications is true' do
context ' when arg :notifications is true' do
let ( :arg_notifications ) { true }
it 'returns Mute, and updates mute.hide_notifications true' do
@ -253,7 +253,7 @@ describe AccountInteractions do
describe '#unfollow!' do
subject { account . unfollow! ( target_account ) }
context ' following target_account' do
context ' when following target_account' do
it 'returns destroyed Follow' do
account . active_relationships . create ( target_account : target_account )
expect ( subject ) . to be_a Follow
@ -261,7 +261,7 @@ describe AccountInteractions do
end
end
context ' not following target_account' do
context ' when not following target_account' do
it 'returns nil' do
expect ( subject ) . to be_nil
end
@ -271,7 +271,7 @@ describe AccountInteractions do
describe '#unblock!' do
subject { account . unblock! ( target_account ) }
context ' blocking target_account' do
context ' when blocking target_account' do
it 'returns destroyed Block' do
account . block_relationships . create ( target_account : target_account )
expect ( subject ) . to be_a Block
@ -279,7 +279,7 @@ describe AccountInteractions do
end
end
context ' not blocking target_account' do
context ' when not blocking target_account' do
it 'returns nil' do
expect ( subject ) . to be_nil
end
@ -289,7 +289,7 @@ describe AccountInteractions do
describe '#unmute!' do
subject { account . unmute! ( target_account ) }
context ' muting target_account' do
context ' when muting target_account' do
it 'returns destroyed Mute' do
account . mute_relationships . create ( target_account : target_account )
expect ( subject ) . to be_a Mute
@ -297,7 +297,7 @@ describe AccountInteractions do
end
end
context ' not muting target_account' do
context ' when not muting target_account' do
it 'returns nil' do
expect ( subject ) . to be_nil
end
@ -309,7 +309,7 @@ describe AccountInteractions do
let ( :conversation ) { Fabricate ( :conversation ) }
context ' muting the conversation' do
context ' when muting the conversation' do
it 'returns destroyed ConversationMute' do
account . conversation_mutes . create ( conversation : conversation )
expect ( subject ) . to be_a ConversationMute
@ -317,7 +317,7 @@ describe AccountInteractions do
end
end
context ' not muting the conversation' do
context ' when not muting the conversation' do
it 'returns nil' do
expect ( subject ) . to be_nil
end
@ -329,7 +329,7 @@ describe AccountInteractions do
let ( :domain ) { 'example.com' }
context ' blocking the domain' do
context ' when blocking the domain' do
it 'returns destroyed AccountDomainBlock' do
account_domain_block = Fabricate ( :account_domain_block , domain : domain )
account . domain_blocks << account_domain_block
@ -338,7 +338,7 @@ describe AccountInteractions do
end
end
context ' unblocking the domain' do
context ' when unblocking the domain' do
it 'returns nil' do
expect ( subject ) . to be_nil
end
@ -348,14 +348,14 @@ describe AccountInteractions do
describe '#following?' do
subject { account . following? ( target_account ) }
context ' following target_account' do
context ' when following target_account' do
it 'returns true' do
account . active_relationships . create ( target_account : target_account )
expect ( subject ) . to be true
end
end
context ' not following target_account' do
context ' when not following target_account' do
it 'returns false' do
expect ( subject ) . to be false
end
@ -365,14 +365,14 @@ describe AccountInteractions do
describe '#followed_by?' do
subject { account . followed_by? ( target_account ) }
context ' followed by target_account' do
context ' when followed by target_account' do
it 'returns true' do
account . passive_relationships . create ( account : target_account )
expect ( subject ) . to be true
end
end
context ' not followed by target_account' do
context ' when not followed by target_account' do
it 'returns false' do
expect ( subject ) . to be false
end
@ -382,14 +382,14 @@ describe AccountInteractions do
describe '#blocking?' do
subject { account . blocking? ( target_account ) }
context ' blocking target_account' do
context ' when blocking target_account' do
it 'returns true' do
account . block_relationships . create ( target_account : target_account )
expect ( subject ) . to be true
end
end
context ' not blocking target_account' do
context ' when not blocking target_account' do
it 'returns false' do
expect ( subject ) . to be false
end
@ -401,7 +401,7 @@ describe AccountInteractions do
let ( :domain ) { 'example.com' }
context ' blocking the domain' do
context ' when blocking the domain' do
it 'returns true' do
account_domain_block = Fabricate ( :account_domain_block , domain : domain )
account . domain_blocks << account_domain_block
@ -409,7 +409,7 @@ describe AccountInteractions do
end
end
context ' not blocking the domain' do
context ' when not blocking the domain' do
it 'returns false' do
expect ( subject ) . to be false
end
@ -419,7 +419,7 @@ describe AccountInteractions do
describe '#muting?' do
subject { account . muting? ( target_account ) }
context ' muting target_account' do
context ' when muting target_account' do
it 'returns true' do
mute = Fabricate ( :mute , account : account , target_account : target_account )
account . mute_relationships << mute
@ -427,7 +427,7 @@ describe AccountInteractions do
end
end
context ' not muting target_account' do
context ' when not muting target_account' do
it 'returns false' do
expect ( subject ) . to be false
end
@ -439,14 +439,14 @@ describe AccountInteractions do
let ( :conversation ) { Fabricate ( :conversation ) }
context ' muting the conversation' do
context ' when muting the conversation' do
it 'returns true' do
account . conversation_mutes . create ( conversation : conversation )
expect ( subject ) . to be true
end
end
context ' not muting the conversation' do
context ' when not muting the conversation' do
it 'returns false' do
expect ( subject ) . to be false
end
@ -461,7 +461,7 @@ describe AccountInteractions do
account . mute_relationships << mute
end
context ' muting notifications of target_account' do
context ' when muting notifications of target_account' do
let ( :hide ) { true }
it 'returns true' do
@ -469,7 +469,7 @@ describe AccountInteractions do
end
end
context ' not muting notifications of target_account' do
context ' when not muting notifications of target_account' do
let ( :hide ) { false }
it 'returns false' do
@ -481,14 +481,14 @@ describe AccountInteractions do
describe '#requested?' do
subject { account . requested? ( target_account ) }
context ' requested by target_account' do
context ' with requested by target_account' do
it 'returns true' do
Fabricate ( :follow_request , account : account , target_account : target_account )
expect ( subject ) . to be true
end
end
context ' not requested by target_account' do
context ' when not requested by target_account' do
it 'returns false' do
expect ( subject ) . to be false
end
@ -500,7 +500,7 @@ describe AccountInteractions do
let ( :status ) { Fabricate ( :status , account : account , favourites : favourites ) }
context ' favorited' do
context ' when favorited' do
let ( :favourites ) { [ Fabricate ( :favourite , account : account ) ] }
it 'returns true' do
@ -508,7 +508,7 @@ describe AccountInteractions do
end
end
context ' not favorited' do
context ' when not favorited' do
let ( :favourites ) { [ ] }
it 'returns false' do
@ -522,7 +522,7 @@ describe AccountInteractions do
let ( :status ) { Fabricate ( :status , account : account , reblogs : reblogs ) }
context ' reblogged' do
context ' with reblogged' do
let ( :reblogs ) { [ Fabricate ( :status , account : account ) ] }
it 'returns true' do
@ -530,7 +530,7 @@ describe AccountInteractions do
end
end
context ' not reblogged' do
context ' when not reblogged' do
let ( :reblogs ) { [ ] }
it 'returns false' do
@ -544,14 +544,14 @@ describe AccountInteractions do
let ( :status ) { Fabricate ( :status , account : account ) }
context ' pinned' do
context ' when pinned' do
it 'returns true' do
Fabricate ( :status_pin , account : account , status : status )
expect ( subject ) . to be true
end
end
context ' not pinned' do
context ' when not pinned' do
it 'returns false' do
expect ( subject ) . to be false
end