Class: LapisLazuli::Scenario
- Inherits:
-
Object
- Object
- LapisLazuli::Scenario
- Includes:
- Ast
- Defined in:
- lib/lapis_lazuli/scenario.rb
Overview
Stores the Cucumber scenario Includes timing, running state and a name
Instance Attribute Summary collapse
-
#check_browser_errors ⇒ Object
Returns the value of attribute check_browser_errors.
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#error ⇒ Object
readonly
Returns the value of attribute error.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#running ⇒ Object
Returns the value of attribute running.
-
#storage ⇒ Object
readonly
Returns the value of attribute storage.
-
#time ⇒ Object
readonly
Returns the value of attribute time.
-
#uuid ⇒ Object
readonly
Returns the value of attribute uuid.
Instance Method Summary collapse
-
#initialize ⇒ Scenario
constructor
A new instance of Scenario.
- #scope(cleaned = false) ⇒ Object
- #tags ⇒ Object
-
#update(scenario) ⇒ Object
Update the scenario with a new one.
- #update_timestamp ⇒ Object
Methods included from Ast
Constructor Details
#initialize ⇒ Scenario
Returns a new instance of Scenario.
22 23 24 25 26 27 28 |
# File 'lib/lapis_lazuli/scenario.rb', line 22 def initialize @uuid = SecureRandom.hex @storage = Storage.new @running = false @name = "start_of_test_run" self. end |
Instance Attribute Details
#check_browser_errors ⇒ Object
Returns the value of attribute check_browser_errors.
20 21 22 |
# File 'lib/lapis_lazuli/scenario.rb', line 20 def check_browser_errors @check_browser_errors end |
#data ⇒ Object (readonly)
Returns the value of attribute data.
19 20 21 |
# File 'lib/lapis_lazuli/scenario.rb', line 19 def data @data end |
#error ⇒ Object (readonly)
Returns the value of attribute error.
19 20 21 |
# File 'lib/lapis_lazuli/scenario.rb', line 19 def error @error end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
19 20 21 |
# File 'lib/lapis_lazuli/scenario.rb', line 19 def id @id end |
#running ⇒ Object
Returns the value of attribute running.
20 21 22 |
# File 'lib/lapis_lazuli/scenario.rb', line 20 def running @running end |
#storage ⇒ Object (readonly)
Returns the value of attribute storage.
19 20 21 |
# File 'lib/lapis_lazuli/scenario.rb', line 19 def storage @storage end |
#time ⇒ Object (readonly)
Returns the value of attribute time.
19 20 21 |
# File 'lib/lapis_lazuli/scenario.rb', line 19 def time @time end |
#uuid ⇒ Object (readonly)
Returns the value of attribute uuid.
19 20 21 |
# File 'lib/lapis_lazuli/scenario.rb', line 19 def uuid @uuid end |
Instance Method Details
#scope(cleaned = false) ⇒ Object
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/lapis_lazuli/scenario.rb', line 60 def scope(cleaned = false) scope = nil if @data.respond_to? :backtrace_line scope = @data.backtrace_line elsif @data.respond_to? :file_colon_line scope = @data.file_colon_line end if scope.nil? return nil elsif cleaned return clean [scope] else return scope end end |
#tags ⇒ Object
54 55 56 57 58 |
# File 'lib/lapis_lazuli/scenario.rb', line 54 def if !@data.nil? return @data.source_tag_names end end |
#update(scenario) ⇒ Object
Update the scenario with a new one
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/lapis_lazuli/scenario.rb', line 32 def update(scenario) @uuid = SecureRandom.hex # Reset the fail attribute @check_browser_errors = true # The original scenario from cucumber @data = scenario # A name without special characters. @id = clean(scenario_id(scenario)) self. end |
#update_timestamp ⇒ Object
43 44 45 46 47 48 49 50 51 52 |
# File 'lib/lapis_lazuli/scenario.rb', line 43 def now = Time.now # The current time @time = { :timestamp => now.strftime('%y%m%d_%H%M%S'), :iso_timestamp => now.utc.strftime("%FT%TZ"), :iso_short => now.utc.strftime("%y%m%dT%H%M%SZ"), :epoch => now.to_i.to_s } end |