1
0

strikes_controller_spec.rb 747 B

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