Sha256: 12fdc274c690a923c2af66f616fdc738c85dd25f9b698ba3abdd5bc3690a1092

Contents?: true

Size: 827 Bytes

Versions: 5

Compression:

Stored size: 827 Bytes

Contents

require 'spec_helper'

describe Kms::Public::PagesController, type: :controller do

  describe 'GET show' do
    context 'when page was found' do

    end

    context 'when page not found' do
      context 'when special 404 page exists' do
        it 'returns 404 page content' do
          page_404 = FactoryGirl.create(:page_404)
          get :show, params: { path: 'blabla' }
          expect(response.status).to eq(404)
          expect(response.body).to include('Not Found')
        end
      end
      context 'when no special 404 page' do
        it 'returns 404.html from public folder' do
          get :show, params: { path: '/blabla' }
          expect(response.status).to eq(404)
          expect(response.body).to eq(File.read(File.join(Rails.root, 'public/404.html')))
        end
      end

    end
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
kms-1.2.1 spec/controllers/kms/public/pages_controller_spec.rb
kms-1.2.0 spec/controllers/kms/public/pages_controller_spec.rb
kms-1.1.0 spec/controllers/kms/public/pages_controller_spec.rb
kms-1.0.1 spec/controllers/kms/public/pages_controller_spec.rb
kms-1.0.0 spec/controllers/kms/public/pages_controller_spec.rb