howaboutwe/experimental — pull request #18 by oggy (2013-10-15 21:02:02+00:00)
Title: Bucket forcing

This lays the groundwork for being able to override the bucket for a user by means of `Experimental.overrides`.

There is a spec helper included that uses `Experimental.overrides` to force a bucket for a user without the traditional brittle stubbing. You can also use `overrides` to force buckets in dev. There is a page for the latter in dating which we should extract into the gem soon too.

Additionally, this simplifies the experiments caching logic by removing the unnecessary layer that uses `Rails.cache`. Now we just cache in memory (if configured), and then ping the database directly. Inserting the memcache layer between these doesn't accomplish much.

Note this introduces some backwards incompatibilities:

### Config file

By convention, this is now called `config/experimental.yml` (was `config/experiments.yml`). "Convention" is encouraged by automatically loading this if it exists in a Railtie.

It is now keyed by environment, like most Rails plugins. It includes the cache setting (and can naturally incorporate any future library settings). It also no longer includes removed experiments.

### Rake task

Namespace has been renamed to match the gem (so `experimental:sync`, not `experiments:sync`).

### API

`Subject#experiment_bucket` now returns nil if the user is not in the experiment population. This has proven a frequent source of confusion/error, and makes this methods more useful directly in applications.