Sha256: 226f605c10fcc45ba0767f68c06b1bf8e8b48f7402e94b9e618198e2509c9ae7
Contents?: true
Size: 1.31 KB
Versions: 3
Compression:
Stored size: 1.31 KB
Contents
require 'test_helper' require 'json' class ConversionTest < Minitest::Test def setup @experiment = Verdict::Experiment.new('conversion test') do groups { group :all, 100 } end end def test_subject_lookup conversion = Verdict::Conversion.new(@experiment, 'test_subject_id', :test_goal) assert_raises(NotImplementedError) { conversion.subject } @experiment.expects(:fetch_subject).with('test_subject_id').returns(subject = mock('subject')) conversion = Verdict::Conversion.new(@experiment, 'test_subject_id', :test_goal) assert_equal subject, conversion.subject end def test_assignment_lookup @experiment.storage.expects(:retrieve_assignment).with(@experiment, 'test_subject_id') conversion = Verdict::Conversion.new(@experiment, 'test_subject_id', :test_goal) conversion.assignment end def test_json_representation conversion = Verdict::Conversion.new(@experiment, 'test_subject_id', :test_goal, Time.new(2013, 1, 1, 4, 5, 6, '+00:00')) json = JSON.parse(conversion.to_json) assert_equal 'conversion test', json['experiment'] assert_equal 'test_subject_id', json['subject'] assert_equal 'test_goal', json['goal'] assert_equal 'test_goal', json['goal'] assert_equal '2013-01-01T04:05:06Z', json['created_at'] end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
verdict-0.5.0 | test/conversion_test.rb |
verdict-0.4.1 | test/conversion_test.rb |
verdict-0.4.0 | test/conversion_test.rb |