Class: DiffuxCIAction

Inherits:
Object
  • Object
show all
Defined in:
lib/diffux_ci_action.rb

Instance Method Summary collapse

Constructor Details

#initialize(example_description, viewport_name) ⇒ DiffuxCIAction



5
6
7
8
# File 'lib/diffux_ci_action.rb', line 5

def initialize(example_description, viewport_name)
  @example_description = example_description
  @viewport_name = viewport_name
end

Instance Method Details

#approveObject



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/diffux_ci_action.rb', line 10

def approve
  diff_path = DiffuxCIUtils.path_to(
    @example_description, @viewport_name, 'diff.png')
  baseline_path = DiffuxCIUtils.path_to(
    @example_description, @viewport_name, 'baseline.png')
  candidate_path = DiffuxCIUtils.path_to(
    @example_description, @viewport_name, 'candidate.png')

  FileUtils.rm(diff_path, force: true)
  FileUtils.mv(candidate_path, baseline_path) if File.exist? candidate_path
end

#rejectObject



22
23
24
25
26
27
28
29
30
# File 'lib/diffux_ci_action.rb', line 22

def reject
  diff_path = DiffuxCIUtils.path_to(
    @example_description, @viewport_name, 'diff.png')
  candidate_path = DiffuxCIUtils.path_to(
    @example_description, @viewport_name, 'candidate.png')

  FileUtils.rm(diff_path, force: true)
  FileUtils.rm(candidate_path, force: true)
end