Method: Roby::Application#discover_test_files

Defined in:
lib/roby/app.rb

#discover_test_files(all: true, only_self: false, base_dir: File.join(app_dir, "test")) ⇒ Array<String>

Discover which tests should be run, and require them

Parameters:

  • all (Boolean) (defaults to: true)

    if set, list all files in #app_dir/test. Otherwise, list only the tests that are related to the loaded models.

  • only_self (Boolean) (defaults to: false)

    if set, list only test files from within #app_dir. Otherwise, consider test files from all over #search_path

Returns:

  • (Array<String>)


3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
# File 'lib/roby/app.rb', line 3308

def discover_test_files(all: true, only_self: false, base_dir: File.join(app_dir, "test"))
    if all
        test_files = each_test_file_in(base_dir).with_object({}) do |t, h|
            h[t] = []
        end

        unless only_self
            test_files.merge!(Hash[each_test_file_for_loaded_models.to_a])
        end
    else
        test_files = Hash[each_test_file_for_loaded_models.to_a]
        if only_self
            test_files = test_files.find_all { |f, _| self_file?(f) }
        end
    end
    test_files
end