Permalink
Browse files

James Bell contrib

  • Loading branch information...
1 parent 8e9c9b4 commit b5d52fd95b7dc30f1f9aae8c4bd656eed11033a7 squarism committed Jul 25, 2011
Showing with 10 additions and 1 deletion.
  1. +10 −1 about_symbols.rb
View
11 about_symbols.rb
@@ -44,7 +44,16 @@ def test_method_names_become_symbols
def test_constants_become_symbols
all_symbols = Symbol.all_symbols
- assert_equal true, all_symbols.include?(:RubyConstant)
+ # Thanks to James Bell for this catch!
+ # this always will be true, false positive
+ # assert_equal true, all_symbols.include?(:RubyConstant)
+ # The proper way is to look for the string
+ # assert_equal false, all_symbols.include?("thisHasNeverBeenUsedBefore")
+ # Or do something like this
+ # :thisHasBeenUsed = "foo"
+ # assert_equal true, all_symbols.include?("thisHasBeenUsed")
+ symbols = Symbol.all_symbols.map {|x| x.to_s }
+ assert_equal true, symbols.include?("RubyConstant")
end
end

0 comments on commit b5d52fd

Please sign in to comment.