Skip to content

Commit

Permalink
spec fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
omkarmoghe committed Apr 19, 2024
1 parent bba94b8 commit 3f692e8
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions test/test_experiment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ class TestExperiment < Minitest::Test
TestExperiment = Class.new(LabCoat::Experiment) do
attr_reader :raised_observations, :publish_io

def enabled?(num)
num.even?
def enabled?
context[:num].even?
end

def control(_num)
def control
{ result: "abc", status: :ok }
end

def candidate(_num)
def candidate
raise StandardError, "boom!"
end

Expand Down Expand Up @@ -79,7 +79,7 @@ def test_ignore?

def test_raised
assert_nil(@experiment.raised_observations)
@experiment.run!(2) # even number to enable experiment
@experiment.run!(num: 2) # even number to enable experiment
refute_includes(@experiment.raised_observations, "test-experiment.control")
assert_includes(@experiment.raised_observations, "test-experiment.candidate")
end
Expand All @@ -92,18 +92,18 @@ def test_publishable_value
end

def test_publish!
@experiment.run!(2)
@experiment.run!(num: 2)
assert_match(/"experiment":"test-experiment"/, @experiment.publish_io.read)
end

def test_run!
assert_equal(
{ result: "abc", status: :ok },
@experiment.run!(1)
@experiment.run!(num: 1)
)
assert_equal(
{ result: "abc", status: :ok },
@experiment.run!(2)
@experiment.run!(num: 2)
)
end
end

0 comments on commit 3f692e8

Please sign in to comment.