Sha256: 176dce84c994f826d242b4593316aaa017f2b7e6147e1bb4ea36f4af83064059
Contents?: true
Size: 1.18 KB
Versions: 2
Compression:
Stored size: 1.18 KB
Contents
module PageModels class Base @@callbacks = {:before_verify => [], :after_verify => []} def self.before_verify(method_name) @@callbacks[:before_verify] << method_name end def self.after_verify(method_name) @@callbacks[:after_verify] << method_name end def open! if config.driver.class.to_s == "Capybara::Session" visit(full_url) else goto(full_url) end verify! end def _verify! @@callbacks[:before_verify].each { |callback| send(callback) if respond_to?(callback) } verify! @@callbacks[:after_verify].each { |callback| send(callback) if respond_to?(callback) } 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.2.2 | lib/page_models/base.rb |
pagemodels-0.2.1 | lib/page_models/base.rb |