From 34d5a942d31287ccd18e9570b7742acf48a2c390 Mon Sep 17 00:00:00 2001 From: David Ortiz Date: Tue, 14 Nov 2017 11:43:05 +0100 Subject: [PATCH] policy: set version to 0.0 when not specified As the documentation of the method says. --- apicast/src/policy.lua | 2 +- spec/policy_spec.lua | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/apicast/src/policy.lua b/apicast/src/policy.lua index 663f2dc43..a9d43e7cb 100644 --- a/apicast/src/policy.lua +++ b/apicast/src/policy.lua @@ -20,7 +20,7 @@ local noop = function() end function _M.new(name, version) local policy = { _NAME = name, - _VERSION = version , + _VERSION = version or '0.0', } local mt = { __index = policy } diff --git a/spec/policy_spec.lua b/spec/policy_spec.lua index 6cf3e9031..b8e0a8bc1 100644 --- a/spec/policy_spec.lua +++ b/spec/policy_spec.lua @@ -23,6 +23,11 @@ describe('policy', function() assert.equals(my_policy_version, my_policy._VERSION) end) + it('set the version to 0.0 when not specified', function() + local my_policy = policy.new('my_policy') + assert.equals('0.0', my_policy._VERSION) + end) + it('defines a method for each of the nginx phases; they do nothing by default', function() local my_policy = policy.new('custom_authorizer')