Class: RSpec::Cheki::Manager
- Inherits:
-
Object
- Object
- RSpec::Cheki::Manager
- Defined in:
- lib/rspec/cheki/manager.rb
Constant Summary collapse
- SETTINGS_NAME =
:"rspec_cheki_manager"
Instance Attribute Summary collapse
-
#files ⇒ Object
readonly
Returns the value of attribute files.
Class Method Summary collapse
-
.create_snapshot(example:) ⇒ RSpec::Cheki::Snapshot
Create snapshot instance from example object.
-
.settings_name ⇒ String
The settings name.
-
.update(update: false) ⇒ Object
Save snapshots to file.
Instance Method Summary collapse
-
#create_snapshot(example) ⇒ RSpec::Cheki::Snapshot
Create snapshot instance from example object.
-
#initialize ⇒ Manager
constructor
A new instance of Manager.
-
#save(update: false) ⇒ Object
Save snapshots to file.
Constructor Details
#initialize ⇒ Manager
Returns a new instance of Manager.
34 35 36 |
# File 'lib/rspec/cheki/manager.rb', line 34 def initialize @files = {} end |
Instance Attribute Details
#files ⇒ Object (readonly)
Returns the value of attribute files.
32 33 34 |
# File 'lib/rspec/cheki/manager.rb', line 32 def files @files end |
Class Method Details
.create_snapshot(example:) ⇒ RSpec::Cheki::Snapshot
Create snapshot instance from example object
10 11 12 |
# File 'lib/rspec/cheki/manager.rb', line 10 def create_snapshot(example:) instance.create_snapshot(example) end |
.settings_name ⇒ String
Returns The settings name.
15 16 17 |
# File 'lib/rspec/cheki/manager.rb', line 15 def settings_name SETTINGS_NAME end |
.update(update: false) ⇒ Object
Save snapshots to file
21 22 23 |
# File 'lib/rspec/cheki/manager.rb', line 21 def update(update: false) instance.save(update: update) end |
Instance Method Details
#create_snapshot(example) ⇒ RSpec::Cheki::Snapshot
Create snapshot instance from example object
41 42 43 44 45 |
# File 'lib/rspec/cheki/manager.rb', line 41 def create_snapshot example key = example.file_path @files[key] = SnapFile.create(example: example) unless @files.key? key @files[key].create_snapshot(example.id) end |
#save(update: false) ⇒ Object
Save snapshots to file
49 50 51 |
# File 'lib/rspec/cheki/manager.rb', line 49 def save(update: false) @files.each { |_, f| f.save(update: update) } end |