From 65a145c13c61b7584652816f72aa08a38d3c6151 Mon Sep 17 00:00:00 2001 From: Tommy Parnell Date: Fri, 1 Jun 2018 02:03:52 +0000 Subject: [PATCH] hashes, and strings --- koans/about_hashes.rb | 14 +++++++------- koans/about_strings.rb | 26 +++++++++++++------------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/koans/about_hashes.rb b/koans/about_hashes.rb index f39c79e..082c6c1 100644 --- a/koans/about_hashes.rb +++ b/koans/about_hashes.rb @@ -94,11 +94,11 @@ class AboutHashes < Neo::Koan hash[:one] << "uno" hash[:two] << "dos" - assert_equal __, hash[:one] - assert_equal __, hash[:two] - assert_equal __, hash[:three] + assert_equal ["uno", "dos"], hash[:one] + assert_equal ["uno", "dos"], hash[:two] + assert_equal ["uno", "dos"], hash[:three] - assert_equal __, hash[:one].object_id == hash[:two].object_id + assert_equal true, hash[:one].object_id == hash[:two].object_id end def test_default_value_with_block @@ -107,8 +107,8 @@ class AboutHashes < Neo::Koan hash[:one] << "uno" hash[:two] << "dos" - assert_equal __, hash[:one] - assert_equal __, hash[:two] - assert_equal __, hash[:three] + assert_equal ["uno"], hash[:one] + assert_equal ["dos"], hash[:two] + assert_equal [], hash[:three] end end diff --git a/koans/about_strings.rb b/koans/about_strings.rb index 1e0ea49..8ba6958 100644 --- a/koans/about_strings.rb +++ b/koans/about_strings.rb @@ -3,36 +3,36 @@ require File.expand_path(File.dirname(__FILE__) + '/neo') class AboutStrings < Neo::Koan def test_double_quoted_strings_are_strings string = "Hello, World" - assert_equal __, string.is_a?(String) + assert_equal true, string.is_a?(String) end def test_single_quoted_strings_are_also_strings string = 'Goodbye, World' - assert_equal __, string.is_a?(String) + assert_equal true, string.is_a?(String) end def test_use_single_quotes_to_create_string_with_double_quotes string = 'He said, "Go Away."' - assert_equal __, string + assert_equal 'He said, "Go Away."', string end def test_use_double_quotes_to_create_strings_with_single_quotes string = "Don't" - assert_equal __, string + assert_equal "Don't", string end def test_use_backslash_for_those_hard_cases a = "He said, \"Don't\"" b = 'He said, "Don\'t"' - assert_equal __, a == b + assert_equal true, a == b end def test_use_flexible_quoting_to_handle_really_hard_cases a = %(flexible quotes can handle both ' and " characters) b = %!flexible quotes can handle both ' and " characters! c = %{flexible quotes can handle both ' and " characters} - assert_equal __, a == b - assert_equal __, a == c + assert_equal true, a == b + assert_equal true, a == c end def test_flexible_quotes_can_handle_multiple_lines @@ -40,9 +40,9 @@ class AboutStrings < Neo::Koan It was the best of times, It was the worst of times. } - assert_equal __, long_string.length - assert_equal __, long_string.lines.count - assert_equal __, long_string[0,1] + assert_equal 54, long_string.length + assert_equal 3, long_string.lines.count + assert_equal "\n", long_string[0,1] end def test_here_documents_can_also_handle_multiple_lines @@ -50,9 +50,9 @@ It was the worst of times. It was the best of times, It was the worst of times. EOS - assert_equal __, long_string.length - assert_equal __, long_string.lines.count - assert_equal __, long_string[0,1] + assert_equal 53, long_string.length + assert_equal 2, long_string.lines.count + assert_equal "I", long_string[0,1] end def test_plus_will_concatenate_two_strings