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 /spec | |
parent | c4d930e5f54e7da07c80cc028dfc0f5c08719146 (diff) |
Revert "Merge branch 'reorganize-tests-jobs-by-level' into 'master'"
This reverts merge request !27514
Diffstat (limited to 'spec')
-rw-r--r-- | spec/lib/quality/test_level_spec.rb | 105 | ||||
-rw-r--r-- | spec/spec_helper.rb | 5 | ||||
-rw-r--r-- | spec/support/shared_examples/finders/assignees_filter_spec.rb (renamed from spec/support/shared_examples/finders/assignees_filter_shared_examples.rb) | 0 | ||||
-rw-r--r-- | spec/support/shared_examples/models/atomic_internal_id_spec.rb (renamed from spec/support/shared_examples/models/atomic_internal_id_shared_examples.rb) | 0 | ||||
-rw-r--r-- | spec/support/shared_examples/models/chat_service_spec.rb (renamed from spec/support/shared_examples/models/chat_service_shared_examples.rb) | 0 | ||||
-rw-r--r-- | spec/support/shared_examples/models/update_project_statistics_spec.rb (renamed from spec/support/shared_examples/models/update_project_statistics_shared_examples.rb) | 0 | ||||
-rw-r--r-- | spec/support/shared_examples/requests/api/issues_shared_example_spec.rb (renamed from spec/support/shared_examples/requests/api/issues_shared_examples.rb) | 0 |
7 files changed, 1 insertions, 109 deletions
diff --git a/spec/lib/quality/test_level_spec.rb b/spec/lib/quality/test_level_spec.rb deleted file mode 100644 index 3465c3a050b..00000000000 --- a/spec/lib/quality/test_level_spec.rb +++ /dev/null @@ -1,105 +0,0 @@ -# frozen_string_literal: true - -require 'fast_spec_helper' - -RSpec.describe Quality::TestLevel do - describe '#pattern' do - context 'when level is unit' do - it 'returns a pattern' do - expect(subject.pattern(:unit)) - .to eq("spec/{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}{,/**/}*_spec.rb") - end - end - - context 'when level is integration' do - it 'returns a pattern' do - expect(subject.pattern(:integration)) - .to eq("spec/{controllers,mailers,requests}{,/**/}*_spec.rb") - end - end - - context 'when level is system' do - it 'returns a pattern' do - expect(subject.pattern(:system)) - .to eq("spec/{features}{,/**/}*_spec.rb") - end - end - - context 'with a prefix' do - it 'returns a pattern' do - expect(described_class.new('ee/').pattern(:system)) - .to eq("ee/spec/{features}{,/**/}*_spec.rb") - end - end - - describe 'performance' do - it 'memoizes the pattern for a given level' do - expect(subject.pattern(:system).object_id).to eq(subject.pattern(:system).object_id) - end - - it 'freezes the pattern for a given level' do - expect(subject.pattern(:system)).to be_frozen - end - end - end - - describe '#regexp' do - context 'when level is unit' do - it 'returns a regexp' do - expect(subject.regexp(:unit)) - .to eq(%r{spec/(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)}) - end - end - - context 'when level is integration' do - it 'returns a regexp' do - expect(subject.regexp(:integration)) - .to eq(%r{spec/(controllers|mailers|requests)}) - end - end - - context 'when level is system' do - it 'returns a regexp' do - expect(subject.regexp(:system)) - .to eq(%r{spec/(features)}) - end - end - - context 'with a prefix' do - it 'returns a regexp' do - expect(described_class.new('ee/').regexp(:system)) - .to eq(%r{ee/spec/(features)}) - end - end - - describe 'performance' do - it 'memoizes the regexp for a given level' do - expect(subject.regexp(:system).object_id).to eq(subject.regexp(:system).object_id) - end - - it 'freezes the regexp for a given level' do - expect(subject.regexp(:system)).to be_frozen - end - end - end - - describe '#level_for' do - it 'returns the correct level for a unit test' do - expect(subject.level_for('spec/models/abuse_report_spec.rb')).to eq(:unit) - end - - it 'returns the correct level for an integration test' do - expect(subject.level_for('spec/mailers/abuse_report_mailer_spec.rb')).to eq(:integration) - end - - it 'returns the correct level for a system test' do - expect(subject.level_for('spec/features/abuse_report_spec.rb')).to eq(:system) - end - - it 'raises an error for an unknown level' do - expect { subject.level_for('spec/unknown/foo_spec.rb') } - .to raise_error(described_class::UnknownTestLevelError, - %r{Test level for spec/unknown/foo_spec.rb couldn't be set. Please rename the file properly or change the test level detection regexes in .+/lib/quality/test_level.rb.}) - end - end -end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 390a869d93f..69589c9aa33 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -44,8 +44,6 @@ Dir[Rails.root.join("spec/support/shared_contexts/*.rb")].each { |f| require f } Dir[Rails.root.join("spec/support/shared_examples/*.rb")].each { |f| require f } Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f } -quality_level = Quality::TestLevel.new - RSpec.configure do |config| config.use_transactional_fixtures = false config.use_instantiated_fixtures = false @@ -57,10 +55,9 @@ RSpec.configure do |config| config.infer_spec_type_from_file_location! config.full_backtrace = !!ENV['CI'] - config.define_derived_metadata(file_path: %r{(ee)?/spec/.+_spec\.rb\z}) do |metadata| + config.define_derived_metadata(file_path: %r{/spec/}) do |metadata| location = metadata[:location] - metadata[:level] = quality_level.level_for(location) metadata[:api] = true if location =~ %r{/spec/requests/api/} # do not overwrite type if it's already set diff --git a/spec/support/shared_examples/finders/assignees_filter_shared_examples.rb b/spec/support/shared_examples/finders/assignees_filter_spec.rb index 782a2d97746..782a2d97746 100644 --- a/spec/support/shared_examples/finders/assignees_filter_shared_examples.rb +++ b/spec/support/shared_examples/finders/assignees_filter_spec.rb diff --git a/spec/support/shared_examples/models/atomic_internal_id_shared_examples.rb b/spec/support/shared_examples/models/atomic_internal_id_spec.rb index a248f60d23e..a248f60d23e 100644 --- a/spec/support/shared_examples/models/atomic_internal_id_shared_examples.rb +++ b/spec/support/shared_examples/models/atomic_internal_id_spec.rb diff --git a/spec/support/shared_examples/models/chat_service_shared_examples.rb b/spec/support/shared_examples/models/chat_service_spec.rb index 0a302e7d030..0a302e7d030 100644 --- a/spec/support/shared_examples/models/chat_service_shared_examples.rb +++ b/spec/support/shared_examples/models/chat_service_spec.rb diff --git a/spec/support/shared_examples/models/update_project_statistics_shared_examples.rb b/spec/support/shared_examples/models/update_project_statistics_spec.rb index 7a04e940ee5..7a04e940ee5 100644 --- a/spec/support/shared_examples/models/update_project_statistics_shared_examples.rb +++ b/spec/support/shared_examples/models/update_project_statistics_spec.rb diff --git a/spec/support/shared_examples/requests/api/issues_shared_examples.rb b/spec/support/shared_examples/requests/api/issues_shared_example_spec.rb index 1133e95e44e..1133e95e44e 100644 --- a/spec/support/shared_examples/requests/api/issues_shared_examples.rb +++ b/spec/support/shared_examples/requests/api/issues_shared_example_spec.rb |