Sha256: 275a48fe66ec27e378793e8978f7320c64f96444675866019f13ee9ba572cac6

Contents?: true

Size: 1.16 KB

Versions: 24

Compression:

Stored size: 1.16 KB

Contents

require 'test_helper'

class GroupTest < Minitest::Test

  def setup
    @experiment = Verdict::Experiment.new('a')
  end

  def test_basic_properties
    group = Verdict::Group.new(@experiment, :test)

    assert_equal @experiment, group.experiment
    assert_kind_of Verdict::Group, group
    assert_equal 'test', group.handle
    assert_equal 'test', group.to_s
    assert_equal :test, group.to_sym
  end

  def test_triple_equals
    group = Verdict::Group.new(@experiment, 'control')
    assert group === Verdict::Group.new(@experiment, :control)
    assert group === 'control'
    assert group === :control
    assert !(group === nil)

    assert !(group === Verdict::Group.new(@experiment, :test))
    assert !(group === Verdict::Group.new(Verdict::Experiment.new('b'), :test))
    assert !(group === 'test')
    assert !(group === nil)
  end

  def test_json
    group = Verdict::Group.new(@experiment, 'control')
    group.name 'testing'
    group.description 'description'

    json = JSON.parse(group.to_json)
    assert_equal 'control', json['handle']
    assert_equal 'testing', json['metadata']['name']
    assert_equal 'description', json['metadata']['description']
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
verdict-0.16.1 test/group_test.rb
verdict-0.16.0 test/group_test.rb
verdict-0.15.2 test/group_test.rb
verdict-0.15.1 test/group_test.rb
verdict-0.15.0 test/group_test.rb
verdict-0.14.0 test/group_test.rb
verdict-0.13.0 test/group_test.rb
verdict-0.12.0 test/group_test.rb
verdict-0.11.0 test/group_test.rb
verdict-0.10.0 test/group_test.rb
verdict-0.9.0 test/group_test.rb
verdict-0.8.0 test/group_test.rb
verdict-0.7.0 test/group_test.rb
verdict-0.6.3 test/group_test.rb
verdict-0.6.2 test/group_test.rb
verdict-0.6.1 test/group_test.rb
verdict-0.6.0 test/group_test.rb
verdict-0.5.0 test/group_test.rb
verdict-0.4.1 test/group_test.rb
verdict-0.4.0 test/group_test.rb