Class: SnapshotInspector::Snapshot::RspecContext
- Inherits:
-
Context
- Object
- Context
- SnapshotInspector::Snapshot::RspecContext
show all
- Defined in:
- app/models/snapshot_inspector/snapshot/rspec_context.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods inherited from Context
extract, from_hash, test_framework
Instance Attribute Details
#example ⇒ Object
Returns the value of attribute example.
6
7
8
|
# File 'app/models/snapshot_inspector/snapshot/rspec_context.rb', line 6
def example
@example
end
|
#take_snapshot_index ⇒ Object
Returns the value of attribute take_snapshot_index.
6
7
8
|
# File 'app/models/snapshot_inspector/snapshot/rspec_context.rb', line 6
def take_snapshot_index
@take_snapshot_index
end
|
#test_framework ⇒ Object
Returns the value of attribute test_framework.
6
7
8
|
# File 'app/models/snapshot_inspector/snapshot/rspec_context.rb', line 6
def test_framework
@test_framework
end
|
Instance Method Details
9
10
11
12
13
|
# File 'app/models/snapshot_inspector/snapshot/rspec_context.rb', line 9
def (context)
@test_framework = context[:test_framework]
@example = context[:example]
@take_snapshot_index = context[:take_snapshot_index]
end
|
#from_hash(hash) ⇒ Object
16
17
18
19
20
|
# File 'app/models/snapshot_inspector/snapshot/rspec_context.rb', line 16
def from_hash(hash)
@test_framework = hash[:test_framework].to_sym
@example = hash[:example]
@take_snapshot_index = hash[:take_snapshot_index]
end
|
#name ⇒ Object
27
28
29
|
# File 'app/models/snapshot_inspector/snapshot/rspec_context.rb', line 27
def name
@example[:full_description].gsub(test_group, "").strip
end
|
#order_index ⇒ Object
35
36
37
|
# File 'app/models/snapshot_inspector/snapshot/rspec_context.rb', line 35
def order_index
[@example[:file_path], @example[:line_number], @take_snapshot_index]
end
|
#test_group ⇒ Object
31
32
33
|
# File 'app/models/snapshot_inspector/snapshot/rspec_context.rb', line 31
def test_group
root_example_group_description(@example)
end
|
#to_slug ⇒ Object
22
23
24
25
|
# File 'app/models/snapshot_inspector/snapshot/rspec_context.rb', line 22
def to_slug
spec_path_without_extension = @example[:file_path].delete_suffix(File.extname(@example[:file_path])).delete_prefix("./")
[spec_path_without_extension, @example[:line_number], @take_snapshot_index].join("_")
end
|