Sha256: 0d138e265af7b2fb47e58a9c3f5bedcf2124a1c0397d31c9b77e13c91aeccf44

Contents?: true

Size: 1.32 KB

Versions: 5

Compression:

Stored size: 1.32 KB

Contents

require 'spec_helper'

module Sparrow
  describe RouteParser, type: :unit do
    describe '#excluded routes' do
      it 'should default to the excluded routes from the configuration' do

      end

      it 'should be set to the value given in the constructor as regexes' do
        expected = [/panda/, /bamboo/]
        actual = RouteParser.new(expected).excluded_routes
        expect(actual).to eq expected
      end
    end

    describe '#exclude?' do
      it 'should return true if the path is in the excluded routes' do
        path = '/panda'
        route_parser = RouteParser.new(['panda'])
        expect(route_parser.exclude?(path)).to eq true
      end

      it 'should return false if the path is not in the excluded routes' do
        path = '/panda'
        route_parser = RouteParser.new([])
        expect(route_parser.exclude?(path)).to eq false
      end
    end

    describe '#allow?' do
      it 'should return false if the path is in the excluded routes' do
        path = '/panda'
        route_parser = RouteParser.new(['panda'])
        expect(route_parser.allow?(path)).to eq false
      end

      it 'should return true if the path is not in the excluded routes' do
        path = '/panda'
        route_parser = RouteParser.new([])
        expect(route_parser.allow?(path)).to eq true
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
cp-sparrow-0.0.16 spec/unit/route_parser_spec.rb
cp-sparrow-0.0.15 spec/unit/route_parser_spec.rb
cp-sparrow-0.0.14 spec/unit/route_parser_spec.rb
cp-sparrow-0.0.12 spec/unit/route_parser_spec.rb
cp-sparrow-0.0.11 spec/unit/route_parser_spec.rb