Add MISSING_PARAM const

pull/1246/head
Rick Carlino 2019-06-24 15:06:14 -05:00
parent 6b8b45bf6b
commit adbccf06ee
3 changed files with 4 additions and 3 deletions

View File

@ -16,6 +16,7 @@ module CeleryScript
"Expected one of: %s"
T_MISMATCH = "Type mismatch. %s must be one of: %s. Got: %s"
MISSING_VAR = "You must select a Location for the Location Variable."
MISSING_PARAM = "You must select a Default Value for the Location Variable."
# Certain CeleryScript pairing errors are more than just a syntax error.
# For instance, A `nothing` node in a `parameter_declaration` is often an
@ -26,7 +27,7 @@ module CeleryScript
nothing: {
write_pin: "You must select a Peripheral in the Control Peripheral step.",
variable_declaration: MISSING_VAR,
parameter_declaration: MISSING_VAR,
parameter_declaration: MISSING_PARAM,
read_pin: "You must select a Sensor in the Read Sensor step.",
move_absolute: "You must select a Location in the Move To step.",
execute: CeleryScriptSettingsBag::NO_SUB_SEQ,

View File

@ -374,7 +374,7 @@ describe Api::SequencesController do
body: [] }
post :create, body: input.to_json, params: { format: :json }
expect(response.status).to eq(422)
expect(json[:body]).to include(CeleryScript::Checker::MISSING_VAR)
expect(json[:body]).to include(CeleryScript::Checker::MISSING_PARAM)
end
end
end

View File

@ -293,6 +293,6 @@ describe CeleryScript::Checker do
chk = CeleryScript::Checker.new(tree, corpus, device)
expect(chk.valid?).to be false
message = "must provide a value for all parameters"
expect(chk.error.message).to include(CeleryScript::Checker::MISSING_VAR)
expect(chk.error.message).to include(CeleryScript::Checker::MISSING_PARAM)
end
end