Skip to content
Browse files

Added Flipper.groups writer.

In case people want to have their own registry for some weird reason.
  • Loading branch information...
1 parent 34b6872 commit 94a43814d2013be6b550aaaa7226c5a8789acd9d @jnunemaker committed Aug 2, 2012
Showing with 12 additions and 0 deletions.
  1. +4 −0 lib/flipper.rb
  2. +8 −0 spec/flipper_spec.rb
View
4 lib/flipper.rb
@@ -11,6 +11,10 @@ def groups
@groups ||= Registry.new
end
+ def groups=(registry)
+ @groups = registry
+ end
+
def register(name, &block)
group = Types::Group.new(name, &block)
groups.add(group.name, group)
View
8 spec/flipper_spec.rb
@@ -7,6 +7,14 @@
end
end
+ describe ".groups=" do
+ it "sets groups registry" do
+ registry = Flipper::Registry.new
+ Flipper.groups = registry
+ Flipper.instance_variable_get("@groups").should eq(Flipper::Registry)
+ end
+ end
+
describe ".register" do
it "adds a group to the group_registry" do
group = Flipper.register(:admins) { |actor| actor.admin? }

0 comments on commit 94a4381

Please sign in to comment.
Something went wrong with that request. Please try again.