Sha256: 9278e7799a8519ccd41a6dc21640b5d1cd3461661fb1ae6fdf9114df00b1b572
Contents?: true
Size: 1.89 KB
Versions: 1
Compression:
Stored size: 1.89 KB
Contents
require 'spec_helper' describe RolloutUi::Feature do before do # Request a feature to prime RolloutUi::Wrapper rollout instance $rollout.active?(:featureA, mock(:user, :id => 5)) @feature = RolloutUi::Feature.new(:featureA) end describe "#percentage" do it "returns the activated percentage for the feature" do $rollout.activate_percentage(:featureA, 75) @feature.percentage.should == "75" end end describe "#percentage=" do it "sets the activated percentage for the feature" do @feature.percentage = 90 RolloutUi::Feature.new(:featureA).percentage.should == "90" end end describe "#groups" do it "returns an empty array when there are no activated groups for the feature" do $redis.del('feature:featureA:groups') @feature.groups.should == [] end it "returns the activated groups for the feature" do $rollout.activate_group(:featureA, :beta_testers) @feature.groups.should == [:beta_testers] end end describe "#groups=" do it "sets the activated groups for the feature" do @feature.groups = ["all", "admins"] RolloutUi::Feature.new(:featureA).groups.should =~ [:admins, :all] end end describe "#users" do it "returns an empty array when there are no activated users for the feature" do $redis.del('=feature:featureA:users') @feature.user_ids.should == [] end it "returns the activated users for the feature" do $rollout.activate_user(:featureA, mock(:user, :id => 5)) @feature.user_ids.should == ["5"] end end describe "#users=" do it "sets the activated users for the feature" do @feature.user_ids = [5, "7", ""] RolloutUi::Feature.new(:featureA).user_ids.length.should == 2 RolloutUi::Feature.new(:featureA).user_ids.should include("5") RolloutUi::Feature.new(:featureA).user_ids.should include("7") end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rollout_ui-0.3.0 | spec/lib/rollout_ui/feature_spec.rb |