Skip to content

Commit

Permalink
policy: set version to 0.0 when not specified
Browse files Browse the repository at this point in the history
As the documentation of the method says.
  • Loading branch information
davidor committed Nov 14, 2017
1 parent 8075f69 commit 34d5a94
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion apicast/src/policy.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 }

Expand Down
5 changes: 5 additions & 0 deletions spec/policy_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand Down

0 comments on commit 34d5a94

Please sign in to comment.