闭社主体 forked from https://github.com/tootsuite/mastodon
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 lines
1.7 KiB

7 years ago
  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