Class: RSpec::Determinator::FakeControl
- Inherits:
-
Object
- Object
- RSpec::Determinator::FakeControl
- Defined in:
- lib/rspec/determinator.rb
Instance Method Summary collapse
- #fake_determinate(name, id: nil, guid: nil, properties: {}) ⇒ Object (also: #feature_flag_on?, #which_variant)
- #for_actor(**args) ⇒ Object
-
#initialize ⇒ FakeControl
constructor
A new instance of FakeControl.
- #mock_result(name, result, only_for: {}) ⇒ Object
Constructor Details
#initialize ⇒ FakeControl
Returns a new instance of FakeControl.
39 40 41 |
# File 'lib/rspec/determinator.rb', line 39 def initialize @mocked_results = Hash.new { |h, k| h[k] = {} } end |
Instance Method Details
#fake_determinate(name, id: nil, guid: nil, properties: {}) ⇒ Object Also known as: feature_flag_on?, which_variant
51 52 53 54 55 56 |
# File 'lib/rspec/determinator.rb', line 51 def fake_determinate(name, id: nil, guid: nil, properties: {}) properties[:id] = id if id properties[:guid] = guid if guid outcome_for_feature_given_properties(name.to_s, normalize_properties(properties)) end |
#for_actor(**args) ⇒ Object
43 44 45 |
# File 'lib/rspec/determinator.rb', line 43 def for_actor(**args) ::Determinator::ActorControl.new(self, **args) end |
#mock_result(name, result, only_for: {}) ⇒ Object
47 48 49 |
# File 'lib/rspec/determinator.rb', line 47 def mock_result(name, result, only_for: {}) @mocked_results[name.to_s][normalize_properties(only_for)] = result end |