README.md in determinator-0.11.1 vs README.md in determinator-0.12.0

- old
+ new

@@ -1,17 +1,29 @@ # Determinator A gem that works with _Florence_ to deterministically calculate whether an **actor** should have a feature flag turned on or off, or which variant they should see in an experiment. -![Determinator](docs/img/determinator.jpg) +![Arnold Schwarzenegger might say "Come with me if you want to experiment" if he played The Determinator instead of The Terminator.](docs/img/determinator.jpg) -Useful documentation: +--- +#### Useful documentation + - [Terminology and Background](docs/background.md) - [Local development](docs/local_development.md) - [Example implemention in Rails](examples/determinator-rails) +#### Getting help + +For Deliveroo Employees: + +- Many people contribute to Determinator and Florence. We hang out in [this Slack channel](slack://channel?team=T03EUNC3F&id=C7437816J) +- [This JIRA board](https://deliveroo.atlassian.net/secure/RapidBoard.jspa?rapidView=156) covers pieces of work that are planned or in-flight +- [This Workplace group](https://deliveroo.facebook.com/groups/1893254264328414/) holds more general discussions about the Florence ecosystem + +At the moment we can only promise support for Determinator within Deliveroo, but if you add [issues to this github repo](https://github.com/deliveroo/determinator/issues) we'll try and help if we can! + ## Usage Once [set up](#installation), determinator can be used to determine whether a **feature flag** or **experiment** is on or off for the current user and, for experiments, which **variant** they should see. ```ruby @@ -63,9 +75,41 @@ retrieval_cache: ActiveSupport::Cache::MemoryStore.new(expires_in: 1.minute) ), errors: -> error { NewRelic::Agent.notice_error(error) }, missing_features: -> feature_name { STATSD.increment 'determinator.missing_feature', tags: ["feature:#{name}"] } ) +``` + +### Using Determinator in RSpec + +* Include those lines in `spec_helper.rb`. + + +``` +require 'rspec/determinator' + +Determinator.configure(retrieval: nil) + +``` + +* Tag your rspec test with `:determinator_support`, so `forced_determination` helper method will be available. + + +``` + +RSpec.describe "something", :determinator_support do + + context "something" do + forced_determination(:my_feature_flag, true) + forced_determination(:my_experiment, "variant_a") + + it "uses forced_determination" do + expect(Determinator.instance.feature_flag_on?(:my_feature_flag)).to eq(true) + expect(Determinator.instance.which_variant(:my_experiment)).to eq("variant_a") + end + end +end + ``` ### Retrieval Cache Determinator will function fully without a retrieval_cache set, although Determinator will produce 1 Redis query for every determination. By setting a `retrieval_cache` as an instance of `ActiveSupport::Cache::MemoryStore` (or equivalent) this can be reduced per application instance. This cache is not expired so *must* have a `expires_in` set, ideally to a short amount of time.