Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/scientist/experiment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def format_observation(observation)
observation.exception.inspect.prepend(" ") + "\n" +
observation.exception.backtrace.map { |line| line.prepend(" ") }.join("\n")
else
observation.value.inspect.prepend(" ")
observation.cleaned_value.inspect.prepend(" ")
end
end
end
Expand Down
10 changes: 10 additions & 0 deletions test/scientist/experiment_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,16 @@ def @ex.raised(op, exception)
assert_raises(Scientist::Experiment::MismatchError) { @ex.run }
end

it "cleans values when raising on observation mismatch" do
Fake.raise_on_mismatches = true
@ex.use { "fine" }
@ex.try { "not fine" }
@ex.clean { "So Clean" }

err = assert_raises(Scientist::Experiment::MismatchError) { @ex.run }
assert_match /So Clean/, err.message
end

it "doesn't raise when there is a mismatch if raise on mismatches is disabled" do
Fake.raise_on_mismatches = false
@ex.use { "fine" }
Expand Down