Bug fix: CeleryScript errors were using non-human readable #inspect method instead of #name

pull/1125/head
Rick Carlino 2019-02-25 08:34:55 -06:00
parent ac9ea0c45c
commit 1e0e033caf
3 changed files with 10 additions and 3 deletions

View File

@ -92,7 +92,7 @@ module CeleryScript
message = (FRIENDLY_ERRORS.dig(kind, parent.kind) || BAD_LEAF) % {
kind: kind,
parent_kind: parent.kind,
allowed: allowed,
allowed: allowed.map(&:name),
actual: actual
}

View File

@ -108,8 +108,10 @@ describe Api::RegimensController do
] }
post :create, body: payload.to_json, format: :json
expect(response.status).to eq(422)
expect(json.fetch(:error))
.to include("but got nothing")
msg = json.fetch(:error)
expect(msg).to include("but got nothing")
# Make sure corpus entries are properly formatted.
expect(msg).to include('"coordinate",')
end
end
end

View File

@ -68,6 +68,9 @@ describe Api::SequencesController do
post :create, body: input.to_json, params: {format: :json}
expect(response.status).to eq(422)
expect(Sequence.last).to_not be
xpectd = "Expected leaf 'wait' within 'sequence' to be one of: "\
"[\"scope_declaration\"] but got wait"
expect(json.fetch(:body)).to eq(xpectd)
end
it 'strips excess `args`' do
@ -114,6 +117,7 @@ describe Api::SequencesController do
sign_in user
post :create, body: input.to_json, params: {format: :json}
expect(response.status).to eq(422)
expect(json.fetch(:body)).to include('"tool"')
expect(json[:body]).to include("Expected leaf 'wait' within "\
"'parameter_declaration' to be one of: [")
end
@ -320,6 +324,7 @@ describe Api::SequencesController do
}
post :create, body: input.to_json, params: {format: :json}
expect(response.status).to eq(422)
expect(json.fetch(:body)).to include('"point"')
expect(json[:body]).to include("but got sync")
end