Sha256: ca334efed7232d1bccc0864a443239384f01f7ce5b0d491771917ffb278109d7
Contents?: true
Size: 1.68 KB
Versions: 1
Compression:
Stored size: 1.68 KB
Contents
require 'rails_helper' module Whoopsie RSpec.describe ErrorsController, type: :controller do routes { Whoopsie::Engine.routes } context '.ping' do it 'returns a 200 status' do get :ping expect(response).to be_success end end # This method allows you to test Whoopsie from within your live application. context '.bang' do it 'raises an error' do expect do get :bang end.to raise_error(RuntimeError) end end context '.create' do let(:valid_params) do { error_report: { message: 'I made a terrible mistake!', }, extra: 'And it is what it is.' } end context 'when Whoopsie is enabled' do before do Rails.application.config.whoopsie.enable = true end context 'with valid params' do it 'returns a 200 status' do post :create, valid_params expect(response).to be_ok end it 'calls .notify_exception' do expect(ExceptionNotifier).to receive(:notify_exception) post :create, valid_params end end context 'with missing params' do it 'raises an exception' do expect do post :create end.to raise_error(ActionController::ParameterMissing) end end end context 'when Whoopsie is disabled' do before do Rails.application.config.whoopsie.enable = false end it 'returns a 202 status' do post :create, valid_params expect(response).to be_accepted end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
whoopsie-0.0.2 | spec/controllers/whoopsie/errors_controller_spec.rb |