spec/browser_spec.rb in taza-0.8.0 vs spec/browser_spec.rb in taza-0.8.2

- old
+ new

@@ -1,40 +1,25 @@ require 'spec/spec_helper' require 'taza/browser' require 'taza/settings' require 'selenium' -require 'firewatir' +require 'watir' describe Taza::Browser do before :each do Taza::Settings.stubs(:config_file).returns({}) ENV['TAZA_ENV'] = 'isolation' - ENV['server_port'] = nil - ENV['server_ip'] = nil - ENV['browser'] = nil - ENV['driver'] = nil - ENV['timeout'] = nil + ENV['SERVER_PORT'] = nil + ENV['SERVER_IP'] = nil + ENV['BROWSER'] = nil + ENV['DRIVER'] = nil + ENV['TIMEOUT'] = nil end - it "should be able to create a watir driver" do - Taza::Browser.expects(:create_watir_ie) - Taza::Browser.create(:browser => :ie, :driver => :watir) - end - - it "should be able to create a firewatir driver" do - Taza::Browser.expects(:create_watir_firefox) - Taza::Browser.create(:browser => :firefox,:driver => :watir) - end - - it "should be able to create a safariwatir driver" do - Taza::Browser.expects(:create_watir_safari) - Taza::Browser.create(:browser => :safari,:driver => :watir) - end - it "should raise unknown browser error for unsupported watir browsers" do - lambda { Taza::Browser.create(:browser => :foo_browser_9000,:driver => :watir) }.should raise_error(BrowserUnsupportedError) + lambda { Taza::Browser.create(:browser => :foo_browser_9000,:driver => :watir) }.should raise_error(StandardError) end it "should use params browser type when creating selenium" do browser_type = :opera Selenium::SeleniumDriver.expects(:new).with(anything,anything,'*opera',anything) @@ -50,23 +35,24 @@ browser.should be_a_kind_of(Selenium::SeleniumDriver) end it "should use environment settings for server port and ip" do Taza::Settings.stubs(:path).returns(File.join('spec','sandbox')) - ENV['server_port'] = 'server_port' - ENV['server_ip'] = 'server_ip' + ENV['SERVER_PORT'] = 'server_port' + ENV['SERVER_IP'] = 'server_ip' Selenium::SeleniumDriver.expects(:new).with('server_ip','server_port',anything,anything) Taza::Browser.create(Taza::Settings.config("SiteName")) end it "should use environment settings for timeout" do Taza::Settings.stubs(:path).returns(File.join('spec','sandbox')) - ENV['timeout'] = 'timeout' + ENV['TIMEOUT'] = 'timeout' Selenium::SeleniumDriver.expects(:new).with(anything,anything,anything,'timeout') Taza::Browser.create(Taza::Settings.config("SiteName")) end - it "should create firewatir instance" do - FireWatir::Firefox.expects(:new) - Taza::Browser.create(:browser => :firefox, :driver => :watir) + 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) end + end