Sha256: e0ae9715b7545096ed57f8eb787eeb3ae73ddd51e8215bbbdda09d7ad86a7c2c

Contents?: true

Size: 1.29 KB

Versions: 2

Compression:

Stored size: 1.29 KB

Contents

begin
  selenium_client_path = "selenium/client" 
  require selenium_client_path
rescue LoadError => e
  if e.message =~ /#{Regexp.escape(selenium_client_path)}$/
    raise "selenium-client not available. Install it with sudo gem install selenium-client"
  else
    raise e
  end
end

module Spectie
  class SeleniumStoryExampleGroup
    include StoryExampleGroupMethods
    include Selenium::Client::SeleniumHelper

    selenium = nil
    selenium_config = Spec::Runner.configuration.selenium

    before :suite do
      if selenium_config.controlled? and selenium_config.start_browser_once
        selenium = Selenium::Client::Driver.new(selenium_config.driver_options)
        selenium.start
      end
    end

    after :suite do
      if selenium_config.controlled? and selenium_config.start_browser_once
        selenium.stop
      end
    end

    before :each do
      if selenium_config.controlled? and !selenium_config.start_browser_once
        selenium = Selenium::Client::Driver.new(selenium_config.driver_options)
        selenium.start
      end
      @selenium = selenium
    end

    after :each do
      if selenium_config.controlled?
        if selenium_config.start_browser_once
          selenium.delete_all_visible_cookies
        else
          selenium.stop
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
spectie-0.0.4 lib/spectie/selenium/story_example_group.rb
spectie-0.0.3 lib/spectie/selenium/story_example_group.rb