vanity 1.9.3 → 2.0.0.beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. data/.gitignore +0 -1
  2. data/.travis.yml +2 -53
  3. data/Appraisals +3 -12
  4. data/CHANGELOG +1 -5
  5. data/Gemfile +0 -10
  6. data/Gemfile.lock +3 -38
  7. data/README.rdoc +2 -13
  8. data/Rakefile +7 -13
  9. data/bin/vanity +0 -1
  10. data/doc/rails.textile +0 -12
  11. data/gemfiles/rails32.gemfile +2 -4
  12. data/gemfiles/rails32.gemfile.lock +6 -14
  13. data/gemfiles/rails4.gemfile +1 -4
  14. data/gemfiles/rails4.gemfile.lock +5 -15
  15. data/lib/vanity/adapters/active_record_adapter.rb +14 -10
  16. data/lib/vanity/experiment/ab_test.rb +1 -1
  17. data/lib/vanity/frameworks/rails.rb +11 -17
  18. data/lib/vanity/frameworks.rb +3 -10
  19. data/lib/vanity/metric/active_record.rb +20 -19
  20. data/lib/vanity/playground.rb +1 -3
  21. data/lib/vanity/version.rb +1 -1
  22. data/test/adapters/redis_adapter_test.rb +26 -27
  23. data/test/autoconnect_test.rb +19 -17
  24. data/test/cli_test.rb +19 -26
  25. data/test/experiment/ab_test.rb +2 -15
  26. data/test/experiment/base_test.rb +18 -22
  27. data/test/frameworks/rails/action_controller_test.rb +184 -0
  28. data/test/frameworks/rails/action_mailer_test.rb +65 -0
  29. data/test/{rails_helper_test.rb → frameworks/rails/action_view_test.rb} +1 -1
  30. data/test/frameworks/rails/rails_test.rb +285 -0
  31. data/test/helper_test.rb +13 -10
  32. data/test/metric/active_record_test.rb +50 -66
  33. data/test/metric/base_test.rb +39 -41
  34. data/test/metric/google_analytics_test.rb +13 -16
  35. data/test/metric/remote_test.rb +18 -19
  36. data/test/playground_test.rb +1 -1
  37. data/test/test_helper.rb +25 -43
  38. data/test/{rails_dashboard_test.rb → web/rails/dashboard_test.rb} +2 -1
  39. data/vanity.gemspec +3 -2
  40. metadata +33 -33
  41. data/gemfiles/rails3.gemfile +0 -32
  42. data/gemfiles/rails3.gemfile.lock +0 -172
  43. data/gemfiles/rails31.gemfile +0 -32
  44. data/gemfiles/rails31.gemfile.lock +0 -181
  45. data/generators/templates/vanity_migration.rb +0 -54
  46. data/generators/vanity_generator.rb +0 -8
  47. data/test/myapp/app/controllers/application_controller.rb +0 -2
  48. data/test/myapp/app/controllers/main_controller.rb +0 -7
  49. data/test/myapp/config/boot.rb +0 -110
  50. data/test/myapp/config/environment.rb +0 -10
  51. data/test/myapp/config/environments/production.rb +0 -0
  52. data/test/myapp/config/routes.rb +0 -3
  53. data/test/passenger_test.rb +0 -52
  54. data/test/rails_test.rb +0 -554
@@ -1,15 +1,8 @@
1
1
  # Automatically configure Vanity.
2
2
  if defined?(Rails)
3
- if Rails.const_defined?(:Railtie) # Rails 3
4
- class Plugin < Rails::Railtie # :nodoc:
5
- initializer "vanity.require" do |app|
6
- require 'vanity/frameworks/rails'
7
- Vanity::Rails.load!
8
- end
9
- end
10
- else
11
- Rails.configuration.after_initialize do
12
- require 'vanity/frameworks/rails'
3
+ class Plugin < Rails::Railtie # :nodoc:
4
+ initializer "vanity.require" do |app|
5
+ require 'vanity/frameworks/rails'
13
6
  Vanity::Rails.load!
14
7
  end
15
8
  end
@@ -35,18 +35,21 @@ module Vanity
35
35
  # @since 1.2.0
36
36
  # @see Vanity::Metric::ActiveRecord
37
37
  def model(class_or_scope, options = nil)
38
- options = options || {}
39
- conditions = options.delete(:conditions)
40
- @ar_scoped = conditions ? class_or_scope.scoped(:conditions=>conditions) : class_or_scope
41
- @ar_aggregate = AGGREGATES.find { |key| options.has_key?(key) }
42
- @ar_column = options.delete(@ar_aggregate)
43
- fail "Cannot use multiple aggregates in a single metric" if AGGREGATES.find { |key| options.has_key?(key) }
44
- @ar_timestamp = options.delete(:timestamp) || :created_at
45
- @ar_timestamp, @ar_timestamp_table = @ar_timestamp.to_s.split('.').reverse
46
- @ar_timestamp_table ||= @ar_scoped.table_name
47
- fail "Unrecognized options: #{options.keys * ", "}" unless options.empty?
48
- @ar_scoped.after_create self
49
- extend ActiveRecord
38
+ ActiveSupport.on_load(:active_record, :yield=>true) do
39
+ class_or_scope = class_or_scope.constantize if class_or_scope.is_a?(String)
40
+ options = options || {}
41
+ conditions = options.delete(:conditions)
42
+ @ar_scoped = conditions ? class_or_scope.scoped(:conditions=>conditions) : class_or_scope
43
+ @ar_aggregate = AGGREGATES.find { |key| options.has_key?(key) }
44
+ @ar_column = options.delete(@ar_aggregate)
45
+ fail "Cannot use multiple aggregates in a single metric" if AGGREGATES.find { |key| options.has_key?(key) }
46
+ @ar_timestamp = options.delete(:timestamp) || :created_at
47
+ @ar_timestamp, @ar_timestamp_table = @ar_timestamp.to_s.split('.').reverse
48
+ @ar_timestamp_table ||= @ar_scoped.table_name
49
+ fail "Unrecognized options: #{options.keys * ", "}" unless options.empty?
50
+ @ar_scoped.after_create self
51
+ extend ActiveRecord
52
+ end
50
53
  end
51
54
 
52
55
  # Calling model method on a metric extends it with these modules, redefining
@@ -57,13 +60,11 @@ module Vanity
57
60
 
58
61
  # This values method queries the database.
59
62
  def values(sdate, edate)
60
- begin
61
- time = Time.now.in_time_zone
62
- difference = time.to_date - Date.today
63
- sdate = sdate + difference
64
- edate = edate + difference
65
- rescue NoMethodError #In Rails 2.3, if no time zone has been set this fails
66
- end
63
+ time = Time.now.in_time_zone
64
+ difference = time.to_date - Date.today
65
+ sdate = sdate + difference
66
+ edate = edate + difference
67
+
67
68
  query = { :conditions=> { @ar_timestamp_table => { @ar_timestamp => (sdate.to_time...(edate + 1).to_time) } },
68
69
  :group=>"date(#{@ar_scoped.quoted_table_name}.#{@ar_scoped.connection.quote_column_name @ar_timestamp})" }
69
70
  grouped = @ar_column ? @ar_scoped.send(@ar_aggregate, @ar_column, query) : @ar_scoped.count(query)
@@ -492,9 +492,7 @@ module Vanity
492
492
 
493
493
  # Path to template.
494
494
  def template(name)
495
- path = File.join(File.dirname(__FILE__), "templates/#{name}")
496
- path << ".erb" unless name["."]
497
- path
495
+ File.join(File.dirname(__FILE__), "templates/#{name}")
498
496
  end
499
497
  end
500
498
  end
@@ -1,5 +1,5 @@
1
1
  module Vanity
2
- VERSION = "1.9.3"
2
+ VERSION = "2.0.0.beta"
3
3
 
4
4
  module Version
5
5
  version = VERSION.to_s.split(".").map { |i| i.to_i }
@@ -1,15 +1,14 @@
1
- require 'test/test_helper'
1
+ require "test_helper"
2
2
 
3
- class RedisAdapterTest < Test::Unit::TestCase
4
- def setup
5
- require "vanity/adapters/redis_adapter"
3
+ describe Vanity::Adapters::RedisAdapter do
4
+ before do
6
5
  require "redis"
7
6
  require "redis/namespace"
8
7
  end
9
8
 
10
- def test_warn_on_disconnect_error
9
+ it "warns on disconnect error" do
11
10
  if defined?(Redis)
12
- assert_nothing_raised do
11
+ assert_silent do
13
12
  Redis.any_instance.stubs(:connect!)
14
13
  mocked_redis = stub("Redis")
15
14
  mocked_redis.expects(:client).raises(RuntimeError)
@@ -29,98 +28,98 @@ class RedisAdapterTest < Test::Unit::TestCase
29
28
  [redis_adapter, mocked_redis]
30
29
  end
31
30
 
32
- def test_connect_to_existing_redis
31
+ it "connects to existing redis" do
33
32
  mocked_redis = stub("Redis")
34
33
  adapter = Vanity::Adapters.redis_connection(:redis => mocked_redis)
35
34
  assert_equal mocked_redis, adapter.redis
36
35
  end
37
36
 
38
- def test_graceful_failure_metric_track
37
+ it "gracefully fails in #metric_track" do
39
38
  redis_adapter, mocked_redis = stub_redis
40
39
  mocked_redis.stubs(:incrby).raises(RuntimeError)
41
40
 
42
- assert_nothing_raised do
41
+ assert_silent do
43
42
  redis_adapter.metric_track("metric", Time.now.to_s, "3ff62e2fb51f0b22646a342a2d357aec", [1])
44
43
  end
45
44
  end
46
45
 
47
- def test_graceful_failure_set_experiment_created_at
46
+ it "gracefully fails in #set experiment created at" do
48
47
  redis_adapter, mocked_redis = stub_redis
49
48
  mocked_redis.stubs(:setnx).raises(RuntimeError)
50
49
 
51
- assert_nothing_raised do
50
+ assert_silent do
52
51
  redis_adapter.set_experiment_created_at("price_options", Time.now)
53
52
  end
54
53
  end
55
54
 
56
- def test_graceful_failure_is_experiment_completed?
55
+ it "gracefully fails in #is_experiment_completed?" do
57
56
  redis_adapter, mocked_redis = stub_redis
58
57
  mocked_redis.stubs(:exists).raises(RuntimeError)
59
58
 
60
- assert_nothing_raised do
59
+ assert_silent do
61
60
  redis_adapter.is_experiment_completed?("price_options")
62
61
  end
63
62
  end
64
63
 
65
- def test_graceful_failure_ab_show
64
+ it "gracefully fails in #ab_show" do
66
65
  redis_adapter, mocked_redis = stub_redis
67
66
  mocked_redis.stubs(:[]=).raises(RuntimeError)
68
67
 
69
- assert_nothing_raised do
68
+ assert_silent do
70
69
  redis_adapter.ab_show("price_options", "3ff62e2fb51f0b22646a342a2d357aec", 0)
71
70
  end
72
71
  end
73
72
 
74
- def test_graceful_failure_ab_showing
73
+ it "gracefully fails in #ab_showing" do
75
74
  redis_adapter, mocked_redis = stub_redis
76
75
  mocked_redis.stubs(:[]).raises(RuntimeError)
77
76
 
78
- assert_nothing_raised do
77
+ assert_silent do
79
78
  redis_adapter.ab_showing("price_options", "3ff62e2fb51f0b22646a342a2d357aec")
80
79
  end
81
80
  end
82
81
 
83
- def test_graceful_failure_ab_not_showing
82
+ it "gracefully fails in #ab_not_showing" do
84
83
  redis_adapter, mocked_redis = stub_redis
85
84
  mocked_redis.stubs(:del).raises(RuntimeError)
86
85
 
87
- assert_nothing_raised do
86
+ assert_silent do
88
87
  redis_adapter.ab_not_showing("price_options", "3ff62e2fb51f0b22646a342a2d357aec")
89
88
  end
90
89
  end
91
90
 
92
- def test_graceful_failure_ab_add_participant
91
+ it "gracefully fails in #ab_add_participant" do
93
92
  redis_adapter, mocked_redis = stub_redis
94
93
  mocked_redis.stubs(:sadd).raises(RuntimeError)
95
94
 
96
- assert_nothing_raised do
95
+ assert_silent do
97
96
  redis_adapter.ab_add_participant("price_options", "3ff62e2fb51f0b22646a342a2d357aec", 0)
98
97
  end
99
98
  end
100
99
 
101
- def test_graceful_failure_ab_seen
100
+ it "gracefully fails in #ab_seen" do
102
101
  redis_adapter, mocked_redis = stub_redis
103
102
  mocked_redis.stubs(:sismember).raises(RuntimeError)
104
103
 
105
- assert_nothing_raised do
104
+ assert_silent do
106
105
  redis_adapter.ab_seen("price_options", "3ff62e2fb51f0b22646a342a2d357aec", 0)
107
106
  end
108
107
  end
109
108
 
110
- def test_graceful_failure_ab_assigned
109
+ it "gracefully fails in #ab_assigned" do
111
110
  redis_adapter, mocked_redis = stub_redis
112
111
  mocked_redis.stubs(:sismember).raises(RuntimeError)
113
112
 
114
- assert_nothing_raised do
113
+ assert_silent do
115
114
  redis_adapter.ab_assigned("price_options", "3ff62e2fb51f0b22646a342a2d357aec")
116
115
  end
117
116
  end
118
117
 
119
- def test_graceful_failure_ab_add_conversion
118
+ it "gracefully fails in #ab_add_conversion" do
120
119
  redis_adapter, mocked_redis = stub_redis
121
120
  mocked_redis.stubs(:sismember).raises(RuntimeError)
122
121
 
123
- assert_nothing_raised do
122
+ assert_silent do
124
123
  redis_adapter.ab_add_conversion("price_options", 0, "3ff62e2fb51f0b22646a342a2d357aec")
125
124
  end
126
125
  end
@@ -1,22 +1,24 @@
1
- require "test/test_helper"
1
+ require "test_helper"
2
2
 
3
- context ".playground_should_autoconnect?" do
3
+ describe Vanity::Autoconnect do
4
+ describe ".playground_should_autoconnect?" do
4
5
 
5
- test "returns true by default" do
6
- autoconnect = Vanity::Autoconnect.playground_should_autoconnect?
7
- assert autoconnect == true
8
- end
6
+ it "returns true by default" do
7
+ autoconnect = Vanity::Autoconnect.playground_should_autoconnect?
8
+ assert autoconnect == true
9
+ end
9
10
 
10
- test "returns false if environment flag is set" do
11
- ENV['VANITY_DISABLED'] = '1'
12
- autoconnect = Vanity::Autoconnect.playground_should_autoconnect?
13
- assert autoconnect == false
14
- ENV['VANITY_DISABLED'] = nil
15
- end
11
+ it "returns false if environment flag is set" do
12
+ ENV['VANITY_DISABLED'] = '1'
13
+ autoconnect = Vanity::Autoconnect.playground_should_autoconnect?
14
+ assert autoconnect == false
15
+ ENV['VANITY_DISABLED'] = nil
16
+ end
16
17
 
17
- test "returns false if in assets:precompile rake task" do
18
- Rake.expects(:application).returns(stub(:top_level_tasks => ['assets:precompile']))
19
- autoconnect = Vanity::Autoconnect.playground_should_autoconnect?
20
- assert autoconnect == false
18
+ it "returns false if in assets:precompile rake task" do
19
+ Rake.expects(:application).returns(stub(:top_level_tasks => ['assets:precompile']))
20
+ autoconnect = Vanity::Autoconnect.playground_should_autoconnect?
21
+ assert autoconnect == false
22
+ end
21
23
  end
22
- end
24
+ end
data/test/cli_test.rb CHANGED
@@ -1,53 +1,46 @@
1
- require "test/test_helper"
1
+ require "test_helper"
2
2
 
3
- class PlaygroundTest < Test::Unit::TestCase
3
+ describe "bin/vanity" do
4
4
 
5
- def test_responds_to_version
6
- (RUBY_VERSION == "1.8.7" ? Object : IO).any_instance.expects(:puts)
7
- ARGV.clear
8
- ARGV << '--version'
9
- load "bin/vanity"
10
- rescue SystemExit => e
11
- assert e.status == 0
5
+ it "responds to version" do
6
+ proc {
7
+ IO.any_instance.expects(:puts)
8
+ ARGV.clear
9
+ ARGV << '--version'
10
+ load "bin/vanity"
11
+ }.must_raise SystemExit
12
12
  end
13
13
 
14
- def test_responds_to_help
15
- (RUBY_VERSION == "1.8.7" ? Object : IO).any_instance.expects(:puts)
16
- ARGV.clear
17
- ARGV << '--help'
18
- load "bin/vanity"
19
- rescue SystemExit => e
20
- assert e.status == 0
14
+ it "responds to help" do
15
+ proc {
16
+ IO.any_instance.expects(:puts)
17
+ ARGV.clear
18
+ ARGV << '--help'
19
+ load "bin/vanity"
20
+ }.must_raise SystemExit
21
21
  end
22
22
 
23
- def test_responds_to_list
23
+ it "responds to list" do
24
24
  require "vanity/commands/list"
25
25
  Vanity::Commands.expects(:list)
26
26
  ARGV.clear
27
27
  ARGV << 'list'
28
28
  load "bin/vanity"
29
- rescue SystemExit => e
30
- assert e.status == 0
31
29
  end
32
30
 
33
- def test_responds_to_report
31
+ it "responds to report" do
34
32
  require "vanity/commands/report"
35
33
  Vanity::Commands.expects(:report)
36
34
  ARGV.clear
37
35
  ARGV << 'report'
38
36
  load "bin/vanity"
39
- rescue SystemExit => e
40
- assert e.status == 0
41
37
  end
42
38
 
43
- def test_responds_to_unknown_commands
39
+ it "responds to unknown commands" do
44
40
  require "vanity/commands/upgrade"
45
41
  Vanity::Commands.expects(:upgrade)
46
42
  ARGV.clear
47
43
  ARGV << 'upgrade'
48
44
  load "bin/vanity"
49
- rescue SystemExit => e
50
- assert e.status == 0
51
45
  end
52
-
53
46
  end
@@ -1,4 +1,4 @@
1
- require "test/test_helper"
1
+ require "test_helper"
2
2
 
3
3
  class AbTestController < ActionController::Base
4
4
  use_vanity :current_user
@@ -13,11 +13,7 @@ class AbTestController < ActionController::Base
13
13
  end
14
14
 
15
15
  def test_capture
16
- if defined?(Rails::Railtie)
17
- render :inline=>"<%= ab_test :simple do |value| %><%= value %><% end %>"
18
- else
19
- render :inline=>"<% ab_test :simple do |value| %><%= value %><% end %>"
20
- end
16
+ render :inline=>"<%= ab_test :simple do |value| %><%= value %><% end %>"
21
17
  end
22
18
 
23
19
  def track
@@ -35,15 +31,6 @@ class AbTestTest < ActionController::TestCase
35
31
  metric "Coolness"
36
32
  end
37
33
 
38
- def teardown
39
- super
40
- if RUBY_VERSION == '1.8.7'
41
- GC.enable
42
- GC.start
43
- GC.disable
44
- end
45
- end
46
-
47
34
  # -- Experiment definition --
48
35
 
49
36
  def test_requires_at_least_two_alternatives_per_experiment
@@ -1,20 +1,19 @@
1
- require "test/test_helper"
1
+ require "test_helper"
2
2
 
3
- class ExperimentTest < Test::Unit::TestCase
3
+ describe Vanity::Experiment::Base do
4
4
 
5
- def setup
6
- super
5
+ before do
7
6
  metric "Happiness"
8
7
  end
9
8
 
10
9
  # -- Defining experiment --
11
10
 
12
- def test_can_access_experiment_by_id
11
+ it "can access experiment by id" do
13
12
  exp = new_ab_test(:ice_cream_flavor) { metrics :happiness }
14
13
  assert_equal exp, experiment(:ice_cream_flavor)
15
14
  end
16
15
 
17
- def test_fail_when_defining_same_experiment_twice
16
+ it "fails when defining same experiment twice" do
18
17
  File.open "tmp/experiments/ice_cream_flavor.rb", "w" do |f|
19
18
  f.write <<-RUBY
20
19
  ab_test "Ice Cream Flavor" do
@@ -33,13 +32,13 @@ class ExperimentTest < Test::Unit::TestCase
33
32
 
34
33
  # -- Loading experiments --
35
34
 
36
- def test_fails_if_cannot_load_named_experiment
35
+ it "fails if cannot load named experiment" do
37
36
  assert_raises Vanity::NoExperimentError do
38
37
  experiment(:ice_cream_flavor)
39
38
  end
40
39
  end
41
40
 
42
- def test_loading_experiment
41
+ it "loads the experiment" do
43
42
  File.open "tmp/experiments/ice_cream_flavor.rb", "w" do |f|
44
43
  f.write <<-RUBY
45
44
  ab_test "Ice Cream Flavor" do
@@ -53,7 +52,7 @@ class ExperimentTest < Test::Unit::TestCase
53
52
  assert_equal "x", experiment(:ice_cream_flavor).xmts
54
53
  end
55
54
 
56
- def test_fails_if_error_loading_experiment
55
+ it "fails if error loading experiment" do
57
56
  File.open "tmp/experiments/ice_cream_flavor.rb", "w" do |f|
58
57
  f.write "fail 'yawn!'"
59
58
  end
@@ -62,7 +61,7 @@ class ExperimentTest < Test::Unit::TestCase
62
61
  end
63
62
  end
64
63
 
65
- def test_complains_if_not_defined_where_expected
64
+ it "complains if not defined where expected" do
66
65
  File.open "tmp/experiments/ice_cream_flavor.rb", "w" do |f|
67
66
  f.write ""
68
67
  end
@@ -71,7 +70,7 @@ class ExperimentTest < Test::Unit::TestCase
71
70
  end
72
71
  end
73
72
 
74
- def test_reloading_experiments
73
+ it "reloading experiments" do
75
74
  new_ab_test(:ab) { metrics :happiness }
76
75
  new_ab_test(:cd) { metrics :happiness }
77
76
  assert_equal 2, Vanity.playground.experiments.size
@@ -82,13 +81,13 @@ class ExperimentTest < Test::Unit::TestCase
82
81
 
83
82
  # -- Attributes --
84
83
 
85
- def test_experiment_mapping_name_to_id
84
+ it "maps the experiment name to id" do
86
85
  experiment = new_ab_test("Ice Cream Flavor/Tastes") { metrics :happiness }
87
86
  assert_equal "Ice Cream Flavor/Tastes", experiment.name
88
87
  assert_equal :ice_cream_flavor_tastes, experiment.id
89
88
  end
90
89
 
91
- def test_saving_experiment_after_definition
90
+ it "saves the experiment after definition" do
92
91
  File.open "tmp/experiments/ice_cream_flavor.rb", "w" do |f|
93
92
  f.write <<-RUBY
94
93
  ab_test "Ice Cream Flavor" do
@@ -100,19 +99,16 @@ class ExperimentTest < Test::Unit::TestCase
100
99
  Vanity.playground.experiment(:ice_cream_flavor)
101
100
  end
102
101
 
103
- def test_experiment_has_created_timestamp
102
+ it "has created timestamp" do
104
103
  new_ab_test(:ice_cream_flavor) { metrics :happiness }
105
104
  assert_kind_of Time, experiment(:ice_cream_flavor).created_at
106
105
  assert_in_delta experiment(:ice_cream_flavor).created_at.to_i, Time.now.to_i, 1
107
106
  end
108
107
 
109
- def test_experiment_keeps_created_timestamp_across_definitions
108
+ it "keeps created timestamp across definitions" do
110
109
  past = Date.today - 1
111
110
  Timecop.freeze past.to_time do
112
- puts "timecop: #{Time.now.to_i}"
113
- assert_equal past.to_time.to_i, Time.now.to_i
114
111
  new_ab_test(:ice_cream_flavor) { metrics :happiness }
115
- assert_equal past.to_time.to_i, experiment(:ice_cream_flavor).created_at.to_i
116
112
  end
117
113
 
118
114
  new_playground
@@ -121,7 +117,7 @@ class ExperimentTest < Test::Unit::TestCase
121
117
  assert_equal past.to_time.to_i, experiment(:ice_cream_flavor).created_at.to_i
122
118
  end
123
119
 
124
- def test_experiment_has_description
120
+ it "has a description" do
125
121
  new_ab_test :ice_cream_flavor do
126
122
  description "Because 31 is not enough ..."
127
123
  metrics :happiness
@@ -129,7 +125,7 @@ class ExperimentTest < Test::Unit::TestCase
129
125
  assert_equal "Because 31 is not enough ...", experiment(:ice_cream_flavor).description
130
126
  end
131
127
 
132
- def test_experiment_stores_nothing_when_collection_disabled
128
+ it "stores nothing when collection disabled" do
133
129
  not_collecting!
134
130
  new_ab_test(:ice_cream_flavor) { metrics :happiness }
135
131
  experiment(:ice_cream_flavor).complete!
@@ -139,7 +135,7 @@ class ExperimentTest < Test::Unit::TestCase
139
135
 
140
136
  # check_completion is called by derived classes, but since it's
141
137
  # part of the base_test I'm testing it here.
142
- def test_error_in_check_completion
138
+ it "handles error in check completion" do
143
139
  new_ab_test(:ab) { metrics :happiness }
144
140
  e = experiment(:ab)
145
141
  e.complete_if { true }
@@ -149,7 +145,7 @@ class ExperimentTest < Test::Unit::TestCase
149
145
  e.track!(:a, Time.now, 10)
150
146
  end
151
147
 
152
- def test_complete_updates_completed_at
148
+ it "complete updates completed_at" do
153
149
  new_ab_test(:ice_cream_flavor) { metrics :happiness }
154
150
 
155
151
  time = Time.utc(2008, 9, 1, 12, 0, 0)