Sha256: a27f1fa993e9a7759e9b494f99ddca5e6a72c572d53270b491c22309652cf99a

Contents?: true

Size: 612 Bytes

Versions: 3

Compression:

Stored size: 612 Bytes

Contents

require 'rails_helper'

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

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

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
tb_redirects-1.0.1 spec/controllers/application_controller_spec.rb
tb_redirects-1.0 spec/controllers/application_controller_spec.rb
tb_redirects-1.0.beta1 spec/controllers/application_controller_spec.rb