mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Simplify to_json calls
This commit is contained in:
parent
09b6dee004
commit
dca2925461
4 changed files with 7 additions and 7 deletions
|
@ -43,7 +43,7 @@ module Spectator
|
|||
json.object do
|
||||
json.field("type", error.class.to_s)
|
||||
json.field("message", error.message)
|
||||
json.field("backtrace") { error.backtrace.to_json(json) }
|
||||
json.field("backtrace", error.backtrace)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -44,9 +44,9 @@ module Spectator::Expectations
|
|||
# Creates the JSON representation of the expectation.
|
||||
def to_json(json : ::JSON::Builder)
|
||||
json.object do
|
||||
json.field("satisfied") { satisfied?.to_json(json) }
|
||||
json.field("expected") { expected_message.to_json(json) }
|
||||
json.field("actual") { actual_message.to_json(json) }
|
||||
json.field("satisfied", satisfied?)
|
||||
json.field("expected", expected_message)
|
||||
json.field("actual", actual_message)
|
||||
json.field("values") do
|
||||
json.object do
|
||||
values.each do |labeled_value|
|
||||
|
|
|
@ -21,7 +21,7 @@ module Spectator
|
|||
private def add_json_fields(json : ::JSON::Builder)
|
||||
super
|
||||
json.field("time", elapsed.to_s)
|
||||
json.field("expectations") { expectations.to_json(json) }
|
||||
json.field("expectations", expectations)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -32,8 +32,8 @@ module Spectator
|
|||
|
||||
# Adds the common fields for a result to a JSON builder.
|
||||
private def add_json_fields(json : ::JSON::Builder)
|
||||
json.field("name") { example.to_json(json) }
|
||||
json.field("location") { example.source.to_json(json) }
|
||||
json.field("name", example)
|
||||
json.field("location", example.source)
|
||||
json.field("result", to_s)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue