media_privacy_check_spec.rb 813 B

123456789101112131415161718192021222324252627282930313233
  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. RSpec.describe Admin::SystemCheck::MediaPrivacyCheck do
  4. subject(:check) { described_class.new(user) }
  5. let(:user) { Fabricate(:user) }
  6. it_behaves_like 'a check available to devops users'
  7. describe 'pass?' do
  8. context 'when the media cannot be listed' do
  9. before do
  10. stub_request(:get, /ngrok.io/).to_return(status: 200, body: 'a list of no files')
  11. end
  12. it 'returns true' do
  13. expect(check.pass?).to be true
  14. end
  15. end
  16. end
  17. describe 'message' do
  18. it 'sends values to message instance' do
  19. allow(Admin::SystemCheck::Message).to receive(:new).with(nil, nil, nil, true)
  20. check.message
  21. expect(Admin::SystemCheck::Message).to have_received(:new).with(nil, nil, nil, true)
  22. end
  23. end
  24. end