The code powering m.abunchtell.com https://m.abunchtell.com
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 
 

36 wiersze
1.3 KiB

  1. require 'rails_helper'
  2. RSpec.describe Api::SalmonController, type: :controller do
  3. let(:account) { Fabricate(:account, username: 'catsrgr8', user: Fabricate(:user)) }
  4. before do
  5. stub_request(:get, "https://quitter.no/.well-known/host-meta").to_return(request_fixture('.host-meta.txt'))
  6. stub_request(:get, "https://quitter.no/.well-known/webfinger?resource=acct:gargron@quitter.no").to_return(request_fixture('webfinger.txt'))
  7. stub_request(:get, "https://quitter.no/api/statuses/user_timeline/7477.atom").to_return(request_fixture('feed.txt'))
  8. stub_request(:get, "https://quitter.no/avatar/7477-300-20160211190340.png").to_return(request_fixture('avatar.txt'))
  9. end
  10. describe 'POST #update' do
  11. before do
  12. request.env['RAW_POST_DATA'] = File.read(File.join(Rails.root, 'spec', 'fixtures', 'salmon', 'mention.xml'))
  13. post :update, id: account.id
  14. end
  15. it 'returns http success' do
  16. expect(response).to have_http_status(:success)
  17. end
  18. it 'creates remote account' do
  19. expect(Account.find_by(username: 'gargron', domain: 'quitter.no')).to_not be_nil
  20. end
  21. it 'creates status' do
  22. expect(Status.find_by(uri: 'tag:quitter.no,2016-03-20:noticeId=1276923:objectType=note')).to_not be_nil
  23. end
  24. it 'creates mention for target account' do
  25. expect(account.mentions.count).to eq 1
  26. end
  27. end
  28. end