Reduce factory usage across spec/services
area (#32098)
This commit is contained in:
parent
4fe7f213a6
commit
e4e07b1c34
21 changed files with 567 additions and 641 deletions
|
@ -10,13 +10,13 @@ RSpec.describe UnfollowService do
|
|||
describe 'local' do
|
||||
let(:bob) { Fabricate(:account, username: 'bob') }
|
||||
|
||||
before do
|
||||
sender.follow!(bob)
|
||||
subject.call(sender, bob)
|
||||
end
|
||||
before { sender.follow!(bob) }
|
||||
|
||||
it 'destroys the following relation' do
|
||||
expect(sender.following?(bob)).to be false
|
||||
subject.call(sender, bob)
|
||||
|
||||
expect(sender)
|
||||
.to_not be_following(bob)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -26,15 +26,15 @@ RSpec.describe UnfollowService do
|
|||
before do
|
||||
sender.follow!(bob)
|
||||
stub_request(:post, 'http://example.com/inbox').to_return(status: 200)
|
||||
end
|
||||
|
||||
it 'destroys the following relation and sends unfollow activity' do
|
||||
subject.call(sender, bob)
|
||||
end
|
||||
|
||||
it 'destroys the following relation' do
|
||||
expect(sender.following?(bob)).to be false
|
||||
end
|
||||
|
||||
it 'sends an unfollow activity' do
|
||||
expect(a_request(:post, 'http://example.com/inbox')).to have_been_made.once
|
||||
expect(sender)
|
||||
.to_not be_following(bob)
|
||||
expect(a_request(:post, 'http://example.com/inbox'))
|
||||
.to have_been_made.once
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -44,15 +44,15 @@ RSpec.describe UnfollowService do
|
|||
before do
|
||||
bob.follow!(sender)
|
||||
stub_request(:post, 'http://example.com/inbox').to_return(status: 200)
|
||||
end
|
||||
|
||||
it 'destroys the following relation and sends a reject activity' do
|
||||
subject.call(bob, sender)
|
||||
end
|
||||
|
||||
it 'destroys the following relation' do
|
||||
expect(bob.following?(sender)).to be false
|
||||
end
|
||||
|
||||
it 'sends a reject activity' do
|
||||
expect(a_request(:post, 'http://example.com/inbox')).to have_been_made.once
|
||||
expect(sender)
|
||||
.to_not be_following(bob)
|
||||
expect(a_request(:post, 'http://example.com/inbox'))
|
||||
.to have_been_made.once
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue