aboutsummaryrefslogtreecommitdiff
path: root/spec/type_aliases/policies_spec.rb
blob: 6708aa4b56f8e072697deb40a2d36abe831eabef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# frozen_string_literal: true

require 'spec_helper'

describe 'Ferm::Policies' do
  describe 'valid values' do
    %w[
      ACCEPT
      DROP
    ].each do |value|
      describe value.inspect do
        it { is_expected.to allow_value(value) }
      end
    end
  end

  describe 'invalid values' do
    context 'with garbage inputs' do
      [
        'RETURN',
        'REJECT',
        'foobar',
        :symbol,
        nil,
        '',
        true,
        false,
        %w[meep meep],
        65_538,
        [95_000, 67_000],
        {},
        { 'foo' => 'bar' },
      ].each do |value|
        describe value.inspect do
          it { is_expected.not_to allow_value(value) }
        end
      end
    end
  end
end