spec/spec_helper.rb in page-object-0.2 vs spec/spec_helper.rb in page-object-0.2.1
- old
+ new
@@ -15,17 +15,30 @@
require 'page-object'
def mock_watir_browser
watir_browser = double('watir')
- watir_browser.should_receive(:is_a?).with(Watir::Browser).and_return(true)
+ watir_browser.stub!(:is_a?).with(anything()).and_return(false)
+ watir_browser.stub!(:is_a?).with(Watir::Browser).and_return(true)
watir_browser
end
-
+
def mock_selenium_browser
selenium_browser = double('selenium')
- selenium_browser.should_receive(:is_a?).with(Watir::Browser).and_return(false)
- selenium_browser.should_receive(:is_a?).with(Selenium::WebDriver::Driver).and_return(true)
+ selenium_browser.stub!(:is_a?).with(Watir::Browser).and_return(false)
+ selenium_browser.stub!(:is_a?).with(Selenium::WebDriver::Driver).and_return(true)
selenium_browser
end
-
+
+
+def mock_adapter(browser, page_object)
+ adapter = double('adapter')
+ adapter.stub!(:is_for?).with(anything()).and_return false
+ adapter.stub!(:is_for?).with(browser).and_return true
+ adapter.stub!(:create_page_object).and_return page_object
+ adapter
+end
+
+def mock_adapters(adapters)
+ PageObject::Platforms.stub!(:get).and_return adapters
+end