Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

working...

  • Loading branch information...
commit 13b8543b4f4615dc16dc4f5b0910874a834d9211 1 parent d10614c
Danish Khan authored
Showing with 17 additions and 17 deletions.
  1. +17 −17 koans/about_symbols.rb
View
34 koans/about_symbols.rb
@@ -3,7 +3,7 @@
class AboutSymbols < EdgeCase::Koan
def test_symbols_are_symbols
symbol = :ruby
- assert_equal __, symbol.is_a?(Symbol)
+ assert_equal true, symbol.is_a?(Symbol)
end
def test_symbols_can_be_compared
@@ -11,21 +11,21 @@ def test_symbols_can_be_compared
symbol2 = :a_symbol
symbol3 = :something_else
- assert_equal __, symbol1 == symbol2
- assert_equal __, symbol1 == symbol3
+ assert_equal true, symbol1 == symbol2
+ assert_equal false, symbol1 == symbol3
end
def test_identical_symbols_are_a_single_internal_object
symbol1 = :a_symbol
symbol2 = :a_symbol
- assert_equal __, symbol1 == symbol2
- assert_equal __, symbol1.object_id == symbol2.object_id
+ assert_equal true, symbol1 == symbol2
+ assert_equal true, symbol1.object_id == symbol2.object_id
end
def test_method_names_become_symbols
symbols_as_strings = Symbol.all_symbols.map { |x| x.to_s }
- assert_equal __, symbols_as_strings.include?("test_method_names_become_symbols")
+ assert_equal true, symbols_as_strings.include?("test_method_names_become_symbols")
end
# THINK ABOUT IT:
@@ -38,45 +38,45 @@ def test_method_names_become_symbols
def test_constants_become_symbols
all_symbols = Symbol.all_symbols
- assert_equal __, all_symbols.include?(__)
+ assert_equal true, all_symbols.include?(:RubyConstant)
end
end
def test_symbols_can_be_made_from_strings
string = "catsAndDogs"
- assert_equal __, string.to_sym
+ assert_equal :catsAndDogs, string.to_sym
end
def test_symbols_with_spaces_can_be_built
symbol = :"cats and dogs"
- assert_equal symbol, __.to_sym
+ assert_equal symbol, "cats and dogs".to_sym
end
def test_symbols_with_interpolation_can_be_built
value = "and"
symbol = :"cats #{value} dogs"
- assert_equal symbol, __.to_sym
+ assert_equal symbol, "cats #{value} dogs".to_sym
end
def test_to_s_is_called_on_interpolated_symbols
symbol = :cats
string = "It is raining #{symbol} and dogs."
- assert_equal __, string
+ assert_equal "It is raining cats and dogs.", string
end
def test_symbols_are_not_strings
symbol = :ruby
- assert_equal __, symbol.is_a?(String)
- assert_equal __, symbol.eql?("ruby")
+ assert_equal false, symbol.is_a?(String)
+ assert_equal false, symbol.eql?("ruby")
end
def test_symbols_do_not_have_string_methods
symbol = :not_a_string
- assert_equal __, symbol.respond_to?(:each_char)
- assert_equal __, symbol.respond_to?(:reverse)
+ assert_equal false, symbol.respond_to?(:each_char)
+ assert_equal false, symbol.respond_to?(:reverse)
end
# It's important to realize that symbols are not "immutable
@@ -85,13 +85,13 @@ def test_symbols_do_not_have_string_methods
def test_symbols_cannot_be_concatenated
# Exceptions will be pondered further father down the path
- assert_raise(___) do
+ assert_raise(NoMethodError) do
:cats + :dogs
end
end
def test_symbols_can_be_dynamically_created
- assert_equal __, ("cats" + "dogs").to_sym
+ assert_equal :catsdogs, ("cats" + "dogs").to_sym
end
# THINK ABOUT IT:
Please sign in to comment.
Something went wrong with that request. Please try again.