diff --git a/spec/inspect_spec.lua b/spec/inspect_spec.lua index 74ed8d4..c16871c 100644 --- a/spec/inspect_spec.lua +++ b/spec/inspect_spec.lua @@ -182,39 +182,39 @@ describe( 'inspect', function() describe('the process option', function() - it('can be used to remove a particular element easily', function() + it('removes one element', function() local names = {'Andrew', 'Peter', 'Ann' } local removeAnn = function(item) if item ~= 'Ann' then return item end end assert.equals(inspect(names, {process = removeAnn}), '{ "Andrew", "Peter" }') end) - it('can use the path', function() + it('uses the path', function() local names = {'Andrew', 'Peter', 'Ann' } local removeThird = function(item, path) if path[1] ~= 3 then return item end end assert.equals(inspect(names, {process = removeThird}), '{ "Andrew", "Peter" }') end) - it('can replace values', function() + it('replaces items', function() local names = {'Andrew', 'Peter', 'Ann' } local filterAnn = function(item) return item == 'Ann' and '' or item end assert.equals(inspect(names, {process = filterAnn}), '{ "Andrew", "Peter", "" }') end) - it('can nullify metatables', function() + it('nullifies metatables', function() local mt = {'world'} local t = setmetatable({'hello'}, mt) local removeMt = function(item) if item ~= mt then return item end end assert.equals(inspect(t, {process = removeMt}), '{ "hello" }') end) - it('can nullify metatables via their paths', function() + it('nullifies metatables using their paths', function() local mt = {'world'} local t = setmetatable({'hello'}, mt) local removeMt = function(item, path) if path[#path] ~= '' then return item end end assert.equals(inspect(t, {process = removeMt}), '{ "hello" }') end) - it('can nullify the root object', function() + it('nullifies the root object', function() local names = {'Andrew', 'Peter', 'Ann' } local removeNames = function(item) if item ~= names then return item end end assert.equals(inspect(names, {process = removeNames}), 'nil')