Sha256: a71287c7fbc81a2f04bc1ad594bd48abed23d9621ebe1468671b53ca52993dfd

Contents?: true

Size: 775 Bytes

Versions: 1

Compression:

Stored size: 775 Bytes

Contents

require 'test_helper'

class StaticSegmenterTest < MiniTest::Unit::TestCase

  def setup
    @segmenter = Verdict::StaticSegmenter.new(Verdict::Experiment.new('test'))
    @segmenter.group :beta, ['id1', 'id2']
  end

  def test_group_definition
    assert_equal ['beta'], @segmenter.groups.keys
    assert_equal ['id1', 'id2'], @segmenter.groups['beta'].subject_identifiers
  end

  def test_group_json_representation
    json = JSON.parse(@segmenter.groups['beta'].to_json)
    assert_equal 'beta', json['handle']
    assert_equal ['id1', 'id2'], json['subject_identifiers']
  end

  def test_assigment
    assert_equal @segmenter.groups['beta'], @segmenter.assign('id2', stub(id: 'id2'), nil)
    assert_equal nil, @segmenter.assign('id3', stub(id: 'id3'), nil)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
verdict-0.2.0 test/static_segmenter_test.rb