<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>test/experiment_test.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -1,27 +1,35 @@
 require &quot;rake/rdoctask&quot;
+require &quot;rake/testtask&quot;
 
 spec = Gem::Specification.load(File.expand_path(&quot;vanity.gemspec&quot;, File.dirname(__FILE__)))
 
+desc &quot;Push new release to gemcutter and git tag&quot;
 task :push do
-  version = spec.version.to_s.freeze
   sh &quot;git push&quot;
-  puts &quot;Tagging version #{version} ..&quot;
-  sh &quot;git tag #{version}&quot;
+  puts &quot;Tagging version #{spec.version} ..&quot;
+  sh &quot;git tag #{spec.version}&quot;
   sh &quot;git push --tag&quot;
   puts &quot;Building and pushing gem ..&quot;
-  sh &quot;gem build vanity.gemspec&quot;
-  sh &quot;gem push vanity-#{version}.gem&quot;
+  sh &quot;gem build #{spec.name}.gemspec&quot;
+  sh &quot;gem push #{spec.name}-#{spec.version}.gem&quot;
+end
+
+desc &quot;Install #{spec.name} locally&quot;
+task :install do
+  sh &quot;gem build #{spec.name}.gemspec&quot;
+  sudo = &quot;sudo&quot; unless File.writable?( Gem::ConfigMap[:bindir])
+  sh &quot;#{sudo} gem install #{spec.name}-#{spec.version}.gem&quot;
 end
 
 task :default=&gt;:test
-task :test do
-  FileList[&quot;test/**_test.rb&quot;].each do |file|
-    require file
-  end
+desc &quot;Run all tests&quot;
+Rake::TestTask.new do |task|
+  task.test_files = FileList['test/*_test.rb']
+  task.verbose = true
+  #task.warning = true
 end
 
 Rake::RDocTask.new(:rdoc) do |rdoc|
   rdoc.rdoc_files.include &quot;README.rdoc&quot;, &quot;lib/**/*.rb&quot;
   rdoc.options = spec.rdoc_options
-  rdoc.title = &quot;Vanity #{spec.version}&quot;
 end</diff>
      <filename>Rakefile</filename>
    </modified>
    <modified>
      <diff>@@ -3,6 +3,11 @@ module Vanity
 
     # The meat.
     class AbTest &lt; Base
+      def initialize(*args) #:nodoc:
+        super
+        @alternatives = [true, false]
+      end
+
       # Chooses a value for the given identity. This method returns different
       # values for different identities, with random distribution, and consistently
       # returns the same value for the same identity.
@@ -28,11 +33,8 @@ module Vanity
       #     alternatives &quot;red&quot;, &quot;blue&quot;, &quot;orange&quot;
       #   end
       def alternatives(*args)
-        if @alternatives
-          fail &quot;Cannot change alternatives between runs&quot; unless @alternatives == args
-        else
-          @alternatives = args
-        end
+        @alternatives = args unless args.empty?
+        @alternatives
       end
 
       # True/false A/B test. For example:</diff>
      <filename>lib/vanity/experiment/ab_test.rb</filename>
    </modified>
    <modified>
      <diff>@@ -6,13 +6,24 @@ module Vanity
       def initialize(name, &amp;block)
         @name = name.to_s
         @namespace = &quot;#{Vanity.playground.namespace}:experiments:#{name.downcase.gsub(/\W/, &quot;_&quot;)}&quot;
+        created = redis.get(key(:created_at)) || (redis.setnx(key(:created_at), Time.now.to_i) ; redis.get(key(:created_at))) 
+        @created_at = Time.at(created.to_i)
       end
 
-      attr_reader :name
+      attr_reader :name, :created_at
+     
+      # Sets of returs description. For example
+      #   experiment :simple do
+      #     description &quot;Simple experiment&quot;
+      #   end
+      #   puts &quot;Just defined: &quot; + experiment(:simple).description
+      def description(text = nil)
+        @description = text if text
+        @description
+      end
 
       # Called to save the experiment definition.
       def save #:nodoc:
-        redis.set key, to_yaml
       end
 
     protected</diff>
      <filename>lib/vanity/experiment/base.rb</filename>
    </modified>
    <modified>
      <diff>@@ -2,22 +2,19 @@ require &quot;test/test_helper&quot;
 
 class AbTestTest &lt; MiniTest::Spec
   it &quot;uses A/B test when type: :ab_test&quot; do
-    experiment :ab, type: :ab_test do
-      true_false
-    end
+    experiment(:ab, type: :ab_test) { }
     assert_instance_of Vanity::Experiment::AbTest, experiment(:ab)
   end
 
   it &quot;uses A/B as default test type&quot; do
-    experiment :default do
-      true_false
-    end
+    experiment(:default) { }
     assert_instance_of Vanity::Experiment::AbTest, experiment(:default)
   end
 
   it &quot;requires at least two alternatives per experiment&quot; do
     assert_raises RuntimeError do
       experiment :none, type: :ab_test do
+        alternatives []
       end
     end
     assert_raises RuntimeError do
@@ -30,29 +27,12 @@ class AbTestTest &lt; MiniTest::Spec
     end
   end
 
-  it &quot;complains if alternatives changed for stored definition&quot; do
-    experiment :default do
-      true_false
-    end
-
-    new_playground
-    assert_raises RuntimeError do
-      experiment :default do
-        alternatives &quot;foo&quot;, &quot;bar&quot;
-      end
-    end
-
-    new_playground
-    experiment :default do
-      true_false
-    end
-  end
-
   it &quot;returns the same alternative consistently from choice&quot; do
     experiment :foobar do
       alternatives &quot;foo&quot;, &quot;bar&quot;
     end
-    assert_match /foo|bar/, value = experiment(:foobar).choice(Vanity.identity)
+    assert value = experiment(:foobar).choice(Vanity.identity)
+    assert_match /foo|bar/, value
     1000.times do
       assert_equal value, experiment(:foobar).choice(Vanity.identity)
     end
@@ -104,8 +84,4 @@ class AbTestTest &lt; MiniTest::Spec
     totals = experiment(:foobar).measure
     assert_equal ids.size, totals.inject(0) { |a,(k,v)| a + v[:conversions] }
   end
-
-  after do
-    nuke_playground
-  end
 end</diff>
      <filename>test/ab_test_test.rb</filename>
    </modified>
    <modified>
      <diff>@@ -49,34 +49,27 @@ class PlaygroundTest &lt; MiniTest::Spec
   it &quot;returns experiment defined in file&quot; do
     playground = class &lt;&lt; Vanity.playground ; self ; end
     playground.send :define_method, :require do |file|
-      Vanity.playground.define &quot;Green Button&quot; do
-        true_false
-      end
+      Vanity.playground.define(&quot;Green Button&quot;) { }
     end
     assert_equal &quot;green_button&quot;, experiment(&quot;Green button&quot;).name
   end
 
   it &quot;can define and access experiment using symbol&quot; do
-    assert green = experiment(&quot;Green Button&quot;) { true_false }
+    assert green = experiment(&quot;Green Button&quot;) { }
     assert_equal green, experiment(:green_button)
-    assert red = experiment(:red_button) { true_false }
+    assert red = experiment(:red_button) { }
     assert_equal red, experiment(&quot;Red Button&quot;)
   end
 
   it &quot;detect and fail when defining the same experiment twice&quot; do
-    experiment &quot;Green Button&quot; do
-      true_false
-    end
+    experiment(&quot;Green Button&quot;) { }
     assert_raises RuntimeError do
-      experiment :green_button do
-        true_false
-      end
+      experiment(:green_button) { }
     end
   end
 
   it &quot;evalutes definition block when creating experiment&quot; do
     experiment :green_button do
-      true_false
       expects(:xmts).returns(&quot;x&quot;)
     end
     assert_equal &quot;x&quot;, experiment(:green_button).xmts
@@ -84,32 +77,13 @@ class PlaygroundTest &lt; MiniTest::Spec
 
   it &quot;saves experiments after defining it&quot; do
     experiment :green_button do
-      true_false
       expects(:save)
     end
   end
 
-  it &quot;loads experiment if one already exists&quot; do
-    experiment :green_button do
-      true_false
-      @xmts = &quot;x&quot;
-    end
-    Vanity.instance_variable_set :@playground, Vanity::Playground.new
-    experiment :green_button do
-      expects(:xmts).returns(@xmts)
-    end
-    assert_equal &quot;x&quot;, experiment(:green_button).xmts
-  end
-
   it &quot;uses playground namespace in experiment&quot; do
-    experiment :green_button do
-      true_false
-    end
+    experiment(:green_button) { }
     assert_equal &quot;#{@namespace}:experiments:green_button&quot;, experiment(:green_button).send(:key)
     assert_equal &quot;#{@namespace}:experiments:green_button:participants&quot;, experiment(:green_button).send(:key, &quot;participants&quot;)
   end
-
-  after do
-    nuke_playground
-  end
 end</diff>
      <filename>test/playground_test.rb</filename>
    </modified>
    <modified>
      <diff>@@ -108,9 +108,7 @@ end
 class AbTestHelpersTest &lt; ActionController::TestCase
   tests AbTestHelpersController
   def setup
-    experiment :simple_ab do
-      true_false
-    end
+    experiment(:simple_ab) { }
   end
 
   def test_fail_if_no_experiment</diff>
      <filename>test/rails_test.rb</filename>
    </modified>
    <modified>
      <diff>@@ -36,6 +36,10 @@ class MiniTest::Unit::TestCase
       Vanity.playground.experiment(name)
     end
   end
+
+  def teardown
+    nuke_playground
+  end
 end
 
 ActionController::Routing::Routes.draw do |map|</diff>
      <filename>test/test_helper.rb</filename>
    </modified>
    <modified>
      <diff>@@ -12,9 +12,9 @@ Gem::Specification.new do |spec|
   spec.executable     = &quot;vanity&quot;
 
   spec.has_rdoc         = true
-  spec.extra_rdoc_files = 'README.rdoc', 'CHANGELOG'
-  spec.rdoc_options     = '--title', 'Vanity', '--main', 'README.rdoc',
-                          '--webcvs', 'http://github.com/assaf/vanity'
+  spec.extra_rdoc_files = &quot;README.rdoc&quot;, &quot;CHANGELOG&quot;
+  spec.rdoc_options     = &quot;--title&quot;, &quot;Vanity #{spec.version}&quot;, &quot;--main&quot;, &quot;README.rdoc&quot;,
+                          &quot;--webcvs&quot;, &quot;http://github.com/assaf/#{spec.name}&quot;
 
   spec.add_dependency &quot;redis&quot;, &quot;0.1&quot;
 end</diff>
      <filename>vanity.gemspec</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>db38a01e7aa8a5642b0f746e6a8b9d05b300e02f</id>
    </parent>
  </parents>
  <author>
    <name>Assaf Arkin</name>
    <email>assaf@labnotes.org</email>
  </author>
  <url>http://github.com/assaf/vanity/commit/db700f0bd2d80cb7b71ff6ced983cf079f4c6fea</url>
  <id>db700f0bd2d80cb7b71ff6ced983cf079f4c6fea</id>
  <committed-date>2009-11-06T15:29:32-08:00</committed-date>
  <authored-date>2009-11-06T15:29:32-08:00</authored-date>
  <message>A/B tests: alternatives no longer stored in Redis.
A/B tests: default test is true/false.
Experiment only stores created_at timestamps.
Added Rake test task.</message>
  <tree>0e7d5943d104e7f1a69929c6fbf98b0122b645d8</tree>
  <committer>
    <name>Assaf Arkin</name>
    <email>assaf@labnotes.org</email>
  </committer>
</commit>
