spec/implementation.rb in watir-webdriver-0.5.0 vs spec/implementation.rb in watir-webdriver-0.5.1

- old
+ new

@@ -7,10 +7,13 @@ def configure set_webdriver set_browser_args set_guard_proc + add_html_routes + + WatirSpec.always_use_server = mobile? end private def set_webdriver @@ -27,10 +30,14 @@ else @imp.browser_args = [browser] end end + def mobile? + [:android, :iphone].include? browser + end + def set_guard_proc matching_guards = [ :webdriver, # guard only applies to webdriver browser, # guard only applies to this browser [:webdriver, browser] # guard only applies to this browser on webdriver @@ -73,9 +80,16 @@ if path = ENV['WATIR_WEBDRIVER_CHROME_BINARY'] Selenium::WebDriver::Chrome.path = path end @imp.browser_args = [:chrome, opts] + end + + def add_html_routes + glob = File.expand_path("../html/*.html", __FILE__) + Dir[glob].each do |path| + WatirSpec::Server.get("/#{File.basename path}") { File.read(path) } + end end def browser @browser ||= (ENV['WATIR_WEBDRIVER_BROWSER'] || :firefox).to_sym end