Sha256: d912880bc62af2e4826fb18eb3a0044634aca6899d9f7b03211080914231797e

Contents?: true

Size: 1.2 KB

Versions: 36

Compression:

Stored size: 1.2 KB

Contents

module Briar
  module Page
    module Helpers

      # returns +true+ if +current_page+ is an instance of +page_class+
      #
      # the +current_page+ argument defaults to the +@cp+ World variable
      def cp_is?(page_class, current_page=@cp)
        current_page.is_a?(page_class)
      end

      # raises a exception if the +current_page+ is not an instance of
      # +page_class+
      #
      # the +current_page+ argument defaults to the +@cp+ World variable
      def expect_current_page(page_class, current_page=@cp)
        unless cp_is? page_class, current_page
          screenshot_and_raise "expected current page to be '#{page_class}' but found '#{current_page}'"
        end
      end

      # raises an exception if the +current_page+ is not an instance of any of
      # +page_classes+
      #
      # the +current_page+ argument defaults to the +@cp+ World variable
      def expect_current_page_is_one_of(page_classes, current_page=@cp)
        res = page_classes.any? { |page_class| cp_is?(page_class, current_page) }
        unless res
          screenshot_and_raise "expected current page to be on of these '#{page_classes}' pages but found '#{current_page}'"
        end
      end

    end
  end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
briar-2.0.5 lib/briar/page/briar_page_helpers.rb
briar-2.0.4 lib/briar/page/briar_page_helpers.rb
briar-2.0.3 lib/briar/page/briar_page_helpers.rb
briar-2.0.2 lib/briar/page/briar_page_helpers.rb
briar-2.0.1 lib/briar/page/briar_page_helpers.rb
briar-2.0.0 lib/briar/page/briar_page_helpers.rb
briar-1.4.2 lib/briar/page/briar_page_helpers.rb
briar-1.4.1 lib/briar/page/briar_page_helpers.rb
briar-1.3.2 lib/briar/page/briar_page_helpers.rb
briar-1.3.1 lib/briar/page/briar_page_helpers.rb
briar-1.3.0 lib/briar/page/briar_page_helpers.rb
briar-1.2.2 lib/briar/page/briar_page_helpers.rb
briar-1.2.1 lib/briar/page/briar_page_helpers.rb
briar-1.2.0 lib/briar/page/briar_page_helpers.rb
briar-1.1.9 lib/briar/page/briar_page_helpers.rb
briar-1.1.8 lib/briar/page/briar_page_helpers.rb
briar-1.1.7 lib/briar/page/briar_page_helpers.rb
briar-1.1.6 lib/briar/page/briar_page_helpers.rb
briar-1.1.5 lib/briar/page/briar_page_helpers.rb
briar-1.1.4 lib/briar/page/briar_page_helpers.rb