Class: LookbookVisualTester::ScenarioRun
- Inherits:
-
Object
- Object
- LookbookVisualTester::ScenarioRun
- Defined in:
- lib/lookbook_visual_tester/scenario_run.rb
Instance Attribute Summary collapse
-
#preview ⇒ Object
readonly
Returns the value of attribute preview.
-
#scenario ⇒ Object
readonly
Returns the value of attribute scenario.
Instance Method Summary collapse
- #baseline_path ⇒ Object
- #current_path ⇒ Object
- #diff_filename ⇒ Object
- #filename ⇒ Object
-
#initialize(scenario) ⇒ ScenarioRun
constructor
A new instance of ScenarioRun.
- #name ⇒ Object
- #preview_name ⇒ Object
- #preview_url ⇒ Object
- #scenario_name ⇒ Object
- #timestamp_filename ⇒ Object
Constructor Details
#initialize(scenario) ⇒ ScenarioRun
Returns a new instance of ScenarioRun.
7 8 9 10 11 12 |
# File 'lib/lookbook_visual_tester/scenario_run.rb', line 7 def initialize(scenario) @scenario = scenario @preview = scenario.preview puts " Scenario: #{scenario_name}" end |
Instance Attribute Details
#preview ⇒ Object (readonly)
Returns the value of attribute preview.
5 6 7 |
# File 'lib/lookbook_visual_tester/scenario_run.rb', line 5 def preview @preview end |
#scenario ⇒ Object (readonly)
Returns the value of attribute scenario.
5 6 7 |
# File 'lib/lookbook_visual_tester/scenario_run.rb', line 5 def scenario @scenario end |
Instance Method Details
#baseline_path ⇒ Object
45 46 47 |
# File 'lib/lookbook_visual_tester/scenario_run.rb', line 45 def baseline_path LookbookVisualTester.config.baseline_dir.join(filename) end |
#current_path ⇒ Object
41 42 43 |
# File 'lib/lookbook_visual_tester/scenario_run.rb', line 41 def current_path LookbookVisualTester.config.current_dir.join(filename) end |
#diff_filename ⇒ Object
37 38 39 |
# File 'lib/lookbook_visual_tester/scenario_run.rb', line 37 def diff_filename "#{preview_name}_#{scenario_name}_diff.png" end |
#filename ⇒ Object
26 27 28 |
# File 'lib/lookbook_visual_tester/scenario_run.rb', line 26 def filename "#{name}.png" end |
#name ⇒ Object
22 23 24 |
# File 'lib/lookbook_visual_tester/scenario_run.rb', line 22 def name "#{preview_name}_#{scenario_name}" end |
#preview_name ⇒ Object
14 15 16 |
# File 'lib/lookbook_visual_tester/scenario_run.rb', line 14 def preview_name preview.name.underscore end |
#preview_url ⇒ Object
49 50 51 52 53 54 |
# File 'lib/lookbook_visual_tester/scenario_run.rb', line 49 def preview_url Lookbook::Engine.routes.url_helpers.lookbook_preview_url( path: preview.lookup_path + '/' + scenario.name, host: LookbookVisualTester.config.lookbook_host ) end |
#scenario_name ⇒ Object
18 19 20 |
# File 'lib/lookbook_visual_tester/scenario_run.rb', line 18 def scenario_name scenario.name.underscore end |
#timestamp_filename ⇒ Object
30 31 32 33 34 35 |
# File 'lib/lookbook_visual_tester/scenario_run.rb', line 30 def ||= begin = Time.now.strftime('%Y%m%d-%H%M%S') "#{name}_#{timestamp}.png" end end |