Class: LikadanAction

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

Instance Method Summary collapse

Constructor Details

#initialize(example_name, viewport_name) ⇒ LikadanAction

Returns a new instance of LikadanAction.



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

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

Instance Method Details

#approveObject



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

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

  FileUtils.rm(diff_path, force: true)

  if File.exist? candidate_path
    FileUtils.mv(candidate_path, baseline_path)
  end
end

#rejectObject



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

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

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