Skip to content

Commit

Permalink
Fixing a bug where a group activated in redis but not defined in roll…
Browse files Browse the repository at this point in the history
…out causes user_in_active_group? to fail

Conflicts:

	lib/rollout.rb
  • Loading branch information
jamesgolick committed Jul 20, 2010
1 parent aa32792 commit 24a668a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rollout.rb
Expand Up @@ -62,7 +62,7 @@ def percentage_key(name)
end

def user_in_active_group?(feature, user)
@redis.smembers(group_key(feature)).any? { |group| @groups[group].call(user) }
@redis.smembers(group_key(feature)).any? { |group| @groups.key?(group) && @groups[group].call(user) }
end

def user_active?(feature, user)
Expand Down
5 changes: 5 additions & 0 deletions spec/rollout_spec.rb
Expand Up @@ -19,6 +19,11 @@
it "is not active for users for which the block evaluates to false" do
@rollout.should_not be_active(:chat, stub(:id => 1))
end

it "is not active if a group is found in Redis but not defined in Rollout" do
@rollout.activate_group(:chat, :fake)
@rollout.should_not be_active(:chat, stub(:id => 1))
end
end

describe "the default all group" do
Expand Down

0 comments on commit 24a668a

Please sign in to comment.