Sha256: d48254d7a436da85b7420c46ada78d03cb7266ac564a4460b01370d0adf06bd2

Contents?: true

Size: 881 Bytes

Versions: 4

Compression:

Stored size: 881 Bytes

Contents

require 'spec_helper'

describe HighVoltage::PagesController, '#cache_page' do
  let(:page_name) { :exists }

  context 'page_caching set to true' do
    after do
      set_page_caching_without_deprecation(false)
    end

    it 'caches the page' do
      allow(controller).to receive(:cache_page)
      set_page_caching_without_deprecation(true)

      get :show, id: page_name

      expect(controller).to have_received(:cache_page)
    end
  end

  context 'page_caching set to false' do
    it 'does not cache the page' do
      allow(controller).to receive(:cache_page)
      set_page_caching_without_deprecation(false)

      get :show, id: page_name

      expect(controller).not_to have_received(:cache_page)
    end
  end

  def set_page_caching_without_deprecation(value)
    ActiveSupport::Deprecation.silence do
      HighVoltage.page_caching = value
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
high_voltage-2.4.0 spec/controllers/page_caching_controller_spec.rb
high_voltage-2.3.0 spec/controllers/page_caching_controller_spec.rb
high_voltage-2.2.1 spec/controllers/page_caching_controller_spec.rb
high_voltage-2.2.0 spec/controllers/page_caching_controller_spec.rb