Sha256: 2a52c641ad40eaed1b1f40b6d38deaaeda86021cb52b555cb1ba74487d831c0b

Contents?: true

Size: 1.3 KB

Versions: 2

Compression:

Stored size: 1.3 KB

Contents

# encoding: utf-8
$LOAD_PATH.unshift(File.dirname(__FILE__))
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))

require 'simplecov'
require 'coveralls'
SimpleCov.start { add_filter 'spec/' }

require 'rspec'
require 'watir-webdriver'
require 'selenium-webdriver'

require 'page-object'

def mock_watir_browser
  watir_browser = double('watir')
  allow(watir_browser).to receive(:is_a?).with(anything()).and_return(false)
  allow(watir_browser).to receive(:is_a?).with(Watir::Browser).and_return(true)
  watir_browser
end


def mock_selenium_browser
  selenium_browser = double('selenium')
  allow(selenium_browser).to receive(:is_a?).with(anything).and_return(false)
  allow(selenium_browser).to receive(:is_a?).with(Selenium::WebDriver::Driver).and_return(true)
  selenium_browser
end


def mock_adapter(browser, page_object)
  adapter = double('adapter')
  allow(adapter).to receive(:is_for?).with(anything()).and_return false
  allow(adapter).to receive(:is_for?).with(browser).and_return true
  allow(adapter).to receive(:create_page_object).and_return page_object
  allow(adapter).to receive(:root_element_for).and_return browser
  allow(adapter).to receive(:browser_for).and_return browser
  adapter
end

def mock_adapters(adapters)
  allow(PageObject::Platforms).to receive(:get).and_return adapters
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
page-object-1.2.0 spec/spec_helper.rb
page-object-1.1.1 spec/spec_helper.rb