Sha256: cd586e66e960371bd3225c0b8d3476a31ab8fd17ebeffb1d06c9e68f4a0c600f

Contents?: true

Size: 692 Bytes

Versions: 4

Compression:

Stored size: 692 Bytes

Contents

module PageModels  
  class Base    
    def open!
      if config.driver.class.to_s == "Capybara::Session"
        visit(full_url)
      else
        goto(full_url)
      end
    end    
    
    def method_missing(name, *args, &block)
      config.driver.send(name, *args, &block)
    rescue NoMethodError
      super(name, *args, &block)
    end
    
    def url
       raise ImplementationError.new(self, __method__)
    end

    def verify!
       raise ImplementationError.new(self, __method__)
    end
    
    private
    
    def config
      PageModels::Configuration.instance
    end
    
    def full_url
      url =~ /^https?:\/\// ? url : config.base_url + url
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
pagemodels-0.1.7 lib/page_models/base.rb
pagemodels-0.1.6 lib/page_models/base.rb
pagemodels-0.1.5 lib/page_models/base.rb
pagemodels-0.1.4 lib/page_models/base.rb