Commit 170c07ef authored by Grzegorz Bizon's avatar Grzegorz Bizon

Fix QA pages validation delegation and memoization

parent fa07d232
......@@ -53,7 +53,7 @@ module QA
return ["#{name} class does not have views / elements defined!"]
end
@errors ||= views.map(&:errors).flatten
views.map(&:errors).flatten
end
class DSL
......
......@@ -2,7 +2,7 @@ module QA
module Page
class Validator
ValidationError = Class.new(StandardError)
Error = Struct.new(:page, :view, :message)
Error = Struct.new(:page, :message)
def initialize(constant)
@module = constant
......@@ -28,12 +28,10 @@ module QA
end
def errors
@errors ||= Array.new.tap do |errors|
Array.new.tap do |errors|
descendants.each do |page|
page.views.each do |view|
view.errors.each do |message|
errors.push(Error.new(page.name, view.path, message))
end
page.errors.each do |message|
errors.push(Error.new(page.name, message))
end
end
end
......
......@@ -13,7 +13,6 @@ module QA
end
validators.map(&:errors).flatten.tap do |errors|
end
validators.each(&:validate!)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment