diff --git a/FORMULAS-BACKLOG-AND-FEATURE-IDEAS.md b/FORMULAS-BACKLOG-AND-FEATURE-IDEAS.md index 114837f85..dac8d0202 100644 --- a/FORMULAS-BACKLOG-AND-FEATURE-IDEAS.md +++ b/FORMULAS-BACKLOG-AND-FEATURE-IDEAS.md @@ -12,7 +12,7 @@ * [x] don't run more tests than need be if there is already failure in this formula's batch. * [x] syntax validate thata formula only has one check in it - a. [ ] need to make this more thorough... right now the only test oft his feature checks a + a. [ ] need to make this more thorough... right now the only test of this feature checks a simple provided case, but needs to work with against-background, background and other more interesting cases diff --git a/src/midje/ideas/formulas.clj b/src/midje/ideas/formulas.clj index a49bfc384..4345c79e4 100644 --- a/src/midje/ideas/formulas.clj +++ b/src/midje/ideas/formulas.clj @@ -67,7 +67,7 @@ ~conclusion-signal))))) (defn- check-part-of [form] - (take-while #(not (and (named? %) (= "provided" (name %)))) + (take-while #(not (and (named? %) (#{"provided" "against-background"} (name %)))) (flatten form))) (defmethod validate "formula" [[_formula_ & args :as form]] diff --git a/test/midje/ideas/t_formulas.clj b/test/midje/ideas/t_formulas.clj index 5460d8e0f..46fe50c67 100644 --- a/test/midje/ideas/t_formulas.clj +++ b/test/midje/ideas/t_formulas.clj @@ -14,8 +14,19 @@ (formula [a 1] 1) (formula "vector fact" [a 1] (contains 3)) (formula "vector fact" [a 1] (contains 3)) - (formula "vector fact" [a 1] (contains 3) - (provided (h anything) => 5))) + + (formula "vector fact" [a 1] + (contains 3) + (provided (h anything) => 5)) + + (formula "vector fact" [a 1] + (contains 3) + (against-background (h anything) => 5)) + +; (formula "vector fact" [a 1] +; (against-background (h anything) => 5) +; (contains 3)) + ) (causes-validation-error #"There are too many expections in your formula form" (formula "vector fact" [a 1] a => 1 a => 1))