Sha256: fc6b99193b51a82e0917cf913e8fcd292856dbe20f03a80455a24d34cbb111c8

Contents?: true

Size: 777 Bytes

Versions: 13

Compression:

Stored size: 777 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_equal nil, @segmenter.assign('id3', stub(id: 'id3'), nil)
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
verdict-0.8.0 test/segmenters/static_segmenter_test.rb
verdict-0.7.0 test/segmenters/static_segmenter_test.rb
verdict-0.6.3 test/segmenters/static_segmenter_test.rb
verdict-0.6.2 test/segmenters/static_segmenter_test.rb
verdict-0.6.1 test/segmenters/static_segmenter_test.rb
verdict-0.6.0 test/segmenters/static_segmenter_test.rb
verdict-0.5.0 test/segmenters/static_segmenter_test.rb
verdict-0.4.1 test/segmenters/static_segmenter_test.rb
verdict-0.4.0 test/segmenters/static_segmenter_test.rb
verdict-0.3.2 test/segmenters/static_segmenter_test.rb
verdict-0.3.1 test/segmenters/static_segmenter_test.rb
verdict-0.3.0 test/segmenters/static_segmenter_test.rb
verdict-0.2.1 test/segmenters/static_segmenter_test.rb