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.4.6 spec/lib/brightcontent/pages/path_constraint_spec.rb
brightcontent-pages-2.4.5 spec/lib/brightcontent/pages/path_constraint_spec.rb
brightcontent-pages-2.4.4 spec/lib/brightcontent/pages/path_constraint_spec.rb
brightcontent-pages-2.4.3 spec/lib/brightcontent/pages/path_constraint_spec.rb
brightcontent-pages-2.4.2 spec/lib/brightcontent/pages/path_constraint_spec.rb
brightcontent-pages-2.4.1 spec/lib/brightcontent/pages/path_constraint_spec.rb
brightcontent-pages-2.4.0 spec/lib/brightcontent/pages/path_constraint_spec.rb
brightcontent-pages-2.3.4 spec/lib/brightcontent/pages/path_constraint_spec.rb
brightcontent-pages-2.3.3 spec/lib/brightcontent/pages/path_constraint_spec.rb
brightcontent-pages-2.3.2 spec/lib/brightcontent/pages/path_constraint_spec.rb
brightcontent-pages-2.3.1 spec/lib/brightcontent/pages/path_constraint_spec.rb
brightcontent-pages-2.3.0 spec/lib/brightcontent/pages/path_constraint_spec.rb
brightcontent-pages-2.2.2 spec/lib/brightcontent/pages/path_constraint_spec.rb
brightcontent-pages-2.2.1 spec/lib/brightcontent/pages/path_constraint_spec.rb
brightcontent-pages-2.2.0 spec/lib/brightcontent/pages/path_constraint_spec.rb
brightcontent-pages-2.1.5 spec/lib/brightcontent/pages/path_constraint_spec.rb
brightcontent-pages-2.1.4 spec/lib/brightcontent/pages/path_constraint_spec.rb
brightcontent-pages-2.1.3 spec/lib/brightcontent/pages/path_constraint_spec.rb
brightcontent-pages-2.1.2 spec/lib/brightcontent/pages/path_constraint_spec.rb
brightcontent-pages-2.1.1 spec/lib/brightcontent/pages/path_constraint_spec.rb