Sha256: e9998aefc236f673e181cdc12bc4db694a56bd93b83279cfe994df3bc3a0a902

Contents?: true

Size: 832 Bytes

Versions: 1

Compression:

Stored size: 832 Bytes

Contents

require 'spec_helper'

describe SolidusStaticContent::RouteMatcher do
  subject { described_class }

  context '.matches?' do
    it 'is true when valid page' do
      page = create(:page, slug: 'hello', visible: true)
      request = instance_double(Rack::Request, path_info: page.slug)
      expect(subject.matches?(request)).to be true
    end

    it 'is false when using reserved slug name' do
      page = create(:page, slug: 'login', visible: true)
      request = instance_double(Rack::Request, path_info: page.slug)
      expect(subject.matches?(request)).to be false
    end

    it 'is false when page is not accessible' do
      page = create(:page, slug: 'hello', visible: false)
      request = instance_double(Rack::Request, path_info: page.slug)
      expect(subject.matches?(request)).to be false
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
solidus_static_content-2.0.0 spec/lib/solidus_static_content/route_matcher_spec.rb