Running:
F
Failure:
ConvertHashSyntaxTest#test_convert_hash_syntax [test/convert_hash_syntax_test.rb:20]:
--- expected
+++ actual
@@ -1,5 +1,5 @@
"{
- name: 'Alece',
- name: 'Alice',
age: 20,
gender: :female
}
bin/rails test test/convert_hash_syntax_test.rb:5
Finished in 0.008045s, 124.3008 runs/s, 124.3008 assertions/s.
1 runs, 1 assertions, 1 failures, 0 errors, 0 skips
require 'minitest/autorun'
require './lib/convert_hash_syntax'
class ConvertHashSyntaxTest < Minitest::Test
def test_convert_hash_syntax
old_syntax = <<~TEXT
{
:name => 'Alice',
:age=>20,
:gender => :female
}
TEXT
expected = <<~TEXT
{
name: 'Alece',
age: 20,
gender: :female
}
TEXT
assert_equal expected, convert_hash_syntax(old_syntax)
end
end
(convert_hash_syntax_test.rb)
def convert_hash_syntax(old_syntax)
old_syntax.gsub(/:(\w+) *=> */, '\1: ')
end
(convert_hash_syntax.rb)
このエラーは何を指摘しているのでしょうか?
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/03/24 07:37