spec/browser_spec.rb in taza-0.8.7 vs spec/browser_spec.rb in taza-0.9.0
- old
+ new
@@ -1,11 +1,6 @@
-require 'spec/spec_helper'
-require 'taza/browser'
-require 'taza/settings'
-require 'taza/options'
-require 'selenium'
-require 'watir'
+require 'spec_helper'
describe Taza::Browser do
before :each do
Taza::Settings.stubs(:config_file).returns({})
@@ -24,15 +19,20 @@
it "should use params browser type when creating selenium" do
browser_type = :opera
Selenium::SeleniumDriver.expects(:new).with(anything,anything,'*opera',anything)
Taza::Browser.create(:browser => browser_type, :driver => :selenium)
end
-
+
it "should raise selenium unsupported browser error" do
Taza::Browser.create(:browser => :foo, :driver => :selenium)
end
+ it "should use params browser type when creating an watir webdriver instance" do
+ Watir::Browser.expects(:new).with(:firefox)
+ browser = Taza::Browser.create(:browser => :firefox, :driver => :watir_webdriver)
+ end
+
it "should be able to create a selenium instance" do
browser = Taza::Browser.create(:browser => :firefox, :driver => :selenium)
browser.should be_a_kind_of(Selenium::SeleniumDriver)
end
@@ -51,36 +51,9 @@
Taza::Browser.create(Taza::Settings.config("SiteName"))
end
it "should be able to give you the class of browser" do
Taza::Browser.expects(:watir_safari).returns(Object)
- Taza::Browser.browser_class(:browser => :safari, :driver => :watir).should eql(Object)
+ Taza::Browser.browser_class(:browser => :safari, :driver => :watir).should eql(Object)
end
-
- it "should be able to attach to an open IE instance" do
- require 'watir'
- browser = Object.new
- Watir::IE.stubs(:find).returns(browser)
- Watir::IE.stubs(:new).returns(browser)
- old_browser = Watir::IE.new
- new_browser = Taza::Browser.create(:browser => :ie, :driver => :watir, :attach => true)
- new_browser.should eql(old_browser)
- end
-
- it "should be able to open a new IE instance if there is no instance to attach to" do
- require 'watir'
- browser = Object.new
- Watir::IE.stubs(:find).returns()
- Watir::IE.stubs(:new).returns(browser)
- new_browser = Taza::Browser.create(:browser => :ie, :driver => :watir)
- browser.nil?.should be_false
- end
- it "should be able to open a new IE instance if attach not specified" do
- require 'watir'
- foo = Object.new
- bar = Object.new
- Watir::IE.stubs(:find).returns(foo)
- Watir::IE.stubs(:new).returns(bar)
- new_browser = Taza::Browser.create(:browser => :ie, :driver => :watir)
- new_browser.should_not eql(foo)
- end
+
end