assaf / vanity

Experiment Driven Development for Ruby
http://vanity.labnotes.org
MIT License
1.55k stars 269 forks source link

Implement #ab_seen and #ab_assigned in MockAdapter #309

Closed urbanautomaton closed 7 years ago

urbanautomaton commented 7 years ago

Hi there,

While switching to the mock adapter for test usage, we noticed that the #ab_seen and #ab_assigned methods from the abstract adapter weren't implemented in the mock adapter.

This PR introduces test coverage for the mock adapter, and adds implementations for the missing methods. I'd really appreciate a look-over to make sure I've got the meaning of these methods correct.

At the moment I've only added tests for the metric- and experiment-related methods, not the connection management ones. This because I think the former can probably be extracted and used to test all the adapters, whereas tests for the connection management behaviour are more likely to be adapter-specific. If you're happy to merge this, I'll have a stab at sharing the tests with the redis, mongo etc. adapters.

If there's anything you'd prefer done differently, or something I've missed, just let me know. :)

Cheers, Simon

phillbaker commented 7 years ago

Thanks! Give me a day or two to look this over, but at first glance, this looks great.

I've been thinking about shared tests for the adapters a bunch, which may help if someone wants to implement a new one. I was thinking of something similar to https://github.com/jnunemaker/flipper/blob/master/lib/flipper/spec/shared_adapter_specs.rb.

phillbaker commented 7 years ago

This looks great! Had a super minor nitpick, but I'll go ahead and merge this evening if you're busy.

urbanautomaton commented 7 years ago

Haha, nitpick away. 😄