diff --git a/bin/generator_help.cr b/bin/generator_help.cr index 08d79b69..033dbbe7 100644 --- a/bin/generator_help.cr +++ b/bin/generator_help.cr @@ -101,27 +101,8 @@ class GeneratorHelp end end - def to_snake(input) - result = "" - input.each_char do |x| - result += x.upcase == x ? "_#{x.downcase}" : x - end - result - end - def to_capitalized(input) - result = "" - input = input.capitalize - capitalized = false - input.each_char do |x| - if x == '-' - capitalized = true - else - result += capitalized ? x.upcase : x - capitalized = false - end - end - result + input.tr("-", "_").camelcase end def status diff --git a/exercises/practice/acronym/.meta/test_template.ecr b/exercises/practice/acronym/.meta/test_template.ecr index 24fe94cb..7bb7690f 100644 --- a/exercises/practice/acronym/.meta/test_template.ecr +++ b/exercises/practice/acronym/.meta/test_template.ecr @@ -4,7 +4,7 @@ require "../src/*" describe "<%-= to_capitalized(@json["exercise"].to_s) %>" do <%- @json["cases"].as_a.each do |cases| %> <%= status()%> "<%-= cases["description"] %>" do - <%= to_capitalized(@json["exercise"].to_s) %>.<%= to_snake(cases["property"].to_s)%>("<%= cases["input"]["phrase"].to_s %>").should eq("<%= cases["expected"].to_s %>") + <%= to_capitalized(@json["exercise"].to_s) %>.<%= cases["property"].to_s.underscore %>("<%= cases["input"]["phrase"].to_s %>").should eq("<%= cases["expected"].to_s %>") end <% end %> end diff --git a/exercises/practice/all-your-base/.meta/test_template.ecr b/exercises/practice/all-your-base/.meta/test_template.ecr index eea17c99..fdb6edc7 100644 --- a/exercises/practice/all-your-base/.meta/test_template.ecr +++ b/exercises/practice/all-your-base/.meta/test_template.ecr @@ -9,10 +9,10 @@ describe "<%-= to_capitalized(@json["exercise"].to_s) %>" do output_base = <%= cases["input"]["outputBase"] %> <%- if cases["expected"].as_h? -%> expect_raises(ArgumentError) do - <%= to_capitalized(@json["exercise"].to_s) %>.<%= to_snake(cases["property"].to_s)%>(input_base, digits, output_base) + <%= to_capitalized(@json["exercise"].to_s) %>.<%= cases["property"].to_s.underscore %>(input_base, digits, output_base) end <%- else -%> - <%= to_capitalized(@json["exercise"].to_s) %>.<%= to_snake(cases["property"].to_s)%>(input_base, digits, output_base).should eq(<%= cases["expected"] %> of Int32) + <%= to_capitalized(@json["exercise"].to_s) %>.<%= cases["property"].to_s.underscore %>(input_base, digits, output_base).should eq(<%= cases["expected"] %> of Int32) <% end %> end <% end %> diff --git a/exercises/practice/allergies/.meta/test_template.ecr b/exercises/practice/allergies/.meta/test_template.ecr index c066af16..e29aa268 100644 --- a/exercises/practice/allergies/.meta/test_template.ecr +++ b/exercises/practice/allergies/.meta/test_template.ecr @@ -6,9 +6,9 @@ describe "<%-= to_capitalized(@json["exercise"].to_s) %>" do <%- cases["cases"].as_a.each do |sub_case| %> <%= status()%> "<%-= sub_case["description"] %>" do <%- if sub_case["input"]["item"]? -%> - <%= to_capitalized(@json["exercise"].to_s) %>.<%= to_snake(sub_case["property"].to_s)%>("<%= sub_case["input"]["item"] %>", <%= sub_case["input"]["score"] %>).should eq(<%= sub_case["expected"] %>) + <%= to_capitalized(@json["exercise"].to_s) %>.<%= sub_case["property"].to_s.underscore %>("<%= sub_case["input"]["item"] %>", <%= sub_case["input"]["score"] %>).should eq(<%= sub_case["expected"] %>) <%- else -%> - <%= to_capitalized(@json["exercise"].to_s) %>.<%= to_snake(sub_case["property"].to_s)%>(<%= sub_case["input"]["score"] %>).should eq(<%= sub_case["expected"]? %> of String) + <%= to_capitalized(@json["exercise"].to_s) %>.<%= sub_case["property"].to_s.underscore %>(<%= sub_case["input"]["score"] %>).should eq(<%= sub_case["expected"]? %> of String) <% end %> end <% end %> diff --git a/exercises/practice/atbash-cipher/.meta/test_template.ecr b/exercises/practice/atbash-cipher/.meta/test_template.ecr index 11b7008f..bf946110 100644 --- a/exercises/practice/atbash-cipher/.meta/test_template.ecr +++ b/exercises/practice/atbash-cipher/.meta/test_template.ecr @@ -5,7 +5,7 @@ describe "<%-= to_capitalized(@json["exercise"].to_s) %>" do <%- @json["cases"].as_a.each do |cases| %> <%- cases["cases"].as_a.each do |sub_case| %> <%= status()%> "<%-= sub_case["description"] %>" do - <%= to_capitalized(@json["exercise"].to_s) %>.<%= to_snake(sub_case["property"].to_s)%>("<%= sub_case["input"]["phrase"] %>").should eq("<%= sub_case["expected"]%>") + <%= to_capitalized(@json["exercise"].to_s) %>.<%= sub_case["property"].to_s.underscore %>("<%= sub_case["input"]["phrase"] %>").should eq("<%= sub_case["expected"]%>") end <% end %> <% end %> diff --git a/exercises/practice/bank-account/.meta/test_template.ecr b/exercises/practice/bank-account/.meta/test_template.ecr index e84e3674..b79c9f50 100644 --- a/exercises/practice/bank-account/.meta/test_template.ecr +++ b/exercises/practice/bank-account/.meta/test_template.ecr @@ -37,9 +37,9 @@ describe "<%-= to_capitalized(@json["exercise"].to_s) %>" do 1000.times { Fiber.yield } <%- elsif operations["operation"].to_s == "open" || operations["operation"].to_s == "close" -%> - bank_account.<%= to_snake(operations["operation"].to_s) %> + bank_account.<%= operations["operation"].to_s.underscore %> <%- elsif operations["operation"].to_s == "deposit" || operations["operation"].to_s == "withdraw" -%> - bank_account.<%= to_snake(operations["operation"].to_s)%>(<%= operations["amount"] %>) + bank_account.<%= operations["operation"].to_s.underscore %>(<%= operations["amount"] %>) <%- elsif operations["operation"].to_s == "balance" -%> <% if cases["expected"].as_h? %> expect_raises(ArgumentError) do diff --git a/exercises/practice/binary-search/.meta/test_template.ecr b/exercises/practice/binary-search/.meta/test_template.ecr index 78d6c609..ac8adbe4 100644 --- a/exercises/practice/binary-search/.meta/test_template.ecr +++ b/exercises/practice/binary-search/.meta/test_template.ecr @@ -8,10 +8,10 @@ describe "<%-= to_capitalized(@json["exercise"].to_s) %>" do value = <%= cases["input"]["value"] %> <%- if cases["expected"].as_h? %> expect_raises(ArgumentError) do - binary.<%= to_snake(cases["property"].to_s)%>(value) + binary.<%= cases["property"].to_s.underscore %>(value) end <%- else %> - binary.<%= to_snake(cases["property"].to_s)%>(value).should eq(<%= cases["expected"]%>) + binary.<%= cases["property"].to_s.underscore %>(value).should eq(<%= cases["expected"]%>) <%- end %> end <% end %> diff --git a/exercises/practice/collatz-conjecture/.meta/test_template.ecr b/exercises/practice/collatz-conjecture/.meta/test_template.ecr index a367a148..624ac1e4 100644 --- a/exercises/practice/collatz-conjecture/.meta/test_template.ecr +++ b/exercises/practice/collatz-conjecture/.meta/test_template.ecr @@ -6,10 +6,10 @@ describe "<%-= to_capitalized(@json["exercise"].to_s) %>" do <%= status()%> "<%-= cases["description"] %>" do <%- if cases["expected"].as_h? %> expect_raises(ArgumentError) do - <%= to_capitalized(@json["exercise"].to_s) %>.<%= to_snake(cases["property"].to_s)%>(<%= cases["input"]["number"] %>) + <%= to_capitalized(@json["exercise"].to_s) %>.<%= cases["property"].to_s.underscore %>(<%= cases["input"]["number"] %>) end <%- else %> - <%= to_capitalized(@json["exercise"].to_s) %>.<%= to_snake(cases["property"].to_s)%>(<%= cases["input"]["number"] %>).should eq(<%= cases["expected"]%>) + <%= to_capitalized(@json["exercise"].to_s) %>.<%= cases["property"].to_s.underscore %>(<%= cases["input"]["number"] %>).should eq(<%= cases["expected"]%>) <%- end %> end <% end %> diff --git a/exercises/practice/darts/.meta/test_template.ecr b/exercises/practice/darts/.meta/test_template.ecr index 0ffb33c3..1cffd889 100644 --- a/exercises/practice/darts/.meta/test_template.ecr +++ b/exercises/practice/darts/.meta/test_template.ecr @@ -4,7 +4,7 @@ require "../src/*" describe "<%-= to_capitalized(@json["exercise"].to_s) %>" do <%- @json["cases"].as_a.each do |cases| %> <%= status()%> "<%-= cases["description"] %>" do - <%= to_capitalized(@json["exercise"].to_s) %>.<%= to_snake(cases["property"].to_s)%>(<%= cases["input"]["x"].to_s.to_f %>, <%= cases["input"]["y"].to_s.to_f %>).should eq(<%= cases["expected"]%>) + <%= to_capitalized(@json["exercise"].to_s) %>.<%= cases["property"].to_s.underscore %>(<%= cases["input"]["x"].to_s.to_f %>, <%= cases["input"]["y"].to_s.to_f %>).should eq(<%= cases["expected"]%>) end <% end %> end \ No newline at end of file diff --git a/exercises/practice/difference-of-squares/.meta/test_template.ecr b/exercises/practice/difference-of-squares/.meta/test_template.ecr index 7e77a587..52d08d8b 100644 --- a/exercises/practice/difference-of-squares/.meta/test_template.ecr +++ b/exercises/practice/difference-of-squares/.meta/test_template.ecr @@ -5,7 +5,7 @@ describe "<%-= to_capitalized(@json["exercise"].to_s) %>" do <%- @json["cases"].as_a.each do |cases| %> <%- cases["cases"].as_a.each do |sub_case| %> <%= status()%> "<%-= sub_case["description"] %>" do - Squares.<%= to_snake(sub_case["property"].to_s)%>(<%= sub_case["input"]["number"] %>).should eq(<%= sub_case["expected"]%>) + Squares.<%= sub_case["property"].to_s.underscore %>(<%= sub_case["input"]["number"] %>).should eq(<%= sub_case["expected"]%>) end <% end %> <% end %> diff --git a/exercises/practice/dominoes/.meta/test_template.ecr b/exercises/practice/dominoes/.meta/test_template.ecr index 4de5d794..d92279ab 100644 --- a/exercises/practice/dominoes/.meta/test_template.ecr +++ b/exercises/practice/dominoes/.meta/test_template.ecr @@ -4,7 +4,7 @@ require "../src/*" describe "<%-= to_capitalized(@json["exercise"].to_s) %>" do <%- @json["cases"].as_a.each do |cases| %> <%= status()%> "<%-= cases["description"] %>" do - <%= to_capitalized(@json["exercise"].to_s) %>.<%= to_snake(cases["property"].to_s) %>(<%= cases["input"]["dominoes"].inspect.gsub("[]", "[] of Array(Int32)") %>).should eq(<%= cases["expected"] %>) + <%= to_capitalized(@json["exercise"].to_s) %>.<%= cases["property"].to_s.underscore %>(<%= cases["input"]["dominoes"].inspect.gsub("[]", "[] of Array(Int32)") %>).should eq(<%= cases["expected"] %>) end <% end %> end diff --git a/exercises/practice/etl/.meta/test_template.ecr b/exercises/practice/etl/.meta/test_template.ecr index b0ec19c8..c8602df4 100644 --- a/exercises/practice/etl/.meta/test_template.ecr +++ b/exercises/practice/etl/.meta/test_template.ecr @@ -6,7 +6,7 @@ describe "<%-= to_capitalized(@json["exercise"].to_s) %>" do <%= status()%> "<%-= cases["description"] %>" do input = <%= cases["input"]["legacy"].as_h%> expected = <%= cases["expected"].as_h%> - <%= @json["exercise"].to_s.upcase %>.<%= to_snake(cases["property"].to_s)%>(input).should eq(expected) + <%= @json["exercise"].to_s.upcase %>.<%= cases["property"].to_s.underscore %>(input).should eq(expected) end <% end %> end \ No newline at end of file diff --git a/exercises/practice/flatten-array/.meta/test_template.ecr b/exercises/practice/flatten-array/.meta/test_template.ecr index 9fe99b4d..c3387bea 100644 --- a/exercises/practice/flatten-array/.meta/test_template.ecr +++ b/exercises/practice/flatten-array/.meta/test_template.ecr @@ -5,9 +5,9 @@ describe "<%-= to_capitalized(@json["exercise"].to_s) %>" do <%- @json["cases"].as_a.each do |cases| %> <%= status()%> "<%-= cases["description"] %>" do <%- if cases["input"]["array"].to_s == "[[[]]]" %> -<%= to_capitalized(@json["exercise"].to_s) %>.<%= to_snake(cases["property"].to_s)%>(Array(Array(Int32)).new).should eq(<%= cases["expected"].as_a %> of Int32) +<%= to_capitalized(@json["exercise"].to_s) %>.<%= cases["property"].to_s.underscore %>(Array(Array(Int32)).new).should eq(<%= cases["expected"].as_a %> of Int32) <%- else %> - <%= to_capitalized(@json["exercise"].to_s) %>.<%= to_snake(cases["property"].to_s)%>(<%= cases["input"]["array"].to_s == "[]" ? "[] of Int32 | Nil" : cases["input"]["array"].as_a %>).should eq(<%= cases["expected"].to_s == "[]" ? "[] of Int32" : cases["expected"].as_a %>) + <%= to_capitalized(@json["exercise"].to_s) %>.<%= cases["property"].to_s.underscore %>(<%= cases["input"]["array"].to_s == "[]" ? "[] of Int32 | Nil" : cases["input"]["array"].as_a %>).should eq(<%= cases["expected"].to_s == "[]" ? "[] of Int32" : cases["expected"].as_a %>) <%- end %> end <% end %> diff --git a/exercises/practice/forth/.meta/test_template.ecr b/exercises/practice/forth/.meta/test_template.ecr index b519b9d7..9560dfec 100644 --- a/exercises/practice/forth/.meta/test_template.ecr +++ b/exercises/practice/forth/.meta/test_template.ecr @@ -12,10 +12,10 @@ describe "<%-= to_capitalized(@json["exercise"].to_s) %>" do result.should eq(<%= sub_case["expected"]? %>) <%- elsif sub_case["expected"].as_h? -%> expect_raises(ArgumentError) do - <%= to_capitalized(@json["exercise"].to_s) %>.<%= to_snake(sub_case["property"].to_s)%>("<%= sub_case["input"]["instructions"].as_a.join("") %>") + <%= to_capitalized(@json["exercise"].to_s) %>.<%= sub_case["property"].to_s.underscore %>("<%= sub_case["input"]["instructions"].as_a.join("") %>") end <%- else -%> - <%= to_capitalized(@json["exercise"].to_s) %>.<%= to_snake(sub_case["property"].to_s)%>("<%= sub_case["input"]["instructions"].as_a.join("") %>").should eq(<%= sub_case["expected"]? %> of Int32) + <%= to_capitalized(@json["exercise"].to_s) %>.<%= sub_case["property"].to_s.underscore %>("<%= sub_case["input"]["instructions"].as_a.join("") %>").should eq(<%= sub_case["expected"]? %> of Int32) <% end %> end <% end %> diff --git a/exercises/practice/hamming/.meta/test_template.ecr b/exercises/practice/hamming/.meta/test_template.ecr index 349ab1f8..2499b166 100644 --- a/exercises/practice/hamming/.meta/test_template.ecr +++ b/exercises/practice/hamming/.meta/test_template.ecr @@ -6,10 +6,10 @@ describe "<%-= to_capitalized(@json["exercise"].to_s) %>" do <%= status()%> "<%-= cases["description"] %>" do <%- if cases["expected"].as_h? %> expect_raises(ArgumentError) do - <%= to_capitalized(@json["exercise"].to_s) %>.<%= to_snake(cases["property"].to_s)%>("<%= cases["input"]["strand1"] %>", "<%= cases["input"]["strand2"] %>") + <%= to_capitalized(@json["exercise"].to_s) %>.<%= cases["property"].to_s.underscore %>("<%= cases["input"]["strand1"] %>", "<%= cases["input"]["strand2"] %>") end <%- else %> - <%= to_capitalized(@json["exercise"].to_s) %>.<%= to_snake(cases["property"].to_s)%>("<%= cases["input"]["strand1"] %>", "<%= cases["input"]["strand2"] %>").should eq(<%= cases["expected"] %>) + <%= to_capitalized(@json["exercise"].to_s) %>.<%= cases["property"].to_s.underscore %>("<%= cases["input"]["strand1"] %>", "<%= cases["input"]["strand2"] %>").should eq(<%= cases["expected"] %>) <%- end %> end <% end %> diff --git a/exercises/practice/high-scores/.meta/test_template.ecr b/exercises/practice/high-scores/.meta/test_template.ecr index c4eac5b3..82fe309e 100644 --- a/exercises/practice/high-scores/.meta/test_template.ecr +++ b/exercises/practice/high-scores/.meta/test_template.ecr @@ -9,18 +9,18 @@ describe "<%-= to_capitalized(@json["exercise"].to_s) %>" do <% if subcases["property"].to_s.includes?("After") %> high_scores = <%= to_capitalized(@json["exercise"].to_s)%>.new(<%= subcases["input"]["scores"]%>) expected = <%= subcases["expected"]%> - high_scores.<%= subcases["property"].to_s.split("After")[1] == "Best" || subcases["property"].to_s.split("After")[1] == "TopThree" ? to_snake("personal" + subcases["property"].to_s.split("After")[1]) : subcases["property"].to_s.split("After")[1]%>() - high_scores.<%= to_snake(subcases["property"].to_s.split("After")[0])%>.should eq expected + high_scores.<%= subcases["property"].to_s.split("After")[1] == "Best" || subcases["property"].to_s.split("After")[1] == "TopThree" ? ("personal" + subcases["property"].to_s.split("After")[1]).underscore : subcases["property"].to_s.split("After")[1]%>() + high_scores.<%= subcases["property"].to_s.split("After")[0].underscore %>.should eq expected <% else %> high_scores = <%= to_capitalized(@json["exercise"].to_s)%>.new(<%= subcases["input"]["scores"]%>) - high_scores.<%= to_snake(subcases["property"].to_s)%>().should eq(<%= subcases["expected"]%>) + high_scores.<%= subcases["property"].to_s.underscore %>().should eq(<%= subcases["expected"]%>) <% end %> end <% end %> <%- else -%> <%= status()%> "<%-= cases["description"] %>" do high_scores = <%= to_capitalized(@json["exercise"].to_s)%>.new(<%= cases["input"]["scores"]%>) - high_scores.<%= to_snake(cases["property"].to_s)%>().should eq(<%= cases["expected"]%>) + high_scores.<%= cases["property"].to_s.underscore %>().should eq(<%= cases["expected"]%>) end <% end %> <% end %> diff --git a/exercises/practice/knapsack/.meta/test_template.ecr b/exercises/practice/knapsack/.meta/test_template.ecr index dd28557e..2eeb89fe 100644 --- a/exercises/practice/knapsack/.meta/test_template.ecr +++ b/exercises/practice/knapsack/.meta/test_template.ecr @@ -4,8 +4,8 @@ require "../src/*" describe <%= to_capitalized(@json["exercise"].to_s).inspect %> do <% @json["cases"].as_a.each do |cases| %> <%= status()%> "<%-= cases["description"] %>" do - <%= to_snake(cases["property"].to_s) %> = <%= to_capitalized(@json["exercise"].to_s) %>.<%= to_snake(cases["property"].to_s) %>(<%= cases["input"]["maximumWeight"].inspect %>, <%= cases["input"]["items"].inspect.gsub("\"", "").gsub(" =>", ":").gsub("{", "\n{").gsub("\n{}", "[] of NamedTuple(weight: Int32, value: Int32)") %>) - <%= to_snake(cases["property"].to_s) %>.should eq(<%= cases["expected"].inspect %>) + <%= cases["property"].to_s.underscore %> = <%= to_capitalized(@json["exercise"].to_s) %>.<%= cases["property"].to_s.underscore %>(<%= cases["input"]["maximumWeight"].inspect %>, <%= cases["input"]["items"].inspect.gsub("\"", "").gsub(" =>", ":").gsub("{", "\n{").gsub("\n{}", "[] of NamedTuple(weight: Int32, value: Int32)") %>) + <%= cases["property"].to_s.underscore %>.should eq(<%= cases["expected"].inspect %>) end <% end %> end diff --git a/exercises/practice/largest-series-product/.meta/test_template.ecr b/exercises/practice/largest-series-product/.meta/test_template.ecr index 777b6f48..dd13d10d 100644 --- a/exercises/practice/largest-series-product/.meta/test_template.ecr +++ b/exercises/practice/largest-series-product/.meta/test_template.ecr @@ -11,12 +11,12 @@ describe "<%-= to_capitalized(@json["exercise"].to_s) %>" do <%- else -%> series = <%= to_capitalized(@json["exercise"].to_s) %>.new("<%= cases["input"]["digits"] %>") expect_raises(ArgumentError) do - series.<%= to_snake(cases["property"].to_s)%>(<%= cases["input"]["span"] %>) + series.<%= cases["property"].to_s.underscore %>(<%= cases["input"]["span"] %>) <% end %> end <%- else -%> series = <%= to_capitalized(@json["exercise"].to_s) %>.new("<%= cases["input"]["digits"] %>") - series.<%= to_snake(cases["property"].to_s)%>(<%= cases["input"]["span"] %>).should eq(<%= cases["expected"] %>) + series.<%= cases["property"].to_s.underscore %>(<%= cases["input"]["span"] %>).should eq(<%= cases["expected"] %>) <% end %> end <% end %> diff --git a/exercises/practice/luhn/.meta/test_template.ecr b/exercises/practice/luhn/.meta/test_template.ecr index 79fac8aa..174e568f 100644 --- a/exercises/practice/luhn/.meta/test_template.ecr +++ b/exercises/practice/luhn/.meta/test_template.ecr @@ -10,7 +10,7 @@ end describe "<%-= to_capitalized(@json["exercise"].to_s) %>" do <%- @json["cases"].as_a.each do |cases| %> <%= status()%> "<%-= cases["description"] %>" do - <%-= to_capitalized(@json["exercise"].to_s) %>.<%-= to_snake(cases["property"].to_s)%>?("<%= cases["input"]["value"] %>").should <%-= cases["expected"].as_bool ? "be_true" : "be_false" %> + <%-= to_capitalized(@json["exercise"].to_s) %>.<%-= cases["property"].to_s.underscore %>?("<%= cases["input"]["value"] %>").should <%-= cases["expected"].as_bool ? "be_true" : "be_false" %> end <% end %> end diff --git a/exercises/practice/meetup/.meta/test_template.ecr b/exercises/practice/meetup/.meta/test_template.ecr index d5ce646e..c2ba8f13 100644 --- a/exercises/practice/meetup/.meta/test_template.ecr +++ b/exercises/practice/meetup/.meta/test_template.ecr @@ -4,7 +4,7 @@ require "../src/*" describe "<%-= to_capitalized(@json["exercise"].to_s) %>" do <%- @json["cases"].as_a.each do |cases| %> <%= status()%> "<%-= cases["description"] %>" do - <%-= to_capitalized(@json["exercise"].to_s) %>.<%-= to_snake(cases["property"].to_s)%>(<%= cases["input"]["year"] %>, <%= cases["input"]["month"] %>, "<%= cases["input"]["week"] %>", "<%= cases["input"]["dayofweek"] %>").should eq("<%-= cases["expected"]%>") + <%-= to_capitalized(@json["exercise"].to_s) %>.<%-= cases["property"].to_s.underscore %>(<%= cases["input"]["year"] %>, <%= cases["input"]["month"] %>, "<%= cases["input"]["week"] %>", "<%= cases["input"]["dayofweek"] %>").should eq("<%-= cases["expected"]%>") end <% end %> end diff --git a/exercises/practice/minesweeper/.meta/test_template.ecr b/exercises/practice/minesweeper/.meta/test_template.ecr index a893907e..75d43e19 100644 --- a/exercises/practice/minesweeper/.meta/test_template.ecr +++ b/exercises/practice/minesweeper/.meta/test_template.ecr @@ -5,7 +5,7 @@ describe "<%-= to_capitalized(@json["exercise"].to_s) %>" do <%- @json["cases"].as_a.each do |cases| %> <%= status()%> "<%-= cases["description"] %>" do minesweeper = <%-= to_capitalized(@json["exercise"].to_s) %>.new(<%= cases["input"]["minefield"] %> of String) - minesweeper.<%-= to_snake(cases["property"].to_s)%>.should eq(<%-= cases["expected"].to_s.gsub("[]", "[] of String")%> ) + minesweeper.<%-= cases["property"].to_s.underscore %>.should eq(<%-= cases["expected"].to_s.gsub("[]", "[] of String") %> ) end <% end %> end diff --git a/exercises/practice/nth-prime/.meta/test_template.ecr b/exercises/practice/nth-prime/.meta/test_template.ecr index fc3e0303..12dcc11e 100644 --- a/exercises/practice/nth-prime/.meta/test_template.ecr +++ b/exercises/practice/nth-prime/.meta/test_template.ecr @@ -6,10 +6,10 @@ describe "<%-= to_capitalized(@json["exercise"].to_s) %>" do <%= status()%> "<%-= cases["description"] %>" do <%- if cases["expected"].as_h? %> expect_raises(ArgumentError) do - <%= to_capitalized(@json["exercise"].to_s) %>.<%= to_snake(cases["property"].to_s)%>(<%= cases["input"]["number"] %>) + <%= to_capitalized(@json["exercise"].to_s) %>.<%= cases["property"].to_s.underscore %>(<%= cases["input"]["number"] %>) end <%- else %> - <%= to_capitalized(@json["exercise"].to_s) %>.<%= to_snake(cases["property"].to_s)%>(<%= cases["input"]["number"] %>).should eq(<%= cases["expected"]%>) + <%= to_capitalized(@json["exercise"].to_s) %>.<%= cases["property"].to_s.underscore %>(<%= cases["input"]["number"] %>).should eq(<%= cases["expected"]%>) <%- end %> end <% end %> diff --git a/exercises/practice/nucleotide-count/.meta/test_template.ecr b/exercises/practice/nucleotide-count/.meta/test_template.ecr index fd0c8e23..124abdb8 100644 --- a/exercises/practice/nucleotide-count/.meta/test_template.ecr +++ b/exercises/practice/nucleotide-count/.meta/test_template.ecr @@ -6,12 +6,12 @@ describe "<%-= to_capitalized(@json["exercise"].to_s) %>" do <%= status()%> "<%-= cases["description"] %>" do <%- if cases["expected"]["error"]? %> expect_raises(ArgumentError) do - <%= to_capitalized(@json["exercise"].to_s) %>.<%= to_snake(cases["property"].to_s)%>("<%= cases["input"]["strand"] %>") + <%= to_capitalized(@json["exercise"].to_s) %>.<%= cases["property"].to_s.underscore %>("<%= cases["input"]["strand"] %>") end <%- else %> input = "<%= cases["input"]["strand"] %>" expected = {'A' => <%= cases["expected"]["A"] %>, 'C' => <%= cases["expected"]["C"] %>, 'G' => <%= cases["expected"]["G"] %>, 'T' => <%= cases["expected"]["T"] %>} - <%= to_capitalized(@json["exercise"].to_s) %>.<%= to_snake(cases["property"].to_s)%>(input).should eq(expected) + <%= to_capitalized(@json["exercise"].to_s) %>.<%= cases["property"].to_s.underscore %>(input).should eq(expected) <%- end %> end <% end %> diff --git a/exercises/practice/palindrome-products/.meta/test_template.ecr b/exercises/practice/palindrome-products/.meta/test_template.ecr index 910c79ab..e2db1fc5 100644 --- a/exercises/practice/palindrome-products/.meta/test_template.ecr +++ b/exercises/practice/palindrome-products/.meta/test_template.ecr @@ -7,15 +7,15 @@ describe "<%-= to_capitalized(@json["exercise"].to_s) %>" do palindrome = <%= to_capitalized(@json["exercise"].to_s) %>.new(<%= cases["input"]["min"] %>, <%= cases["input"]["max"] %>) <%- if cases["expected"]["error"]? -%> expect_raises(ArgumentError) do - palindrome.<%= to_snake(cases["property"].to_s)%>() + palindrome.<%= cases["property"].to_s.underscore %>() end <%- else -%> <%- if cases["expected"]["factors"].as_a.size == 2 -%> - result = palindrome.<%= to_snake(cases["property"].to_s)%> + result = palindrome.<%= cases["property"].to_s.underscore %> result[0].should eq <%= cases["expected"]["value"] %> <%= "[#{cases["expected"]["factors"].as_a}, #{cases["expected"]["factors"].as_a.reverse}]"%>.should contain result[1] <%- else -%> - palindrome.<%= to_snake(cases["property"].to_s)%>.should eq({<%= cases["expected"]["value"].as_i? ? cases["expected"]["value"] : "nil" %> , <%= cases["expected"]["factors"].as_a.empty? ? "#{ cases["expected"]["factors"]} of Int32": cases["expected"]["factors"]%>}) + palindrome.<%= cases["property"].to_s.underscore %>.should eq({<%= cases["expected"]["value"].as_i? ? cases["expected"]["value"] : "nil" %> , <%= cases["expected"]["factors"].as_a.empty? ? "#{ cases["expected"]["factors"]} of Int32": cases["expected"]["factors"]%>}) <%- end -%> <%- end %> end diff --git a/exercises/practice/pascals-triangle/.meta/test_template.ecr b/exercises/practice/pascals-triangle/.meta/test_template.ecr index 19236bd9..5e946083 100644 --- a/exercises/practice/pascals-triangle/.meta/test_template.ecr +++ b/exercises/practice/pascals-triangle/.meta/test_template.ecr @@ -5,7 +5,7 @@ describe "<%-= to_capitalized(@json["exercise"].to_s) %>" do <%- @json["cases"].as_a.each do |cases| %> <%= status()%> "<%-= cases["description"] %>" do output = <%= cases["expected"].to_s == "[]" ? "[] of Int32" : cases["expected"].as_a %> - <%= to_capitalized(@json["exercise"].to_s) %>.<%= to_snake(cases["property"].to_s)%>(<%= cases["input"]["count"]%>).should eq(output) + <%= to_capitalized(@json["exercise"].to_s) %>.<%= cases["property"].to_s.underscore %>(<%= cases["input"]["count"]%>).should eq(output) end <% end %> end diff --git a/exercises/practice/perfect-numbers/.meta/test_template.ecr b/exercises/practice/perfect-numbers/.meta/test_template.ecr index a969b9f7..dc59c5cf 100644 --- a/exercises/practice/perfect-numbers/.meta/test_template.ecr +++ b/exercises/practice/perfect-numbers/.meta/test_template.ecr @@ -7,10 +7,10 @@ describe "<%-= to_capitalized(@json["exercise"].to_s) %>" do <%= status()%> "<%-= sub_case["description"] %>" do <%- if sub_case["expected"].as_h? -%> expect_raises(ArgumentError) do - <%= to_capitalized(@json["exercise"].to_s) %>.<%= to_snake(sub_case["property"].to_s)%>(<%= sub_case["input"]["number"] %>) + <%= to_capitalized(@json["exercise"].to_s) %>.<%= sub_case["property"].to_s.underscore %>(<%= sub_case["input"]["number"] %>) end <%- else -%> - <%= to_capitalized(@json["exercise"].to_s) %>.<%= to_snake(sub_case["property"].to_s)%>(<%= sub_case["input"]["number"] %>).should eq("<%= sub_case["expected"] %>") + <%= to_capitalized(@json["exercise"].to_s) %>.<%= sub_case["property"].to_s.underscore %>(<%= sub_case["input"]["number"] %>).should eq("<%= sub_case["expected"] %>") <% end %> end <% end %> diff --git a/exercises/practice/prime-factors/.meta/test_template.ecr b/exercises/practice/prime-factors/.meta/test_template.ecr index 19a1f884..1aa8bf4d 100644 --- a/exercises/practice/prime-factors/.meta/test_template.ecr +++ b/exercises/practice/prime-factors/.meta/test_template.ecr @@ -4,7 +4,7 @@ require "../src/*" describe "<%-= to_capitalized(@json["exercise"].to_s) %>" do <%- @json["cases"].as_a.each do |cases| %> <%= status()%> "<%-= cases["description"] %>" do - <%= to_capitalized(@json["exercise"].to_s) %>.<%= to_snake(cases["property"].to_s)%>(<%= cases["input"]["value"] %>).should eq(<%= cases["expected"] %> of Int32) + <%= to_capitalized(@json["exercise"].to_s) %>.<%= cases["property"].to_s.underscore %>(<%= cases["input"]["value"] %>).should eq(<%= cases["expected"] %> of Int32) end <% end %> end diff --git a/exercises/practice/protein-translation/.meta/test_template.ecr b/exercises/practice/protein-translation/.meta/test_template.ecr index 29636395..58d3e1ee 100644 --- a/exercises/practice/protein-translation/.meta/test_template.ecr +++ b/exercises/practice/protein-translation/.meta/test_template.ecr @@ -6,10 +6,10 @@ describe "<%-= to_capitalized(@json["exercise"].to_s) %>" do <%= status()%> "<%-= cases["description"] %>" do <%- if cases["expected"].as_h? %> expect_raises(ArgumentError) do - <%= to_capitalized(@json["exercise"].to_s) %>.<%= to_snake(cases["property"].to_s)%>("<%= cases["input"]["strand"] %>") + <%= to_capitalized(@json["exercise"].to_s) %>.<%= cases["property"].to_s.underscore %>("<%= cases["input"]["strand"] %>") end <%- else %> - <%= to_capitalized(@json["exercise"].to_s) %>.<%= to_snake(cases["property"].to_s)%>("<%= cases["input"]["strand"] %>").should eq(<%= cases["expected"].as_a %> of String) + <%= to_capitalized(@json["exercise"].to_s) %>.<%= cases["property"].to_s.underscore %>("<%= cases["input"]["strand"] %>").should eq(<%= cases["expected"].as_a %> of String) <%- end %> end <% end %> diff --git a/exercises/practice/proverb/.meta/test_template.ecr b/exercises/practice/proverb/.meta/test_template.ecr index 1f13d44c..9a1dacb6 100644 --- a/exercises/practice/proverb/.meta/test_template.ecr +++ b/exercises/practice/proverb/.meta/test_template.ecr @@ -6,7 +6,7 @@ describe "<%-= to_capitalized(@json["exercise"].to_s) %>" do <%= status()%> "<%-= cases["description"] %>" do input = <%= cases["input"]["strings"].to_s == "[]" ? "[] of String" : cases["input"]["strings"].as_a %> output = <%= cases["expected"].to_s == "[]" ? "[] of String" : cases["expected"].as_a %> - <%= to_capitalized(@json["exercise"].to_s) %>.<%= to_snake(cases["property"].to_s)%>(input).should eq(output) + <%= to_capitalized(@json["exercise"].to_s) %>.<%= cases["property"].to_s.underscore %>(input).should eq(output) end <% end %> end diff --git a/exercises/practice/pythagorean-triplet/.meta/test_template.ecr b/exercises/practice/pythagorean-triplet/.meta/test_template.ecr index 0eacee2b..2a29c0e5 100644 --- a/exercises/practice/pythagorean-triplet/.meta/test_template.ecr +++ b/exercises/practice/pythagorean-triplet/.meta/test_template.ecr @@ -5,7 +5,7 @@ describe "<%-= to_capitalized(@json["exercise"].to_s) %>" do <%- @json["cases"].as_a.each do |cases| %> <%= status()%> "<%-= cases["description"] %>" do expected = <%= cases["expected"].to_s == "[]" ? "[] of Array(Int32)" : cases["expected"] %> - <%= to_capitalized(@json["exercise"].to_s) %>.<%= to_snake(cases["property"].to_s)%>(<%= cases["input"]["n"] %>).should eq(expected) + <%= to_capitalized(@json["exercise"].to_s) %>.<%= cases["property"].to_s.underscore %>(<%= cases["input"]["n"] %>).should eq(expected) end <% end %> end diff --git a/exercises/practice/raindrops/.meta/test_template.ecr b/exercises/practice/raindrops/.meta/test_template.ecr index 6793ba1c..4b749ddb 100644 --- a/exercises/practice/raindrops/.meta/test_template.ecr +++ b/exercises/practice/raindrops/.meta/test_template.ecr @@ -4,7 +4,7 @@ require "../src/*" describe "<%-= to_capitalized(@json["exercise"].to_s) %>" do <%- @json["cases"].as_a.each do |cases| %> <%= status()%> "<%-= cases["description"] %>" do - <%= to_capitalized(@json["exercise"].to_s) %>.<%= to_snake(cases["property"].to_s)%>(<%= cases["input"]["number"] %>).should eq("<%= cases["expected"] %>") + <%= to_capitalized(@json["exercise"].to_s) %>.<%= cases["property"].to_s.underscore %>(<%= cases["input"]["number"] %>).should eq("<%= cases["expected"] %>") end <% end %> end diff --git a/exercises/practice/resistor-color-duo/.meta/test_template.ecr b/exercises/practice/resistor-color-duo/.meta/test_template.ecr index 72ad52a4..cf121da8 100644 --- a/exercises/practice/resistor-color-duo/.meta/test_template.ecr +++ b/exercises/practice/resistor-color-duo/.meta/test_template.ecr @@ -4,7 +4,7 @@ require "../src/*" describe "<%-= to_capitalized(@json["exercise"].to_s) %>" do <%- @json["cases"].as_a.each do |cases| %> <%= status()%> "<%-= cases["description"] %>" do - <%= to_capitalized(@json["exercise"].to_s) %>.<%= to_snake(cases["property"].to_s)%>(<%= cases["input"]["colors"].as_a %>).should eq(<%= cases["expected"] %>) + <%= to_capitalized(@json["exercise"].to_s) %>.<%= cases["property"].to_s.underscore %>(<%= cases["input"]["colors"].as_a %>).should eq(<%= cases["expected"] %>) end <% end %> end diff --git a/exercises/practice/resistor-color-expert/.meta/test_template.ecr b/exercises/practice/resistor-color-expert/.meta/test_template.ecr index 762ba6aa..5056d536 100644 --- a/exercises/practice/resistor-color-expert/.meta/test_template.ecr +++ b/exercises/practice/resistor-color-expert/.meta/test_template.ecr @@ -4,7 +4,7 @@ require "../src/*" describe "<%-= to_capitalized(@json["exercise"].to_s) %>" do <%- @json["cases"].as_a.each do |cases| %> <%= status()%> "<%-= cases["description"] %>" do - <%= to_capitalized(@json["exercise"].to_s) %>.<%= to_snake(cases["property"].to_s)%>(<%= cases["input"]["colors"].as_a %>).should eq("<%= cases["expected"]["value"] %> <%= cases["expected"]["unit"] %><%= cases["expected"]["tolerance"]? ? " ±#{cases["expected"]["tolerance"]}%" : "" %>") + <%= to_capitalized(@json["exercise"].to_s) %>.<%= cases["property"].to_s.underscore %>(<%= cases["input"]["colors"].as_a %>).should eq("<%= cases["expected"]["value"] %> <%= cases["expected"]["unit"] %><%= cases["expected"]["tolerance"]? ? " ±#{cases["expected"]["tolerance"]}%" : "" %>") end <% end %> end diff --git a/exercises/practice/resistor-color-trio/.meta/test_template.ecr b/exercises/practice/resistor-color-trio/.meta/test_template.ecr index c71aef3d..54d55682 100644 --- a/exercises/practice/resistor-color-trio/.meta/test_template.ecr +++ b/exercises/practice/resistor-color-trio/.meta/test_template.ecr @@ -4,7 +4,7 @@ require "../src/*" describe "<%-= to_capitalized(@json["exercise"].to_s) %>" do <%- @json["cases"].as_a.each do |cases| %> <%= status()%> "<%-= cases["description"] %>" do - <%= to_capitalized(@json["exercise"].to_s) %>.<%= to_snake(cases["property"].to_s)%>(<%= cases["input"]["colors"].as_a %>).should eq("<%= cases["expected"]["value"] %> <%= cases["expected"]["unit"] %>") + <%= to_capitalized(@json["exercise"].to_s) %>.<%= cases["property"].to_s.underscore %>(<%= cases["input"]["colors"].as_a %>).should eq("<%= cases["expected"]["value"] %> <%= cases["expected"]["unit"] %>") end <% end %> end diff --git a/exercises/practice/resistor-color/.meta/test_template.ecr b/exercises/practice/resistor-color/.meta/test_template.ecr index 22fc7eae..c9f9203f 100644 --- a/exercises/practice/resistor-color/.meta/test_template.ecr +++ b/exercises/practice/resistor-color/.meta/test_template.ecr @@ -6,12 +6,12 @@ describe "<%-= to_capitalized(@json["exercise"].to_s) %>" do <%- if cases["cases"]? -%> <%- cases["cases"].as_a.each do |subcases| %> <%= status()%> "<%-= subcases["description"] %>" do - <%= to_capitalized(@json["exercise"].to_s)%>.<%= to_snake(subcases["property"].to_s)%>("<%= subcases["input"]["color"]%>").should eq(<%= subcases["expected"].to_s%>) + <%= to_capitalized(@json["exercise"].to_s)%>.<%= subcases["property"].to_s.underscore %>("<%= subcases["input"]["color"]%>").should eq(<%= subcases["expected"].to_s%>) end <% end %> <%- else -%> <%= status()%> "<%-= cases["description"] %>" do - <%= to_capitalized(@json["exercise"].to_s)%>.<%= to_snake(cases["property"].to_s)%>().should eq(<%= cases["expected"]%>) + <%= to_capitalized(@json["exercise"].to_s)%>.<%= cases["property"].to_s.underscore %>().should eq(<%= cases["expected"]%>) end <% end %> <% end %> diff --git a/exercises/practice/reverse-string/.meta/test_template.ecr b/exercises/practice/reverse-string/.meta/test_template.ecr index 98c8e28e..b5712b4a 100644 --- a/exercises/practice/reverse-string/.meta/test_template.ecr +++ b/exercises/practice/reverse-string/.meta/test_template.ecr @@ -4,7 +4,7 @@ require "../src/*" describe "<%-= to_capitalized(@json["exercise"].to_s) %>" do <%- @json["cases"].as_a.each do |cases| %> <%= status()%> "<%-= cases["description"] %>" do - <%= to_capitalized(@json["exercise"].to_s) %>.<%= to_snake(cases["property"].to_s)%>("<%= cases["input"]["value"] %>").should eq("<%= cases["expected"] %>") + <%= to_capitalized(@json["exercise"].to_s) %>.<%= cases["property"].to_s.underscore %>("<%= cases["input"]["value"] %>").should eq("<%= cases["expected"] %>") end <% end %> end diff --git a/exercises/practice/robot-simulator/.meta/test_template.ecr b/exercises/practice/robot-simulator/.meta/test_template.ecr index 35cab9c7..b7a6eb94 100644 --- a/exercises/practice/robot-simulator/.meta/test_template.ecr +++ b/exercises/practice/robot-simulator/.meta/test_template.ecr @@ -7,7 +7,7 @@ describe "<%-= to_capitalized(@json["exercise"].to_s) %>" do <%= status()%> "<%-= subcases["description"] %>" do robot = <%= to_capitalized(@json["exercise"].to_s)%>.new({<%= subcases["input"]["position"]["x"]%>, <%= subcases["input"]["position"]["y"]%>}, :<%= subcases["input"]["direction"]%>) <%- if subcases["input"]["instructions"]? -%> - robot.<%= to_snake(subcases["property"].to_s)%>("<%= subcases["input"]["instructions"] %>") + robot.<%= subcases["property"].to_s.underscore %>("<%= subcases["input"]["instructions"] %>") <% end %> robot.x.should eq <%= subcases["expected"]["position"]["x"]%> robot.y.should eq <%= subcases["expected"]["position"]["y"]%> diff --git a/exercises/practice/rotational-cipher/.meta/test_template.ecr b/exercises/practice/rotational-cipher/.meta/test_template.ecr index 5f56109c..87c5d255 100644 --- a/exercises/practice/rotational-cipher/.meta/test_template.ecr +++ b/exercises/practice/rotational-cipher/.meta/test_template.ecr @@ -4,7 +4,7 @@ require "../src/*" describe "<%-= to_capitalized(@json["exercise"].to_s) %>" do <%- @json["cases"].as_a.each do |cases| %> <%= status()%> "<%-= cases["description"] %>" do - <%= to_capitalized(@json["exercise"].to_s) %>.<%= to_snake(cases["property"].to_s)%>("<%= cases["input"]["text"].to_s %>", <%= cases["input"]["shiftKey"] %>).should eq("<%= cases["expected"].to_s %>") + <%= to_capitalized(@json["exercise"].to_s) %>.<%= cases["property"].to_s.underscore %>("<%= cases["input"]["text"].to_s %>", <%= cases["input"]["shiftKey"] %>).should eq("<%= cases["expected"].to_s %>") end <% end %> end diff --git a/exercises/practice/run-length-encoding/.meta/test_template.ecr b/exercises/practice/run-length-encoding/.meta/test_template.ecr index 2c368e35..f96896f7 100644 --- a/exercises/practice/run-length-encoding/.meta/test_template.ecr +++ b/exercises/practice/run-length-encoding/.meta/test_template.ecr @@ -8,7 +8,7 @@ describe "<%-= to_capitalized(@json["exercise"].to_s) %>" do <% if sub_case["property"].to_s == "consistency" %> <%= to_capitalized(@json["exercise"].to_s) %>.decode(<%= to_capitalized(@json["exercise"].to_s) %>.encode("<%= sub_case["input"]["string"] %>")).should eq("<%= sub_case["expected"] %>") <% else %> -<%= to_capitalized(@json["exercise"].to_s) %>.<%= to_snake(sub_case["property"].to_s)%>("<%= sub_case["input"]["string"] %>").should eq("<%= sub_case["expected"] %>") +<%= to_capitalized(@json["exercise"].to_s) %>.<%= sub_case["property"].to_s.underscore %>("<%= sub_case["input"]["string"] %>").should eq("<%= sub_case["expected"] %>") <% end %> end <% end %> diff --git a/exercises/practice/saddle-points/.meta/test_template.ecr b/exercises/practice/saddle-points/.meta/test_template.ecr index 36b583ae..63c2a614 100644 --- a/exercises/practice/saddle-points/.meta/test_template.ecr +++ b/exercises/practice/saddle-points/.meta/test_template.ecr @@ -6,7 +6,7 @@ describe "<%-= to_capitalized(@json["exercise"].to_s) %>" do <%= status()%> "<%-= cases["description"] %>" do input = <%= cases["input"]["matrix"][0].as_a.empty? ? "Array(Array(Int32)).new" : cases["input"]["matrix"].as_a %> expected = Set.new [<%- cases["expected"].as_a.each do |expected| -%>{row: <%= expected["row"] %>, column: <%= expected["column"] %>}, <%- end %>]<%= cases["expected"].as_a.empty? ? " of NamedTuple(row: Int32, column: Int32)" : ""%> - actual = <%= to_capitalized(@json["exercise"].to_s) %>.<%= to_snake(cases["property"].to_s) %>(input) + actual = <%= to_capitalized(@json["exercise"].to_s) %>.<%= cases["property"].to_s.underscore %>(input) actual.should eq(expected.to_set) end <% end %> diff --git a/exercises/practice/scrabble-score/.meta/test_template.ecr b/exercises/practice/scrabble-score/.meta/test_template.ecr index 3d6e036e..5cc73a90 100644 --- a/exercises/practice/scrabble-score/.meta/test_template.ecr +++ b/exercises/practice/scrabble-score/.meta/test_template.ecr @@ -4,7 +4,7 @@ require "../src/*" describe "<%-= to_capitalized(@json["exercise"].to_s) %>" do <%- @json["cases"].as_a.each do |cases| %> <%= status()%> "<%-= cases["description"] %>" do - <%= to_capitalized(@json["exercise"].to_s) %>.<%= to_snake(cases["property"].to_s)%>("<%= cases["input"]["word"] %>").should eq(<%= cases["expected"] %>) + <%= to_capitalized(@json["exercise"].to_s) %>.<%= cases["property"].to_s.underscore %>("<%= cases["input"]["word"] %>").should eq(<%= cases["expected"] %>) end <% end %> end diff --git a/exercises/practice/secret-handshake/.meta/test_template.ecr b/exercises/practice/secret-handshake/.meta/test_template.ecr index 571301c9..2d51ab0f 100644 --- a/exercises/practice/secret-handshake/.meta/test_template.ecr +++ b/exercises/practice/secret-handshake/.meta/test_template.ecr @@ -4,7 +4,7 @@ require "../src/*" describe "<%-= to_capitalized(@json["exercise"].to_s) %>" do <%- @json["cases"].as_a.each do |cases| %> <%= status()%> "<%-= cases["description"] %>" do - <%= to_capitalized(@json["exercise"].to_s) %>.<%= to_snake(cases["property"].to_s)%>(<%= cases["input"]["number"] %>).should eq(<%= cases["expected"].as_a %> of String) + <%= to_capitalized(@json["exercise"].to_s) %>.<%= cases["property"].to_s.underscore %>(<%= cases["input"]["number"] %>).should eq(<%= cases["expected"].as_a %> of String) end <% end %> end diff --git a/exercises/practice/series/.meta/test_template.ecr b/exercises/practice/series/.meta/test_template.ecr index 3cb9f47a..a6d6772f 100644 --- a/exercises/practice/series/.meta/test_template.ecr +++ b/exercises/practice/series/.meta/test_template.ecr @@ -6,10 +6,10 @@ describe "<%-= to_capitalized(@json["exercise"].to_s) %>" do <%= status()%> "<%-= cases["description"] %>" do <%- if cases["expected"].as_h? %> expect_raises(ArgumentError) do - <%= to_capitalized(@json["exercise"].to_s) %>.<%= to_snake(cases["property"].to_s)%>("<%= cases["input"]["series"] %>", <%= cases["input"]["sliceLength"] %>) + <%= to_capitalized(@json["exercise"].to_s) %>.<%= cases["property"].to_s.underscore %>("<%= cases["input"]["series"] %>", <%= cases["input"]["sliceLength"] %>) end <%- else %> - <%= to_capitalized(@json["exercise"].to_s) %>.<%= to_snake(cases["property"].to_s)%>("<%= cases["input"]["series"] %>", <%= cases["input"]["sliceLength"] %>).should eq(<%= cases["expected"]%>) + <%= to_capitalized(@json["exercise"].to_s) %>.<%= cases["property"].to_s.underscore %>("<%= cases["input"]["series"] %>", <%= cases["input"]["sliceLength"] %>).should eq(<%= cases["expected"]%>) <%- end %> end <% end %> diff --git a/exercises/practice/space-age/.meta/test_template.ecr b/exercises/practice/space-age/.meta/test_template.ecr index 455415ae..8a404c93 100644 --- a/exercises/practice/space-age/.meta/test_template.ecr +++ b/exercises/practice/space-age/.meta/test_template.ecr @@ -6,11 +6,11 @@ describe "<%-= to_capitalized(@json["exercise"].to_s) %>" do <%= status()%> "<%-= cases["description"] %>" do <%- if cases["expected"].as_h? %> expect_raises(ArgumentError) do - Space::Age.from_seconds(<%= cases["input"]["seconds"] %>).age_on<%-= to_snake(cases["input"]["planet"].to_s) %> + Space::Age.from_seconds(<%= cases["input"]["seconds"] %>).age_on_<%-= cases["input"]["planet"].to_s.underscore %> end <% else %> - Space::Age.from_seconds(<%= cases["input"]["seconds"] %>).age_on<%-= to_snake(cases["input"]["planet"].to_s) %>.should be_close(<%= cases["expected"]%>, 0.01) - <% end %> + Space::Age.from_seconds(<%= cases["input"]["seconds"] %>).age_on_<%-= cases["input"]["planet"].to_s.underscore %>.should be_close(<%= cases["expected"]%>, 0.01) + <% end %> end <% end %> end diff --git a/exercises/practice/strain/.meta/test_template.ecr b/exercises/practice/strain/.meta/test_template.ecr index f42afed2..08941750 100644 --- a/exercises/practice/strain/.meta/test_template.ecr +++ b/exercises/practice/strain/.meta/test_template.ecr @@ -5,7 +5,7 @@ describe "<%-= to_capitalized(@json["exercise"].to_s) %>" do <%- @json["cases"].as_a.each do |cases| %> <%= status()%> "<%-= cases["description"] %>" do numbers = <%-= cases["input"]["list"].as_a.size == 0 ? "[] of Int32" : cases["input"]["list"].as_a %> - numbers.<%= to_snake(cases["property"].to_s)%> { |x| <%= strain(cases["input"]["predicate"].to_s) %>} .should eq(<%= cases["expected"].as_a.size == 0 ? "[] of Int32" : cases["expected"].as_a %>) + numbers.<%= cases["property"].to_s.underscore %> { |x| <%= strain(cases["input"]["predicate"].to_s) %>} .should eq(<%= cases["expected"].as_a.size == 0 ? "[] of Int32" : cases["expected"].as_a %>) end <% end %> end diff --git a/exercises/practice/sum-of-multiples/.meta/test_template.ecr b/exercises/practice/sum-of-multiples/.meta/test_template.ecr index 8b3772f8..c0bce4ed 100644 --- a/exercises/practice/sum-of-multiples/.meta/test_template.ecr +++ b/exercises/practice/sum-of-multiples/.meta/test_template.ecr @@ -4,7 +4,7 @@ require "../src/*" describe "<%-= to_capitalized(@json["exercise"].to_s) %>" do <%- @json["cases"].as_a.each do |cases| %> <%= status()%> "<%-= cases["description"] %>" do - <%= to_capitalized(@json["exercise"].to_s) %>.<%= to_snake(cases["property"].to_s)%>(<%= cases["input"]["factors"].as_a %> of Int32, <%= cases["input"]["limit"] %>).should eq(<%= cases["expected"] %>) + <%= to_capitalized(@json["exercise"].to_s) %>.<%= cases["property"].to_s.underscore %>(<%= cases["input"]["factors"].as_a %> of Int32, <%= cases["input"]["limit"] %>).should eq(<%= cases["expected"] %>) end <% end %> end diff --git a/exercises/practice/tournament/.meta/test_template.ecr b/exercises/practice/tournament/.meta/test_template.ecr index 0ebdf72f..7608791c 100644 --- a/exercises/practice/tournament/.meta/test_template.ecr +++ b/exercises/practice/tournament/.meta/test_template.ecr @@ -4,7 +4,7 @@ require "../src/*" describe <%= to_capitalized(@json["exercise"].to_s).inspect %> do <% @json["cases"].as_a.each do |cases| %> <%= status()%> "<%-= cases["description"] %>" do - <%= to_capitalized(@json["exercise"].to_s) %>.<%= to_snake(cases["property"].to_s) %>(<%= cases["input"]["rows"].inspect.gsub("[]", "[] of String").gsub("[\"", "[\n\"").gsub(", ", ",\n") %>).should eq(<%= cases["expected"].inspect.gsub("[\"", "[\n\"").gsub(", ", ",\n") %>) + <%= to_capitalized(@json["exercise"].to_s) %>.<%= cases["property"].to_s.underscore %>(<%= cases["input"]["rows"].inspect.gsub("[]", "[] of String").gsub("[\"", "[\n\"").gsub(", ", ",\n") %>).should eq(<%= cases["expected"].inspect.gsub("[\"", "[\n\"").gsub(", ", ",\n") %>) end <% end %> end diff --git a/exercises/practice/triangle/.meta/test_template.ecr b/exercises/practice/triangle/.meta/test_template.ecr index 3e5db823..ab32102a 100644 --- a/exercises/practice/triangle/.meta/test_template.ecr +++ b/exercises/practice/triangle/.meta/test_template.ecr @@ -10,7 +10,7 @@ describe "<%-= to_capitalized(@json["exercise"].to_s) %>" do <%= to_capitalized(@json["exercise"].to_s) %>.new({<%= sub_case["input"]["sides"].to_s[1...-1] %>}) end <%- else %> - <%= to_capitalized(@json["exercise"].to_s) %>.new({<%= sub_case["input"]["sides"].to_s[1...-1] %>}).<%= to_snake(sub_case["property"].to_s)%>?.should <%-= sub_case["expected"].as_bool ? "be_true" : "be_false" %> + <%= to_capitalized(@json["exercise"].to_s) %>.new({<%= sub_case["input"]["sides"].to_s[1...-1] %>}).<%= sub_case["property"].to_s.underscore %>?.should <%-= sub_case["expected"].as_bool ? "be_true" : "be_false" %> <% end %> end <% end %> diff --git a/exercises/practice/two-fer/.meta/test_template.ecr b/exercises/practice/two-fer/.meta/test_template.ecr index 59a3a52b..550fa32e 100644 --- a/exercises/practice/two-fer/.meta/test_template.ecr +++ b/exercises/practice/two-fer/.meta/test_template.ecr @@ -4,7 +4,7 @@ require "../src/*" describe "<%-= to_capitalized(@json["exercise"].to_s) %>" do <%- @json["cases"].as_a.each do |cases| %> <%= status()%> "<%-= cases["description"] %>" do - <%= to_capitalized(@json["exercise"].to_s) %>.<%= to_snake(cases["property"].to_s)%>(<%= cases["input"]["name"].as_s? ? cases["input"]["name"].inspect : "" %>).should eq("<%= cases["expected"] %>") + <%= to_capitalized(@json["exercise"].to_s) %>.<%= cases["property"].to_s.underscore %>(<%= cases["input"]["name"].as_s? ? cases["input"]["name"].inspect : "" %>).should eq("<%= cases["expected"] %>") end <% end %> end diff --git a/exercises/practice/word-count/.meta/test_template.ecr b/exercises/practice/word-count/.meta/test_template.ecr index 4aaa23a2..cc3a8721 100644 --- a/exercises/practice/word-count/.meta/test_template.ecr +++ b/exercises/practice/word-count/.meta/test_template.ecr @@ -6,7 +6,7 @@ describe "<%-= to_capitalized(@json["exercise"].to_s) %>" do <%= status()%> "<%-= cases["description"] %>" do sentence = <%= cases["input"]["sentence"].inspect %> expected = <%= cases["expected"].as_h %> - <%= to_capitalized(@json["exercise"].to_s) %>.<%= to_snake(cases["property"].to_s)%>(sentence).should eq(expected) + <%= to_capitalized(@json["exercise"].to_s) %>.<%= cases["property"].to_s.underscore %>(sentence).should eq(expected) end <% end %> end diff --git a/exercises/practice/wordy/.meta/test_template.ecr b/exercises/practice/wordy/.meta/test_template.ecr index 48016670..9ed4bb6a 100644 --- a/exercises/practice/wordy/.meta/test_template.ecr +++ b/exercises/practice/wordy/.meta/test_template.ecr @@ -6,10 +6,10 @@ describe "<%-= to_capitalized(@json["exercise"].to_s) %>" do <%= status()%> "<%-= cases["description"] %>" do <%- if cases["expected"].as_h? %> expect_raises(ArgumentError) do - <%= to_capitalized(@json["exercise"].to_s) %>.<%= to_snake(cases["property"].to_s)%>("<%= cases["input"]["question"] %>") + <%= to_capitalized(@json["exercise"].to_s) %>.<%= cases["property"].to_s.underscore %>("<%= cases["input"]["question"] %>") end <%- else %> - <%= to_capitalized(@json["exercise"].to_s) %>.<%= to_snake(cases["property"].to_s)%>("<%= cases["input"]["question"] %>").should eq(<%= cases["expected"]%>) + <%= to_capitalized(@json["exercise"].to_s) %>.<%= cases["property"].to_s.underscore %>("<%= cases["input"]["question"] %>").should eq(<%= cases["expected"]%>) <%- end %> end <% end %>