Class: RSpec::Hermetic::Configuration
- Inherits:
-
Object
- Object
- RSpec::Hermetic::Configuration
- Defined in:
- lib/rspec/hermetic/configuration.rb,
sig/rspec/hermetic.rbs
Instance Attribute Summary collapse
-
#allowlist ⇒ Allowlist
readonly
Returns the value of attribute allowlist.
-
#auto_reset ⇒ Object
Returns the value of attribute auto_reset.
-
#candidate_report_path ⇒ String?
Returns the value of attribute candidate_report_path.
-
#constant_exclude_patterns ⇒ Array[untyped]
Returns the value of attribute constant_exclude_patterns.
-
#constant_namespaces ⇒ Array[untyped]
Returns the value of attribute constant_namespaces.
-
#constants_graph ⇒ Boolean
Returns the value of attribute constants_graph.
-
#constants_graph_max_depth ⇒ Integer
Returns the value of attribute constants_graph_max_depth.
-
#constants_graph_max_nodes ⇒ Integer
Returns the value of attribute constants_graph_max_nodes.
-
#constants_max_depth ⇒ Integer
Returns the value of attribute constants_max_depth.
-
#constants_max_entries ⇒ Integer
Returns the value of attribute constants_max_entries.
-
#filesystem_content_hash_bytes ⇒ Integer
Returns the value of attribute filesystem_content_hash_bytes.
-
#filesystem_exclude_patterns ⇒ Array[String]
Returns the value of attribute filesystem_exclude_patterns.
-
#filesystem_max_depth ⇒ Integer?
Returns the value of attribute filesystem_max_depth.
-
#filesystem_max_entries ⇒ Integer
Returns the value of attribute filesystem_max_entries.
-
#filesystem_paths ⇒ Array[String]
Returns the value of attribute filesystem_paths.
-
#forensic ⇒ Boolean
Returns the value of attribute forensic.
-
#on_pollution ⇒ Symbol
Returns the value of attribute on_pollution.
-
#probe_sampling ⇒ Hash[Symbol, Integer]
Returns the value of attribute probe_sampling.
-
#probes ⇒ Array[Symbol]
Returns the value of attribute probes.
-
#rails_config_paths ⇒ Array[String]
Returns the value of attribute rails_config_paths.
-
#randomness_seed_probe ⇒ Boolean
Returns the value of attribute randomness_seed_probe.
-
#report_probe_errors ⇒ Boolean
Returns the value of attribute report_probe_errors.
-
#resource_process_probe ⇒ Boolean
Returns the value of attribute resource_process_probe.
-
#root_path ⇒ String
Returns the value of attribute root_path.
-
#track_resource_origins ⇒ Boolean
Returns the value of attribute track_resource_origins.
Instance Method Summary collapse
- #allow {|allowlist| ... } ⇒ Object
- #auto_reset_probe?(name) ⇒ Boolean
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #probe_interval(name) ⇒ Integer
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/rspec/hermetic/configuration.rb', line 34 def initialize @probes = %i[env constants globals ruby_runtime rails time randomness resources] @on_pollution = :risky @root_path = Dir.pwd @constant_namespaces = [] @constant_exclude_patterns = [] @constants_max_depth = 0 @constants_max_entries = 1_000 @constants_graph = true @constants_graph_max_depth = 3 @constants_graph_max_nodes = 1_000 @filesystem_paths = ["."] @filesystem_exclude_patterns = %w[ .git .git/** .bundle .bundle/** vendor/bundle vendor/bundle/** node_modules node_modules/** ] @filesystem_content_hash_bytes = 64 * 1024 @filesystem_max_entries = 1_000 @filesystem_max_depth = nil @forensic = false @randomness_seed_probe = false @resource_process_probe = false @rails_config_paths = %w[ cache_store time_zone active_job.queue_adapter action_mailer.delivery_method action_controller.allow_forgery_protection i18n.default_locale ] @probe_sampling = {} @report_probe_errors = true @candidate_report_path = "tmp/rspec_hermetic_candidates.json" @auto_reset = false @track_resource_origins = true @allowlist = Allowlist.new @allowlist.path "tmp/**", "log/**", ".rspec_status", "coverage/**" end |
Instance Attribute Details
#allowlist ⇒ Allowlist (readonly)
Returns the value of attribute allowlist.
32 33 34 |
# File 'lib/rspec/hermetic/configuration.rb', line 32 def allowlist @allowlist end |
#auto_reset ⇒ Object
Returns the value of attribute auto_reset.
8 9 10 |
# File 'lib/rspec/hermetic/configuration.rb', line 8 def auto_reset @auto_reset end |
#candidate_report_path ⇒ String?
Returns the value of attribute candidate_report_path.
8 9 10 |
# File 'lib/rspec/hermetic/configuration.rb', line 8 def candidate_report_path @candidate_report_path end |
#constant_exclude_patterns ⇒ Array[untyped]
Returns the value of attribute constant_exclude_patterns.
8 9 10 |
# File 'lib/rspec/hermetic/configuration.rb', line 8 def constant_exclude_patterns @constant_exclude_patterns end |
#constant_namespaces ⇒ Array[untyped]
Returns the value of attribute constant_namespaces.
8 9 10 |
# File 'lib/rspec/hermetic/configuration.rb', line 8 def constant_namespaces @constant_namespaces end |
#constants_graph ⇒ Boolean
Returns the value of attribute constants_graph.
8 9 10 |
# File 'lib/rspec/hermetic/configuration.rb', line 8 def constants_graph @constants_graph end |
#constants_graph_max_depth ⇒ Integer
Returns the value of attribute constants_graph_max_depth.
8 9 10 |
# File 'lib/rspec/hermetic/configuration.rb', line 8 def constants_graph_max_depth @constants_graph_max_depth end |
#constants_graph_max_nodes ⇒ Integer
Returns the value of attribute constants_graph_max_nodes.
8 9 10 |
# File 'lib/rspec/hermetic/configuration.rb', line 8 def constants_graph_max_nodes @constants_graph_max_nodes end |
#constants_max_depth ⇒ Integer
Returns the value of attribute constants_max_depth.
8 9 10 |
# File 'lib/rspec/hermetic/configuration.rb', line 8 def constants_max_depth @constants_max_depth end |
#constants_max_entries ⇒ Integer
Returns the value of attribute constants_max_entries.
8 9 10 |
# File 'lib/rspec/hermetic/configuration.rb', line 8 def constants_max_entries @constants_max_entries end |
#filesystem_content_hash_bytes ⇒ Integer
Returns the value of attribute filesystem_content_hash_bytes.
8 9 10 |
# File 'lib/rspec/hermetic/configuration.rb', line 8 def filesystem_content_hash_bytes @filesystem_content_hash_bytes end |
#filesystem_exclude_patterns ⇒ Array[String]
Returns the value of attribute filesystem_exclude_patterns.
8 9 10 |
# File 'lib/rspec/hermetic/configuration.rb', line 8 def filesystem_exclude_patterns @filesystem_exclude_patterns end |
#filesystem_max_depth ⇒ Integer?
Returns the value of attribute filesystem_max_depth.
8 9 10 |
# File 'lib/rspec/hermetic/configuration.rb', line 8 def filesystem_max_depth @filesystem_max_depth end |
#filesystem_max_entries ⇒ Integer
Returns the value of attribute filesystem_max_entries.
8 9 10 |
# File 'lib/rspec/hermetic/configuration.rb', line 8 def filesystem_max_entries @filesystem_max_entries end |
#filesystem_paths ⇒ Array[String]
Returns the value of attribute filesystem_paths.
8 9 10 |
# File 'lib/rspec/hermetic/configuration.rb', line 8 def filesystem_paths @filesystem_paths end |
#forensic ⇒ Boolean
Returns the value of attribute forensic.
8 9 10 |
# File 'lib/rspec/hermetic/configuration.rb', line 8 def forensic @forensic end |
#on_pollution ⇒ Symbol
Returns the value of attribute on_pollution.
8 9 10 |
# File 'lib/rspec/hermetic/configuration.rb', line 8 def on_pollution @on_pollution end |
#probe_sampling ⇒ Hash[Symbol, Integer]
Returns the value of attribute probe_sampling.
8 9 10 |
# File 'lib/rspec/hermetic/configuration.rb', line 8 def probe_sampling @probe_sampling end |
#probes ⇒ Array[Symbol]
Returns the value of attribute probes.
8 9 10 |
# File 'lib/rspec/hermetic/configuration.rb', line 8 def probes @probes end |
#rails_config_paths ⇒ Array[String]
Returns the value of attribute rails_config_paths.
8 9 10 |
# File 'lib/rspec/hermetic/configuration.rb', line 8 def rails_config_paths @rails_config_paths end |
#randomness_seed_probe ⇒ Boolean
Returns the value of attribute randomness_seed_probe.
8 9 10 |
# File 'lib/rspec/hermetic/configuration.rb', line 8 def randomness_seed_probe @randomness_seed_probe end |
#report_probe_errors ⇒ Boolean
Returns the value of attribute report_probe_errors.
8 9 10 |
# File 'lib/rspec/hermetic/configuration.rb', line 8 def report_probe_errors @report_probe_errors end |
#resource_process_probe ⇒ Boolean
Returns the value of attribute resource_process_probe.
8 9 10 |
# File 'lib/rspec/hermetic/configuration.rb', line 8 def resource_process_probe @resource_process_probe end |
#root_path ⇒ String
Returns the value of attribute root_path.
8 9 10 |
# File 'lib/rspec/hermetic/configuration.rb', line 8 def root_path @root_path end |
#track_resource_origins ⇒ Boolean
Returns the value of attribute track_resource_origins.
8 9 10 |
# File 'lib/rspec/hermetic/configuration.rb', line 8 def track_resource_origins @track_resource_origins end |
Instance Method Details
#allow {|allowlist| ... } ⇒ Object
79 80 81 |
# File 'lib/rspec/hermetic/configuration.rb', line 79 def allow yield allowlist end |
#auto_reset_probe?(name) ⇒ Boolean
88 89 90 |
# File 'lib/rspec/hermetic/configuration.rb', line 88 def auto_reset_probe?(name) auto_reset == true || Array(auto_reset).map(&:to_sym).include?(name.to_sym) end |
#probe_interval(name) ⇒ Integer
83 84 85 86 |
# File 'lib/rspec/hermetic/configuration.rb', line 83 def probe_interval(name) interval = probe_sampling.fetch(name.to_sym, 1).to_i interval.positive? ? interval : 1 end |