Class: SnapshotInspector::Snapshot::Context

Inherits:
Object
  • Object
show all
Defined in:
app/models/snapshot_inspector/snapshot/context.rb

Direct Known Subclasses

RspecContext, TestUnitContext

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extract(context) ⇒ Object



10
11
12
13
14
# File 'app/models/snapshot_inspector/snapshot/context.rb', line 10

def self.extract(context)
  record = registry[context[:test_framework]].new
  record.extract(context)
  record
end

.from_hash(hash) ⇒ Object



16
17
18
19
20
# File 'app/models/snapshot_inspector/snapshot/context.rb', line 16

def self.from_hash(hash)
  record = registry[hash[:test_framework].to_sym].new
  record.from_hash(hash)
  record
end

.test_framework(name) ⇒ Object



6
7
8
# File 'app/models/snapshot_inspector/snapshot/context.rb', line 6

def self.test_framework(name)
  registry[name] = self
end

Instance Method Details

#extract(_context) ⇒ Object



23
24
25
# File 'app/models/snapshot_inspector/snapshot/context.rb', line 23

def extract(_context)
  raise "Implement in a child class."
end

#from_hash(_hash) ⇒ Object



28
29
30
# File 'app/models/snapshot_inspector/snapshot/context.rb', line 28

def from_hash(_hash)
  raise "Implement in a child class."
end

#nameObject



36
37
38
# File 'app/models/snapshot_inspector/snapshot/context.rb', line 36

def name
  raise "Implement in a child class."
end

#order_indexObject



44
45
46
# File 'app/models/snapshot_inspector/snapshot/context.rb', line 44

def order_index
  raise "Implement in a child class."
end

#test_groupObject



40
41
42
# File 'app/models/snapshot_inspector/snapshot/context.rb', line 40

def test_group
  raise "Implement in a child class."
end

#to_slugObject



32
33
34
# File 'app/models/snapshot_inspector/snapshot/context.rb', line 32

def to_slug
  raise "Implement in a child class."
end