Sha256: 72eb1c6f9c765fdb2257b117446b22a9240856279e8fa8dd10e41a7987779e7b
Contents?: true
Size: 744 Bytes
Versions: 32
Compression:
Stored size: 744 Bytes
Contents
require "../exercise_generator" require "../exercise_test_case" class AcronymGenerator < ExerciseGenerator def exercise_name "acronym" end def test_cases JSON.parse(data)["cases"].first["cases"].map do |test_case| AcronymTestCase.new(test_case) end end end class AcronymTestCase < ExerciseTestCase private getter phrase : JSON::Any private getter description : JSON::Any private getter expected : JSON::Any def initialize(test_case) @phrase = test_case["input"]["phrase"] @description = test_case["description"] @expected = test_case["expected"] end def workload "Acronym.abbreviate(\"#{phrase}\").should eq(\"#{expected}\")" end def test_name "does #{description}" end end
Version data entries
32 entries across 32 versions & 1 rubygems