aboutsummaryrefslogtreecommitdiff
path: root/spec/type_aliases/actions_spec.rb
diff options
context:
space:
mode:
authorThore Bödecker <me@foxxx0.de>2020-06-30 17:41:09 +0200
committerThore Bödecker <me@foxxx0.de>2020-06-30 18:05:52 +0200
commit1fc98345fae1cf48e1891b59e2faf4823246aa76 (patch)
tree0d7b70fc52d707a36c94360b72da2e2dd728d7fb /spec/type_aliases/actions_spec.rb
parent856eca997158141e084b9e8c2002d7491a4720a1 (diff)
downloadpuppet-ferm-1fc98345fae1cf48e1891b59e2faf4823246aa76.tar.gz
puppet-ferm-1fc98345fae1cf48e1891b59e2faf4823246aa76.tar.bz2
add type_aliases tests for the other ferm types
Diffstat (limited to 'spec/type_aliases/actions_spec.rb')
-rw-r--r--spec/type_aliases/actions_spec.rb46
1 files changed, 46 insertions, 0 deletions
diff --git a/spec/type_aliases/actions_spec.rb b/spec/type_aliases/actions_spec.rb
new file mode 100644
index 0000000..9c42e12
--- /dev/null
+++ b/spec/type_aliases/actions_spec.rb
@@ -0,0 +1,46 @@
+# rubocop:disable Style/WordArray, Style/TrailingCommaInLiteral
+require 'spec_helper'
+
+describe 'Ferm::Actions' do
+ describe 'valid values' do
+ [
+ 'RETURN',
+ 'ACCEPT',
+ 'DROP',
+ 'REJECT',
+ 'NOTRACK',
+ 'LOG',
+ 'MARK',
+ 'DNAT',
+ 'SNAT',
+ 'MASQUERADE',
+ 'REDIRECT',
+ 'MYFANCYCUSTOMCHAINNAMEISALSOVALID',
+ ].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
+ [
+ # :symbol, # this should not match but seems liks String[1] allows it?
+ # nil, # this should not match but seems liks String[1] allows it?
+ '',
+ true,
+ false,
+ ['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