Sha256: e239da7161094c777c24321ae57ea8a41c9e1aa67905941e2fc71d30b724145d

Contents?: true

Size: 787 Bytes

Versions: 3

Compression:

Stored size: 787 Bytes

Contents

require 'spec_helper'

module Brightcontent
  module Pages
    describe PathConstraint do
      describe "#expire" do
        it 'clear the cache' do
          expect(Rails.cache).to receive(:delete)
          PathConstraint.expire
        end
      end

      describe ".matches?" do
        before do
          PathConstraint.expire
          allow(Page).to receive(:pluck) { ['existing'] }
        end

        it 'returns true if path is existing' do
          request = double(:request, path: '/existing')
          expect(subject.matches?(request)).to eq true
        end
        it 'returns false if path is non-existing' do
          request = double(:request, path: '/nonexisting')
          expect(subject.matches?(request)).to eq false
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
brightcontent-pages-2.6.0 spec/lib/brightcontent/pages/path_constraint_spec.rb
brightcontent-pages-2.5.1 spec/lib/brightcontent/pages/path_constraint_spec.rb
brightcontent-pages-2.5.0 spec/lib/brightcontent/pages/path_constraint_spec.rb