Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

working...

  • Loading branch information...
commit eb01c7eadca4e9d0824fcbe748139c20ab6c80c0 1 parent fd79a65
Danish Khan authored
Showing with 19 additions and 19 deletions.
  1. +3 −3 koans/about_nil.rb
  2. +16 −16 koans/about_objects.rb
View
6 koans/about_nil.rb
@@ -22,9 +22,9 @@ def test_you_dont_get_null_pointer_errors_when_calling_methods_on_nil
end
def test_nil_has_a_few_methods_defined_on_it
- assert_equal __, nil.nil?
- assert_equal __, nil.to_s
- assert_equal __, nil.inspect
+ assert_equal true, nil.nil?
+ assert_equal "", nil.to_s
+ assert_equal "nil", nil.inspect
# THINK ABOUT IT:
#
View
32 koans/about_objects.rb
@@ -2,43 +2,43 @@
class AboutObjects < EdgeCase::Koan
def test_everything_is_an_object
- assert_equal __, 1.is_a?(Object)
- assert_equal __, 1.5.is_a?(Object)
- assert_equal __, "string".is_a?(Object)
- assert_equal __, nil.is_a?(Object)
- assert_equal __, Object.is_a?(Object)
+ assert_equal true, 1.is_a?(Object)
+ assert_equal true, 1.5.is_a?(Object)
+ assert_equal true, "string".is_a?(Object)
+ assert_equal true, nil.is_a?(Object)
+ assert_equal true, Object.is_a?(Object)
end
def test_objects_can_be_converted_to_strings
- assert_equal __, 123.to_s
- assert_equal __, nil.to_s
+ assert_equal "123", 123.to_s
+ assert_equal "", nil.to_s
end
def test_objects_can_be_inspected
- assert_equal __, 123.inspect
- assert_equal __, nil.inspect
+ assert_equal "123", 123.inspect
+ assert_equal "nil", nil.inspect
end
def test_every_object_has_an_id
obj = Object.new
- assert_equal __, obj.object_id.class
+ assert_equal Fixnum, obj.object_id.class
end
def test_every_object_has_different_id
obj = Object.new
another_obj = Object.new
- assert_equal __, obj.object_id != another_obj.object_id
+ assert_equal true, obj.object_id != another_obj.object_id
end
def test_some_system_objects_always_have_the_same_id
- assert_equal __, false.object_id
- assert_equal __, true.object_id
- assert_equal __, nil.object_id
+ assert_equal 0, false.object_id
+ assert_equal 2, true.object_id
+ assert_equal 4, nil.object_id
end
def test_small_integers_have_fixed_ids
- assert_equal __, 0.object_id
- assert_equal __, 1.object_id
+ assert_equal 1, 0.object_id
+ assert_equal 3, 1.object_id
assert_equal __, 2.object_id
assert_equal __, 100.object_id
Please sign in to comment.
Something went wrong with that request. Please try again.