Farmbot-Web-App/spec/lib/celery_script/json_climber_spec.rb

21 lines
382 B
Ruby

fixture = {
kind: "parent",
args: {},
body: [
{
kind: "child",
args: { grandchild: { kind: "grandchild", args: {} } }
}
]
}
describe "JSONClimber" do
it 'Climbs JSON' do
results = []
CeleryScript::JSONClimber.climb(fixture) do |hmm|
results.push(hmm[:kind])
end
expect(results).to eq(["parent", "child", "grandchild"])
end
end