Class: WatirSplash::Util
- Inherits:
-
Object
- Object
- WatirSplash::Util
- Defined in:
- lib/watirsplash/util.rb
Overview
class for common functionality
Class Method Summary collapse
-
.file_native_path(file_path) ⇒ Object
returns native file path e.g.
-
.file_path(file_name, description = nil) ⇒ Object
returns unique file path for use in the examples.
- .formatter ⇒ Object
- .framework ⇒ Object
- .framework=(framework) ⇒ Object
- .load_framework ⇒ Object
Class Method Details
.file_native_path(file_path) ⇒ Object
returns native file path e.g. on Windows:
file_native_path("c:/blah/blah2/file.txt") => c:\\blah\\blah2\\file.txt
16 17 18 |
# File 'lib/watirsplash/util.rb', line 16 def file_native_path(file_path) File::ALT_SEPARATOR ? file_path.gsub(File::SEPARATOR, File::ALT_SEPARATOR) : file_path end |
.file_path(file_name, description = nil) ⇒ Object
returns unique file path for use in the examples
all file names generated with this method will be shown on the report upon test failure.
9 10 11 |
# File 'lib/watirsplash/util.rb', line 9 def file_path(file_name, description=nil) WatirSplash::Util.formatter.file_path(file_name, description) end |
.formatter ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/watirsplash/util.rb', line 20 def formatter @html_formatter ||= begin formatter = RSpec.configuration.formatters.find {|formatter| formatter.kind_of? WatirSplash::HtmlFormatter} raise "WatirSplash::HtmlFormatter is not loaded - are you sure that you have specified it in your .rspec file?" unless formatter formatter end end |
.framework ⇒ Object
33 34 35 |
# File 'lib/watirsplash/util.rb', line 33 def framework @framework end |
.framework=(framework) ⇒ Object
28 29 30 31 |
# File 'lib/watirsplash/util.rb', line 28 def framework= framework framework = framework.to_sym @framework = framework == :default ? default_framework : framework end |
.load_framework ⇒ Object
37 38 39 40 |
# File 'lib/watirsplash/util.rb', line 37 def load_framework self.framework = ENV["WATIRSPLASH_FRAMEWORK"] || framework || default_framework require "watirsplash/frameworks/#{framework}" end |