diff options
author | Kamil Trzciński <ayufan@ayufan.eu> | 2019-05-22 14:45:46 +0300 |
---|---|---|
committer | Kamil Trzciński <ayufan@ayufan.eu> | 2019-05-22 14:45:46 +0300 |
commit | 4f20c9de6f8e09131d751174243214d9bd3b6419 (patch) | |
tree | b41332bd3773178776ff92738de8cff3f84fc689 /lib/quality/test_level.rb | |
parent | c4d930e5f54e7da07c80cc028dfc0f5c08719146 (diff) |
Revert "Merge branch 'reorganize-tests-jobs-by-level' into 'master'"
This reverts merge request !27514
Diffstat (limited to 'lib/quality/test_level.rb')
-rw-r--r-- | lib/quality/test_level.rb | 75 |
1 files changed, 0 insertions, 75 deletions
diff --git a/lib/quality/test_level.rb b/lib/quality/test_level.rb deleted file mode 100644 index 24d8eac200c..00000000000 --- a/lib/quality/test_level.rb +++ /dev/null @@ -1,75 +0,0 @@ -# frozen_string_literal: true - -module Quality - class TestLevel - UnknownTestLevelError = Class.new(StandardError) - - TEST_LEVEL_FOLDERS = { - unit: %w[ - bin - config - db - dependencies - factories - finders - frontend - graphql - helpers - initializers - javascripts - lib - migrations - models - policies - presenters - rack_servers - routing - rubocop - serializers - services - sidekiq - tasks - uploaders - validators - views - workers - elastic_integration - ], - integration: %w[ - controllers - mailers - requests - ], - system: ['features'] - }.freeze - - attr_reader :prefix - - def initialize(prefix = nil) - @prefix = prefix - @patterns = {} - @regexps = {} - end - - def pattern(level) - @patterns[level] ||= "#{prefix}spec/{#{TEST_LEVEL_FOLDERS.fetch(level).join(',')}}{,/**/}*_spec.rb".freeze - end - - def regexp(level) - @regexps[level] ||= Regexp.new("#{prefix}spec/(#{TEST_LEVEL_FOLDERS.fetch(level).join('|')})").freeze - end - - def level_for(file_path) - case file_path - when regexp(:unit) - :unit - when regexp(:integration) - :integration - when regexp(:system) - :system - else - raise UnknownTestLevelError, "Test level for #{file_path} couldn't be set. Please rename the file properly or change the test level detection regexes in #{__FILE__}." - end - end - end -end |