summaryrefslogtreecommitdiff
path: root/qa/qa/page/page_concern.rb
blob: cf1153c0ca35bc4a048f659c1c315d043941048e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# frozen_string_literal: true

module QA
  module Page
    module PageConcern
      def included(base)
        unless base.is_a?(Class)
          raise "Expected #{self} to be prepended to a class, but #{base} is a module!"
        end

        unless base.ancestors.include?(::QA::Page::Base)
          raise "Expected #{self} to be prepended to a class that inherits from ::QA::Page::Base, but #{base} doesn't!"
        end
      end
      alias_method :prepended, :included
    end
  end
end