Class: RSpecTracer::RemoteCache::Validator
- Inherits:
-
Object
- Object
- RSpecTracer::RemoteCache::Validator
- Defined in:
- lib/rspec_tracer/remote_cache/validator.rb
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.
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/rspec_tracer/remote_cache/validator.rb', line 8 def initialize @test_suite_id = ENV['TEST_SUITE_ID'] @test_suites = ENV['TEST_SUITES'] if @test_suite_id.nil? ^ @test_suites.nil? raise( ValidationError, 'Both the enviornment variables TEST_SUITE_ID and TEST_SUITES are not set' ) end setup end |
Instance Method Details
#valid?(ref, cache_files) ⇒ Boolean
22 23 24 25 26 27 28 29 30 |
# File 'lib/rspec_tracer/remote_cache/validator.rb', line 22 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 |