spec/watirspec/lib/watirspec.rb in watir-webdriver-0.0.6 vs spec/watirspec/lib/watirspec.rb in watir-webdriver-0.0.7

- old
+ new

@@ -33,24 +33,29 @@ RUBY_PLATFORM end end def implementation - @implementation ||= case Browser.name - when "Watir::IE" - :watir - when "Watir::Firefox", "FireWatir::Firefox" - :firewatir - when "Celerity::Browser" - :celerity - else - :unknown - end + @implementation ||= ( + imp = WatirSpec::Implementation.new + yield imp if block_given? + + imp + ) end + def implementation=(imp) + unless imp.kind_of? WatirSpec::Implementation + raise TypeError, "expected WatirSpec::Implementation, got #{imp.class}" + end + + @implementation = imp + end + def new_browser - args = WatirSpec.browser_args - args ? Browser.new(*args) : Browser.new + klass = WatirSpec.implementation.browser_class + args = WatirSpec.implementation.browser_args + args ? klass.new(*args) : klass.new end def ruby if @ruby.nil? if defined?(Gem)