Class: RSpec::Approvals::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/rspec/approvals/cli.rb

Instance Method Summary collapse

Instance Method Details

#verifyObject


8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/rspec/approvals/cli.rb', line 8

def verify

  approvals = File.read('.approvals').split("\n")

  rejected = []
  approvals.each do |approval|
    system("#{options[:diff]} #{approval}")

    if options[:ask] && yes?("Approve?")
        system("mv #{approval}")
    else
      rejected << approval
    end
  end

  File.open('.approvals', 'w') do |f|
    f.write rejected.join("\n")
  end
end