accounts_controller_spec.rb 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. require 'rails_helper'
  2. RSpec.describe AccountsController, type: :controller do
  3. render_views
  4. let(:alice) { Fabricate(:account, username: 'alice') }
  5. describe 'GET #show' do
  6. before do
  7. status1 = Status.create!(account: alice, text: 'Hello world')
  8. Status.create!(account: alice, text: 'Boop', thread: status1)
  9. status3 = Status.create!(account: alice, text: 'Picture!')
  10. status3.media_attachments.create!(account: alice, file: fixture_file_upload('files/attachment.jpg', 'image/jpeg'))
  11. Status.create!(account: alice, text: 'Mentioning @alice')
  12. end
  13. context 'atom' do
  14. before do
  15. get :show, params: { username: alice.username }, format: 'atom'
  16. end
  17. it 'returns http success with Atom' do
  18. expect(response).to have_http_status(:success)
  19. end
  20. end
  21. context 'activitystreams2' do
  22. before do
  23. get :show, params: { username: alice.username }, format: 'activitystreams2'
  24. end
  25. it 'returns http success with Activity Streams 2.0' do
  26. expect(response).to have_http_status(:success)
  27. end
  28. end
  29. context 'html' do
  30. before do
  31. get :show, params: { username: alice.username }
  32. end
  33. it 'returns http success' do
  34. expect(response).to have_http_status(:success)
  35. end
  36. end
  37. end
  38. describe 'GET #followers' do
  39. it 'returns http success' do
  40. get :followers, params: { username: alice.username }
  41. expect(response).to have_http_status(:success)
  42. end
  43. end
  44. describe 'GET #following' do
  45. it 'returns http success' do
  46. get :following, params: { username: alice.username }
  47. expect(response).to have_http_status(:success)
  48. end
  49. end
  50. end