Class: Happo::Action
- Inherits:
-
Object
- Object
- Happo::Action
- Defined in:
- lib/happo/action.rb
Instance Method Summary collapse
- #approve ⇒ Object
-
#initialize(example_description, viewport_name) ⇒ Action
constructor
A new instance of Action.
- #reject ⇒ Object
Constructor Details
#initialize(example_description, viewport_name) ⇒ Action
Returns a new instance of Action.
6 7 8 9 |
# File 'lib/happo/action.rb', line 6 def initialize(example_description, ) @example_description = example_description = end |
Instance Method Details
#approve ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/happo/action.rb', line 11 def approve diff_path = Happo::Utils.path_to( @example_description, , 'diff.png') baseline_path = Happo::Utils.path_to( @example_description, , 'baseline.png') candidate_path = Happo::Utils.path_to( @example_description, , 'candidate.png') FileUtils.rm(diff_path, force: true) FileUtils.mv(candidate_path, baseline_path) if File.exist? candidate_path end |
#reject ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/happo/action.rb', line 23 def reject diff_path = Happo::Utils.path_to( @example_description, , 'diff.png') candidate_path = Happo::Utils.path_to( @example_description, , 'candidate.png') FileUtils.rm(diff_path, force: true) FileUtils.rm(candidate_path, force: true) end |