tests: Disable the default `rc.lua` rules for the sake of testing.

This commit is contained in:
Emmanuel Lepage Vallee 2020-02-17 04:40:48 -05:00
parent e12b5fb097
commit f50a84b70b
2 changed files with 11 additions and 0 deletions

View File

@ -213,6 +213,15 @@ function module.add_rule_source(name, cb, ...)
return nrules:add_matching_function(name, cb, ...) return nrules:add_matching_function(name, cb, ...)
end end
-- Allow to clear the rules for testing purpose only.
-- Because multiple modules might set their rules, it is a bad idea to let
-- them be purged under their feet.
function module._clear()
for k in pairs(nrules._matching_rules["ruled.notifications"]) do
nrules._matching_rules["ruled.notifications"][k] = nil
end
end
-- Add signals. -- Add signals.
local conns = gobject._setup_class_signals(module) local conns = gobject._setup_class_signals(module)

View File

@ -5,6 +5,7 @@ local steps = {}
local naughty = require("naughty") local naughty = require("naughty")
local grect = require("gears.geometry").rectangle local grect = require("gears.geometry").rectangle
local rnotif = require("ruled.notification")
-- Do not use whatever `rc.lua` has. This avoids having to update the test -- Do not use whatever `rc.lua` has. This avoids having to update the test
-- every time. -- every time.
@ -72,6 +73,7 @@ end
-- Create notifications in each position. -- Create notifications in each position.
table.insert(steps, function() table.insert(steps, function()
rnotif._clear()
add_many(s1) add_many(s1)
return true return true