Sha256: 8f270222862347852e3cda623277f811074a73658130d56240a45dbe974e92cb

Contents?: true

Size: 1.12 KB

Versions: 13

Compression:

Stored size: 1.12 KB

Contents

require 'spec_helper'

require_relative '../../../lib/locomotive/steam/middlewares/thread_safe'
require_relative '../../../lib/locomotive/steam/middlewares/helpers'
require_relative '../../../lib/locomotive/steam/middlewares/renderer'

describe Locomotive::Steam::Middlewares::Renderer do

  let(:app) { ->(env) { [200, env, 'app'] }}

  let(:middleware) { described_class.new(app) }

  describe 'missing 404 page' do

    let(:locale)  { 'en' }
    let(:site)    { instance_double('Site', default_locale: 'en') }

    subject do
      middleware.call env_for('http://www.example.com', { 'steam.page' => nil, 'steam.locale' => locale, 'steam.site' => site })
    end

    specify 'return 404' do
      code, headers, response = subject
      expect(code).to eq(404)
      expect(response).to eq(["Your 404 page is missing. Please create it."])
    end

    context 'in another locale' do

      let(:locale) { 'fr' }

      specify 'return 200' do
        code, headers, response = subject
        expect(code).to eq(404)
        expect(response).to eq(["Your 404 page is missing in the fr locale. Please create it."])
      end

    end

  end

end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
locomotivecms_steam-1.4.1 spec/unit/middlewares/renderer_spec.rb
locomotivecms_steam-1.4.0 spec/unit/middlewares/renderer_spec.rb
locomotivecms_steam-1.4.0.rc2 spec/unit/middlewares/renderer_spec.rb
locomotivecms_steam-1.4.0.rc1 spec/unit/middlewares/renderer_spec.rb
locomotivecms_steam-1.4.0.pre.rc.1 spec/unit/middlewares/renderer_spec.rb
locomotivecms_steam-1.3.0 spec/unit/middlewares/renderer_spec.rb
locomotivecms_steam-1.3.0.rc2 spec/unit/middlewares/renderer_spec.rb
locomotivecms_steam-1.2.1 spec/unit/middlewares/renderer_spec.rb
locomotivecms_steam-1.3.0.rc1 spec/unit/middlewares/renderer_spec.rb
locomotivecms_steam-1.2.0 spec/unit/middlewares/renderer_spec.rb
locomotivecms_steam-1.2.0.rc3 spec/unit/middlewares/renderer_spec.rb
locomotivecms_steam-1.2.0.rc2 spec/unit/middlewares/renderer_spec.rb
locomotivecms_steam-1.2.0.rc1 spec/unit/middlewares/renderer_spec.rb