Module: RSpec::Determinator::DSL
- Defined in:
- lib/rspec/determinator.rb
Instance Method Summary collapse
-
#forced_determination(name, outcome, bucket_type: 'single', only_for: {}) ⇒ Object
Ensure that for the duration of the example all determinations made for the given experiment or feature flag will have the given outcome (but only if the constraints specified are met exactly).
Instance Method Details
#forced_determination(name, outcome, bucket_type: 'single', only_for: {}) ⇒ Object
Ensure that for the duration of the example all determinations made for the given experiment or feature flag will have the given outcome (but only if the constraints specified are met exactly).
If ‘outcome` or `only_for` are Symbols then the example-scoped variable of that name will be referenced (ie. those variables created by `let` declarations)
33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/rspec/determinator.rb', line 33 def forced_determination(name, outcome, bucket_type: 'single', only_for: {}) before do outcome = send(outcome) if outcome.is_a?(Symbol) only_for = send(only_for) if only_for.is_a?(Symbol) ::RSpec::Determinator::FakeDeterminator.new(fake_retriever).mock_result( name, outcome, bucket_type: bucket_type, only_for: only_for ) end end |