test/experiment_test.rb in verdict-0.1.0 vs test/experiment_test.rb in verdict-0.1.1
- old
+ new
@@ -35,17 +35,31 @@
assert_kind_of Verdict::Assignment, non_qualified
assert !non_qualified.qualified?
assert_equal nil, non_qualified.group
end
+ def test_disqualify_empty_identifier
+ e = Verdict::Experiment.new('test', disqualify_empty_identifier: true) do
+ groups do
+ group :a, :half
+ group :b, :rest
+ end
+ end
+
+ assert !e.assign(nil).qualified?
+ assert_equal nil, e.convert('', :mygoal)
+ end
+
def test_assignment
e = Verdict::Experiment.new('test') do
qualify { |subject| subject <= 2 }
groups do
group :a, :half
group :b, :rest
end
end
+
+ assert_raises(Verdict::EmptySubjectIdentifier) { e.assign(nil) }
assignment = e.assign(1)
assert_kind_of Verdict::Assignment, assignment
assert assignment.qualified?
assert !assignment.returning?