Sha256: f13d50f260c7bd2dea1db1b084205b9165388ff85c01ea393969920247e519e0

Contents?: true

Size: 770 Bytes

Versions: 11

Compression:

Stored size: 770 Bytes

Contents

require 'test_helper'

class StaticSegmenterTest < Minitest::Test

  def setup
    @segmenter = Verdict::Segmenters::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_nil @segmenter.assign('id3', stub(id: 'id3'), nil)
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
verdict-0.16.1 test/segmenters/static_segmenter_test.rb
verdict-0.16.0 test/segmenters/static_segmenter_test.rb
verdict-0.15.2 test/segmenters/static_segmenter_test.rb
verdict-0.15.1 test/segmenters/static_segmenter_test.rb
verdict-0.15.0 test/segmenters/static_segmenter_test.rb
verdict-0.14.0 test/segmenters/static_segmenter_test.rb
verdict-0.13.0 test/segmenters/static_segmenter_test.rb
verdict-0.12.0 test/segmenters/static_segmenter_test.rb
verdict-0.11.0 test/segmenters/static_segmenter_test.rb
verdict-0.10.0 test/segmenters/static_segmenter_test.rb
verdict-0.9.0 test/segmenters/static_segmenter_test.rb