Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Sort features alphabetically

  • Loading branch information...
commit 16ce1aa2f8338819f176a37e9b0ef3c65849d817 1 parent 0e09d55
@jcmuller authored
View
2  lib/rollout_ui/wrapper.rb
@@ -18,7 +18,7 @@ def add_feature(feature)
end
def features
- redis.smembers(:features)
+ redis.smembers(:features).sort
end
def redis
View
4 spec/lib/rollout_ui/feature_spec.rb
@@ -47,8 +47,8 @@
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")
+ RolloutUi::Feature.new(:featureA).user_ids.should include("5")
+ RolloutUi::Feature.new(:featureA).user_ids.should include("7")
end
end
end
View
9 spec/lib/rollout_ui/wrapper_spec.rb
@@ -51,6 +51,15 @@
@rollout_ui.features.should == ["featureA"]
end
+
+ it "lists features in alphabetical order" do
+ $rollout.active?(:zFeature, mock(:user, :id => 1))
+ $rollout.active?(:featureA, mock(:user, :id => 5))
+ $rollout.active?(:featureB, mock(:user, :id => 6))
+ $rollout.active?(:anotherFeature, mock(:user, :id => 8))
+
+ @rollout_ui.features.should == %w(anotherFeature featureA featureB zFeature)
+ end
end
describe "#add_feature" do
View
14 spec/requests/engine/engine_spec.rb
@@ -90,6 +90,20 @@
page.should have_css("input.users[value='5']")
end
end
+
+ describe "order" do
+ before do
+ $rollout.active?(:featureB, user)
+ $rollout.active?(:anotherFeature, user)
+ end
+
+ it "shows features in alphabetical order" do
+ visit "/rollout"
+
+ elements = %w(anotherFeature featureA featureB)
+ page.body.should =~ Regexp.new("#{elements.join('.*')}.*", Regexp::MULTILINE)
+ end
+ end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.