Sha256: 99a4246a41ea650020afae5cf3b8e89c6ab60f618048afa2fb4c673d72f8b667

Contents?: true

Size: 661 Bytes

Versions: 1

Compression:

Stored size: 661 Bytes

Contents

module Calabash
  class Page
    # For auto-completion
    include Calabash

    def self.inherited(subclass)
      # Define the page into global scope
      name = subclass.to_s.split('::').last

      unless Object.const_defined?(name.to_sym)
        # We need a unique type for this constant
        clz = Class.new(StubPage)
        Object.const_set(name.to_sym, clz)
      end
    end

    private_class_method :new

    def initialize(world)
      @world = world
    end

    def trait
      raise 'Implement your own trait'
    end

    def await(timeout = nil)
      wait_for_view(trait, timeout: timeout)
    end

    class StubPage

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
calabash-1.9.9.pre1 lib/calabash/page.rb