Method: Roby::Application#test_files_for
- Defined in:
- lib/roby/app.rb
#test_files_for(model) ⇒ Object
Given a model class, returns the full path of an existing test file that is meant to verify this model
2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 |
# File 'lib/roby/app.rb', line 2026 def test_files_for(model) return [] if !model.respond_to?(:definition_location) || !model.definition_location test_files = [] model.definition_location.each do |location| file = location.absolute_path next unless (base_path = find_base_path_for(file)) relative = Pathname.new(file).relative_path_from(base_path) split = relative.each_filename.to_a next if split[0] != "models" split[0] = "test" split[-1] = "test_#{split[-1]}" canonical_testpath = [base_path, *split].join(File::SEPARATOR) if File.exist?(canonical_testpath) test_files << canonical_testpath end end test_files end |