The code powering m.abunchtell.com https://m.abunchtell.com
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

42 lines
1.2 KiB

  1. require 'rails_helper'
  2. RSpec.describe UnblockService do
  3. let(:sender) { Fabricate(:account, username: 'alice') }
  4. subject { UnblockService.new }
  5. describe 'local' do
  6. let(:bob) { Fabricate(:user, email: 'bob@example.com', account: Fabricate(:account, username: 'bob')).account }
  7. before do
  8. sender.block!(bob)
  9. subject.call(sender, bob)
  10. end
  11. it 'destroys the blocking relation' do
  12. expect(sender.blocking?(bob)).to be false
  13. end
  14. end
  15. describe 'remote' do
  16. let(:bob) { Fabricate(:user, email: 'bob@example.com', account: Fabricate(:account, username: 'bob', domain: 'example.com', salmon_url: 'http://salmon.example.com')).account }
  17. before do
  18. sender.block!(bob)
  19. stub_request(:post, "http://salmon.example.com/").to_return(:status => 200, :body => "", :headers => {})
  20. subject.call(sender, bob)
  21. end
  22. it 'destroys the blocking relation' do
  23. expect(sender.following?(bob)).to be false
  24. end
  25. it 'sends an unblock salmon slap' do
  26. expect(a_request(:post, "http://salmon.example.com/").with { |req|
  27. xml = OStatus2::Salmon.new.unpack(req.body)
  28. xml.match(TagManager::VERBS[:unblock])
  29. }).to have_been_made.once
  30. end
  31. end
  32. end