Class: SnapshotUI::Snapshot::Context
- Inherits:
-
Object
- Object
- SnapshotUI::Snapshot::Context
- Defined in:
- lib/snapshot_ui/snapshot/context.rb
Instance Attribute Summary collapse
-
#method_name ⇒ Object
readonly
Returns the value of attribute method_name.
-
#source_location ⇒ Object
readonly
Returns the value of attribute source_location.
-
#take_snapshot_index ⇒ Object
readonly
Returns the value of attribute take_snapshot_index.
-
#test_case_name ⇒ Object
readonly
Returns the value of attribute test_case_name.
-
#test_framework ⇒ Object
readonly
Returns the value of attribute test_framework.
Instance Method Summary collapse
-
#initialize(context) ⇒ Context
constructor
A new instance of Context.
- #name ⇒ Object
- #order_index ⇒ Object
- #test_group ⇒ Object
- #to_slug ⇒ Object
Constructor Details
#initialize(context) ⇒ Context
Returns a new instance of Context.
8 9 10 11 12 13 14 |
# File 'lib/snapshot_ui/snapshot/context.rb', line 8 def initialize(context) @test_framework = context[:test_framework] @test_case_name = context[:test_case_name] @method_name = context[:method_name] @source_location = context[:source_location] @take_snapshot_index = context[:take_snapshot_index] end |
Instance Attribute Details
#method_name ⇒ Object (readonly)
Returns the value of attribute method_name.
6 7 8 |
# File 'lib/snapshot_ui/snapshot/context.rb', line 6 def method_name @method_name end |
#source_location ⇒ Object (readonly)
Returns the value of attribute source_location.
6 7 8 |
# File 'lib/snapshot_ui/snapshot/context.rb', line 6 def source_location @source_location end |
#take_snapshot_index ⇒ Object (readonly)
Returns the value of attribute take_snapshot_index.
6 7 8 |
# File 'lib/snapshot_ui/snapshot/context.rb', line 6 def take_snapshot_index @take_snapshot_index end |
#test_case_name ⇒ Object (readonly)
Returns the value of attribute test_case_name.
6 7 8 |
# File 'lib/snapshot_ui/snapshot/context.rb', line 6 def test_case_name @test_case_name end |
#test_framework ⇒ Object (readonly)
Returns the value of attribute test_framework.
6 7 8 |
# File 'lib/snapshot_ui/snapshot/context.rb', line 6 def test_framework @test_framework end |
Instance Method Details
#name ⇒ Object
25 26 27 |
# File 'lib/snapshot_ui/snapshot/context.rb', line 25 def name method_name end |
#order_index ⇒ Object
33 34 35 |
# File 'lib/snapshot_ui/snapshot/context.rb', line 33 def order_index source_location.dup << take_snapshot_index end |
#test_group ⇒ Object
29 30 31 |
# File 'lib/snapshot_ui/snapshot/context.rb', line 29 def test_group test_case_name end |
#to_slug ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/snapshot_ui/snapshot/context.rb', line 16 def to_slug test_path_without_extension = source_location[0] .delete_suffix(File.extname(source_location[0])) .delete_prefix(SnapshotUI.configuration.project_root_directory.to_s + "/") [test_path_without_extension, source_location[1], take_snapshot_index].join("_") end |