strikes_controller_spec.rb 752 B

1234567891011121314151617181920212223242526272829303132
  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. RSpec.describe Disputes::StrikesController do
  4. render_views
  5. before { sign_in current_user, scope: :user }
  6. describe '#show' do
  7. let(:current_user) { Fabricate(:user) }
  8. let(:strike) { Fabricate(:account_warning, target_account: current_user.account) }
  9. before do
  10. get :show, params: { id: strike.id }
  11. end
  12. context 'when meant for the user' do
  13. it 'returns http success' do
  14. expect(response).to have_http_status(:success)
  15. end
  16. end
  17. context 'when meant for a different user' do
  18. let(:strike) { Fabricate(:account_warning) }
  19. it 'returns http forbidden' do
  20. expect(response).to have_http_status(403)
  21. end
  22. end
  23. end
  24. end