Class: BareMinimumChecks::FileNameStyle
- Inherits:
-
Object
- Object
- BareMinimumChecks::FileNameStyle
- Defined in:
- lib/bare_minimum_checks/file_name_style.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.camel_case ⇒ Object
17 18 19 |
# File 'lib/bare_minimum_checks/file_name_style.rb', line 17 def self.camel_case FileNameStyle.new(/^([A-Z][a-z0-9]+)+\.([a-z]+)/, %w[Spec Test]) end |
.snake_case ⇒ Object
21 22 23 |
# File 'lib/bare_minimum_checks/file_name_style.rb', line 21 def self.snake_case FileNameStyle.new(/^[A-Za-z]+[_A-Za-z]+\.[a-z]+/, %w[_spec _test]) end |
Instance Method Details
#get_test_file_name(file_path) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/bare_minimum_checks/file_name_style.rb', line 3 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 |