Class: RSpecTracer::RemoteCache::Validator
- Inherits:
-
Object
- Object
- RSpecTracer::RemoteCache::Validator
- Defined in:
- lib/rspec_tracer/remote_cache/validator.rb
Defined Under Namespace
Classes: ValidationError
Constant Summary collapse
- CACHE_FILES_PER_TEST_SUITE =
11
Instance Method Summary collapse
-
#initialize ⇒ Validator
constructor
A new instance of Validator.
- #valid?(ref, cache_files) ⇒ Boolean
Constructor Details
#initialize ⇒ Validator
Returns a new instance of Validator.
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/rspec_tracer/remote_cache/validator.rb', line 10 def initialize @test_suite_id = ENV.fetch('TEST_SUITE_ID', nil) @test_suites = ENV.fetch('TEST_SUITES', nil) if @test_suite_id.nil? ^ @test_suites.nil? raise( ValidationError, 'Both the environment variables TEST_SUITE_ID and TEST_SUITES are not set' ) end setup end |
Instance Method Details
#valid?(ref, cache_files) ⇒ Boolean
24 25 26 27 28 29 30 31 32 |
# File 'lib/rspec_tracer/remote_cache/validator.rb', line 24 def valid?(ref, cache_files) last_run_regex = Regexp.new(format(@last_run_files_regex, ref: ref)) return false if cache_files.count { |file| file.match?(last_run_regex) } != @last_run_files_count cache_regex = Regexp.new(format(@cached_files_regex, ref: ref)) cache_files.count { |file| file.match?(cache_regex) } == @cached_files_count end |