sources_controller_spec.rb 780 B

1234567891011121314151617181920212223242526272829
  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. describe Api::V1::Statuses::SourcesController do
  4. render_views
  5. let(:user) { Fabricate(:user) }
  6. let(:app) { Fabricate(:application, name: 'Test app', website: 'http://testapp.com') }
  7. let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: 'read:statuses', application: app) }
  8. context 'with an oauth token' do
  9. before do
  10. allow(controller).to receive(:doorkeeper_token) { token }
  11. end
  12. describe 'GET #show' do
  13. let(:status) { Fabricate(:status, account: user.account) }
  14. before do
  15. get :show, params: { status_id: status.id }
  16. end
  17. it 'returns http success' do
  18. expect(response).to have_http_status(200)
  19. end
  20. end
  21. end
  22. end