Skip to content

Instantly share code, notes, and snippets.

@mitsuhirookuno
Last active February 17, 2021 02:24
Show Gist options
  • Save mitsuhirookuno/ab385cdf1f29909ee2aeee0f1ee6a0c9 to your computer and use it in GitHub Desktop.
Save mitsuhirookuno/ab385cdf1f29909ee2aeee0f1ee6a0c9 to your computer and use it in GitHub Desktop.
対応するrspecに漏れがないかチェッカー
def main
@class_files = Dir.glob("app/loyalties/**/*.rb")
@rspec_files = Dir.glob("spec/loyalties/**/*.rb")
@class_files.each do |class_file|
rspec_file = class_file.gsub(/\Aapp/, 'spec').gsub(/loyalty.rb\z/, 'loyalty_spec.rb')
next if @rspec_files.include?(rspec_file)
next if class_file == 'app/loyalties/application_loyalty.rb'
puts "#{class_file} のテストが無いよ #{rspec_file}だよ"
end
end
main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment