Permalink
Browse files

Added random shortcut

  • Loading branch information...
1 parent 9db60de commit b0e371e2c9c0830a198fde71f8e4948964ac2319 @jnunemaker committed Aug 2, 2012
Showing with 18 additions and 0 deletions.
  1. +4 −0 lib/flipper/dsl.rb
  2. +14 −0 spec/flipper/dsl_spec.rb
View
@@ -42,6 +42,10 @@ def actor(actor_or_number)
Flipper::Types::Actor.new(identifier)
end
+ def random(number)
+ Flipper::Types::PercentageOfRandom.new(number)
+ end
+
private
def features
View
@@ -138,4 +138,18 @@ def feature(name)
end
end
end
+
+ describe "#random" do
+ before do
+ @result = subject.random(5)
+ end
+
+ it "returns percentage of random" do
+ @result.should be_instance_of(Flipper::Types::PercentageOfRandom)
+ end
+
+ it "sets value" do
+ @result.value.should eq(5)
+ end
+ end
end

0 comments on commit b0e371e

Please sign in to comment.