Sha256: 1dd65348d3581a2c40a54e592ddbfe8a99f3adfafc2bcde9c14ef8d38fd5df97

Contents?: true

Size: 1.73 KB

Versions: 24

Compression:

Stored size: 1.73 KB

Contents

require 'test_helper'

class EventLoggerTest < Minitest::Test

  def setup
    @experiment = Verdict::Experiment.new(:logger) do
      groups { group :all, 100}
    end

    @logger = mock('logger')
    @event_logger = Verdict::EventLogger.new(@logger, :debug)
  end

  def test_log_unqualified_returning_assignment
    @logger.expects(:debug).with('[Verdict::Assignment] experiment=logger subject=subject status=returning qualified=false')
    assignment = Verdict::Assignment.new(@experiment, 'subject', nil, Time.now)
    @event_logger.log_assignment(assignment)
  end

  def test_log_unqualified_new_assignment
    @logger.expects(:debug).with('[Verdict::Assignment] experiment=logger subject=subject status=new qualified=false')
    assignment = Verdict::Assignment.new(@experiment, 'subject', nil, nil)
    @event_logger.log_assignment(assignment)
  end

  def test_log_qualified_returning_assignment
    @logger.expects(:debug).with('[Verdict::Assignment] experiment=logger subject=subject status=returning qualified=true group=all')
    assignment = Verdict::Assignment.new(@experiment, 'subject', @experiment.group(:all), Time.now)
    @event_logger.log_assignment(assignment)
  end

  def test_log_qualified_new_assignment
    @logger.expects(:debug).with('[Verdict::Assignment] experiment=logger subject=subject status=new qualified=true group=all')
    assignment = Verdict::Assignment.new(@experiment, 'subject', @experiment.group(:all), nil)
    @event_logger.log_assignment(assignment)
  end

  def test_log_conversion
    @logger.expects(:debug).with('[Verdict::Conversion] experiment=logger subject=subject goal=my_goal')
    conversion = Verdict::Conversion.new(@experiment, 'subject', :my_goal)
    @event_logger.log_conversion(conversion)
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

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