Sha256: c1c3f1f12a2a16673fc2e2abd33473213adab02254c140483ec8a4b9bb86dd24

Contents?: true

Size: 706 Bytes

Versions: 2

Compression:

Stored size: 706 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

2 entries across 2 versions & 1 rubygems

Version Path
pagemodels-0.1.3 lib/page_models/base.rb
pagemodels-0.1.2 lib/page_models/base.rb