activity_spec.rb 828 B

12345678910111213141516171819202122232425262728293031323334
  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. RSpec.describe 'Activity' do
  4. describe 'GET /api/v1/instance/activity' do
  5. context 'with activity api enabled' do
  6. before { Setting.activity_api_enabled = true }
  7. it 'returns http success' do
  8. get api_v1_instance_activity_path
  9. expect(response)
  10. .to have_http_status(200)
  11. expect(body_as_json)
  12. .to be_present
  13. .and(be_an(Array))
  14. .and(have_attributes(size: Api::V1::Instances::ActivityController::WEEKS_OF_ACTIVITY))
  15. end
  16. end
  17. context 'with activity api diabled' do
  18. before { Setting.activity_api_enabled = false }
  19. it 'returns not found' do
  20. get api_v1_instance_activity_path
  21. expect(response)
  22. .to have_http_status(404)
  23. end
  24. end
  25. end
  26. end