Sha256: 622b19fb4be8a22cfb9f85f8511074e9bb02992d02e4450aa4dcc0b4fce2567a
Contents?: true
Size: 860 Bytes
Versions: 2
Compression:
Stored size: 860 Bytes
Contents
module BareMinimumChecks class FileNameStyle def get_test_file_name(file_path) file = get_name(file_path) if @style.match(file) file_name_split = file.split('.') @test_file_names.reduce([]) do |arr, name| file_name_split[0] = file_name_split[0] + name dir_glob = Dir.glob("./**/#{file_name_split.join('.')}") arr.concat dir_glob end else [] end end def self.camel_case FileNameStyle.new(/^([A-Z][a-z0-9]+)+\.([a-z]+)/, %w[Spec Test]) end def self.snake_case FileNameStyle.new(/^[A-Za-z]+[_A-Za-z]+\.[a-z]+/, %w[_spec _test]) end private def initialize(style, test_file_names) @style = style @test_file_names = test_file_names end def get_name(file_path) file_path.split('/')[-1] end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
bare_minimum_checks-0.1.2 | lib/bare_minimum_checks/file_name_style.rb |
bare_minimum_checks-0.1.1 | lib/bare_minimum_checks/file_name_style.rb |