Sha256: d4e4ee78f3682aaecc04ff32c4cee92e91556de538f652522b97d50be40e5032

Contents?: true

Size: 787 Bytes

Versions: 21

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 be_true
        end
        it 'returns false if path is non-existing' do
          request = double(:request, path: '/nonexisting')
          expect(subject.matches?(request)).to be_false
        end
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
brightcontent-pages-2.1.0 spec/lib/brightcontent/pages/path_constraint_spec.rb