Skip to content

Commit fad6950

Browse files
committed
Changed exercises to use singel qoutes. Changed template for allergies so it should match the old version.
1 parent 14ad136 commit fad6950

6 files changed

Lines changed: 120 additions & 120 deletions

File tree

exercises/practice/acronym/.meta/test_template.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ class AcronymTest < Minitest::Test
55
<% json["cases"].each do |cases| %>
66
def test_<%= underscore(cases["description"]) %>
77
<%= skip? %>
8-
assert_equal "<%= cases["expected"] %>", <%= camel_case(json["exercise"]) %>.<%= underscore(cases["property"]) %>("<%= cases["input"]["phrase"] %>")
8+
assert_equal '<%= cases["expected"] %>', <%= camel_case(json["exercise"]) %>.<%= underscore(cases["property"]) %>('<%= cases["input"]["phrase"].gsub("'", "\\\\'") %>')
99
end
1010
<% end %>
1111
end

exercises/practice/acronym/acronym_test.rb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,46 +4,46 @@
44
class AcronymTest < Minitest::Test
55
def test_basic
66
# skip
7-
assert_equal "PNG", Acronym.abbreviate("Portable Network Graphics")
7+
assert_equal 'PNG', Acronym.abbreviate('Portable Network Graphics')
88
end
99

1010
def test_lowercase_words
1111
skip
12-
assert_equal "ROR", Acronym.abbreviate("Ruby on Rails")
12+
assert_equal 'ROR', Acronym.abbreviate('Ruby on Rails')
1313
end
1414

1515
def test_punctuation
1616
skip
17-
assert_equal "FIFO", Acronym.abbreviate("First In, First Out")
17+
assert_equal 'FIFO', Acronym.abbreviate('First In, First Out')
1818
end
1919

2020
def test_all_caps_word
2121
skip
22-
assert_equal "GIMP", Acronym.abbreviate("GNU Image Manipulation Program")
22+
assert_equal 'GIMP', Acronym.abbreviate('GNU Image Manipulation Program')
2323
end
2424

2525
def test_punctuation_without_whitespace
2626
skip
27-
assert_equal "CMOS", Acronym.abbreviate("Complementary metal-oxide semiconductor")
27+
assert_equal 'CMOS', Acronym.abbreviate('Complementary metal-oxide semiconductor')
2828
end
2929

3030
def test_very_long_abbreviation
3131
skip
32-
assert_equal "ROTFLSHTMDCOALM", Acronym.abbreviate("Rolling On The Floor Laughing So Hard That My Dogs Came Over And Licked Me")
32+
assert_equal 'ROTFLSHTMDCOALM', Acronym.abbreviate('Rolling On The Floor Laughing So Hard That My Dogs Came Over And Licked Me')
3333
end
3434

3535
def test_consecutive_delimiters
3636
skip
37-
assert_equal "SIMUFTA", Acronym.abbreviate("Something - I made up from thin air")
37+
assert_equal 'SIMUFTA', Acronym.abbreviate('Something - I made up from thin air')
3838
end
3939

4040
def test_apostrophes
4141
skip
42-
assert_equal "HC", Acronym.abbreviate("Halley's Comet")
42+
assert_equal 'HC', Acronym.abbreviate('Halley\'s Comet')
4343
end
4444

4545
def test_underscore_emphasis
4646
skip
47-
assert_equal "TRNT", Acronym.abbreviate("The Road _Not_ Taken")
47+
assert_equal 'TRNT', Acronym.abbreviate('The Road _Not_ Taken')
4848
end
4949
end

exercises/practice/allergies/.meta/test_template.erb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ require 'minitest/autorun'
22
require_relative 'allergies'
33

44
class AllergiesTest < Minitest::Test
5-
<% json["cases"].each_with_index do |group, index| %>
5+
<% json["cases"].each do |group| %>
66
<% group["cases"].each do |sub_case| %>
7-
def test_<%= underscore(sub_case["description"]) %><%= index.zero? ? "" : "_#{index}" %>
7+
def test_<%= underscore(group["description"]) %>_<%= underscore(sub_case["description"]) %>
88
<%= skip? %>
99
allergies = Allergies.new(<%= sub_case["input"]["score"] %>)
1010
<%- if sub_case["property"] == "allergicTo" -%>
11-
<%= sub_case["expected"] ? "assert" : "refute" %> allergies.allergic_to?("<%= sub_case["input"]["item"] %>"), "Tom is allergic, but it says he is<%= sub_case["expected"] ? "" : " not" %>."
11+
<%= sub_case["expected"] ? "assert" : "refute" %> allergies.allergic_to?('<%= sub_case["input"]["item"] %>'), 'Tom is<%= sub_case["expected"] ? "" : " not" %> allergic, but it says he is<%= sub_case["expected"] ? " not" : "" %>.'
1212
<%- else -%>
1313
expected = %w[<%= sub_case["expected"].join(" ") %>]
1414
assert_equal expected, allergies.list

0 commit comments

Comments
 (0)