Module: Spec::Example::ExampleMethods
- Defined in:
- lib/selenium/rspec/rspec_extensions.rb
Instance Attribute Summary collapse
-
#execution_error ⇒ Object
readonly
Returns the value of attribute execution_error.
Instance Method Summary collapse
- #actual_failure? ⇒ Boolean
-
#execute(run_options, instance_variables) ⇒ Object
:nodoc:.
- #pending_for_browsers(*browser_regexps, &block) ⇒ Object
- #reporting_uid ⇒ Object
Instance Attribute Details
#execution_error ⇒ Object (readonly)
Returns the value of attribute execution_error.
26 27 28 |
# File 'lib/selenium/rspec/rspec_extensions.rb', line 26 def execution_error @execution_error end |
Instance Method Details
#actual_failure? ⇒ Boolean
54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/selenium/rspec/rspec_extensions.rb', line 54 def actual_failure? case execution_error when nil false when Spec::Example::ExamplePendingError, Spec::Example::PendingExampleFixedError, Spec::Example::NoDescriptionError false else true end end |
#execute(run_options, instance_variables) ⇒ Object
:nodoc:
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/selenium/rspec/rspec_extensions.rb', line 29 def execute(, instance_variables) # :nodoc: @_proxy.[:actual_example] = self .reporter.example_started(@_proxy) set_instance_variables_from_hash(instance_variables) @execution_error = nil Timeout.timeout(.timeout) do begin before_each_example instance_eval(&@_implementation) rescue Exception => e @execution_error ||= e end begin after_each_example rescue Exception => e @execution_error ||= e end end .reporter.example_finished(@_proxy.update(description), @execution_error) success = @execution_error.nil? || ExamplePendingError === @execution_error end |
#pending_for_browsers(*browser_regexps, &block) ⇒ Object
72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/selenium/rspec/rspec_extensions.rb', line 72 def pending_for_browsers(*browser_regexps, &block) actual_browser = selenium_driver.browser_string match_browser_regexps = browser_regexps.inject(false) do |match, regexp| match ||= actual_browser =~ Regexp.new(regexp.source, Regexp::IGNORECASE) end if match_browser_regexps pending "#{actual_browser.gsub(/\*/, '').capitalize} does not support this feature yet" else yield end end |
#reporting_uid ⇒ Object
67 68 69 70 |
# File 'lib/selenium/rspec/rspec_extensions.rb', line 67 def reporting_uid # backtrace is not reliable anymore using the implementation proc Digest::MD5.hexdigest @_implementation.inspect end |