Module: CopSpec

Defined in:
lib/ruby_learner/copspec.rb

Class Method Summary collapse

Class Method Details

.copspec(file_path) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/ruby_learner/copspec.rb', line 3

def copspec(file_path)
  @file = file_path
  root = @file.match(/.*\/lib/)[0]
  @spec = "#{root[0..root.size-5]}/spec"
  flag_rspec = rspec_check
  return if !flag_rspec
  flag_rubocop = rubocop_check
  return if !flag_rubocop
  puts "**********************************"
  puts "Final Error Check"
  puts "**********************************"
  flag_final = check("rspec", @spec)
  if flag_final
    puts "your code is perfect."
  else
    puts "not perfect, please fix your code."
  end
end