Sha256: 312f4483ee2ee7542337c81bffb1d875834b8c088af44656f807acd61ac2261f

Contents?: true

Size: 612 Bytes

Versions: 2

Compression:

Stored size: 612 Bytes

Contents

require 'rails_helper'

RSpec.describe ApplicationController, type: :controller do
  controller do
    def index
      raise TbCore::NotFoundError
    end
  end

  describe '#check_for_applicable_redirect' do
    it 'should redirect' do
      FactoryBot.create(:tb_redirect, source: '/anonymous', destination: '/redirected')
      get :index
      expect(response).to redirect_to('/redirected')
    end

    it 'should not redirect' do
      FactoryBot.create(:tb_redirect, source: '/other', destination: '/redirected')
      get :index
      expect(response).to_not redirect_to('/redirected')
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tb_redirects-1.0.3 spec/controllers/application_controller_spec.rb
tb_redirects-1.0.2 spec/controllers/application_controller_spec.rb