module Files::Specs
Public Class Methods
chop_file_paths(specs)
click to toggle source
Returns array of specs to run with the absolute path chopped off
# File lib/specss/files.rb, line 76 def self.chop_file_paths(specs) specs_to_run = [] specs.each do |s| spec_name = File.basename(s) specs_to_run.push(spec_name) end specs_to_run end
get_specs(changed_files)
click to toggle source
Returns all specs to run as an array of file paths relative to root
# File lib/specss/files.rb, line 60 def self.get_specs(changed_files) specs_to_run = [] specs = Dir.glob('spec/**/*').select{ |e| File.file? e } # Check if each spec is included in the list of changed files specs.each do |s| spec_name = File.basename(s, ".*") spec_name.slice! '_spec' if spec_name.include? '_spec' next if spec_name.include? 'shared_examples' specs_to_run.push(s) if changed_files.include? spec_name end specs_to_run end