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.

41 lines
1.0 KiB

  1. require 'rails_helper'
  2. RSpec.describe Api::V1::MutesController, type: :controller do
  3. render_views
  4. let(:user) { Fabricate(:user, account: Fabricate(:account, username: 'alice')) }
  5. let(:token) { Fabricate(:accessible_access_token, resource_owner_id: user.id, scopes: 'follow') }
  6. before do
  7. Fabricate(:mute, account: user.account, hide_notifications: false)
  8. allow(controller).to receive(:doorkeeper_token) { token }
  9. end
  10. describe 'GET #index' do
  11. it 'returns http success' do
  12. get :index, params: { limit: 1 }
  13. expect(response).to have_http_status(200)
  14. end
  15. end
  16. describe 'GET #details' do
  17. before do
  18. get :details, params: { limit: 1 }
  19. end
  20. let(:mutes) { JSON.parse(response.body) }
  21. it 'returns http success' do
  22. expect(response).to have_http_status(:success)
  23. end
  24. it 'returns one mute' do
  25. expect(mutes.size).to be(1)
  26. end
  27. it 'returns whether the mute hides notifications' do
  28. expect(mutes.first["hide_notifications"]).to be(false)
  29. end
  30. end
  31. end