Sha256: 6c6a8c5045b374fee6b5a6ad13c65dacfc72b4181d82fcc1275d2d3e91c8a762

Contents?: true

Size: 702 Bytes

Versions: 1

Compression:

Stored size: 702 Bytes

Contents

module PageModels  
  class Base    
    def open!
      if config.driver.class.to_s == "Capybara::Session"
        visit(full_url)
      else
        goto(full_url)
      end
      verify!
    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

1 entries across 1 versions & 1 rubygems

Version Path
pagemodels-0.2.0 lib/page_models/base.rb