logo

mastofe

My custom branche(s) on git.pleroma.social/pleroma/mastofe git clone https://hacktivis.me/git/mastofe.git

tag_controller_spec.rb (1099B)


  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. describe Api::V1::Timelines::TagController do
  4. render_views
  5. let(:user) { Fabricate(:user, account: Fabricate(:account, username: 'alice')) }
  6. before do
  7. allow(controller).to receive(:doorkeeper_token) { token }
  8. end
  9. context 'with a user context' do
  10. let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id) }
  11. describe 'GET #show' do
  12. before do
  13. PostStatusService.new.call(user.account, 'It is a #test')
  14. end
  15. it 'returns http success' do
  16. get :show, params: { id: 'test' }
  17. expect(response).to have_http_status(:success)
  18. expect(response.headers['Link'].links.size).to eq(2)
  19. end
  20. end
  21. end
  22. context 'without a user context' do
  23. let(:token) { Fabricate(:accessible_access_token, resource_owner_id: nil) }
  24. describe 'GET #show' do
  25. it 'returns http success' do
  26. get :show, params: { id: 'test' }
  27. expect(response).to have_http_status(:success)
  28. expect(response.headers['Link']).to be_nil
  29. end
  30. end
  31. end
  32. end