end
# QUESTION: Which has precedence: The constant in the lexical scope,
- # or the constant from the inheritance heirarachy?
+ # or the constant from the inheritance hierarchy?
# ------------------------------------------------------------------
assert_equal __, MyAnimals::Oyster.new.legs_in_oyster
end
- # QUESTION: Now Which has precedence: The constant in the lexical
- # scope, or the constant from the inheritance heirarachy? Why is it
+ # QUESTION: Now which has precedence: The constant in the lexical
+ # scope, or the constant from the inheritance hierarchy? Why is it
# different than the previous answer?
end
assert_equal __, Chihuahua.ancestors.include?(Object)
end
- def test_subcases_inherit_behavior_from_parent_class
+ def test_subclasses_inherit_behavior_from_parent_class
chico = Chihuahua.new("Chico")
assert_equal __, chico.name
end
class AboutIteration < EdgeCase::Koan
def test_each_is_a_method_on_arrays
- [].methods.include?("each")
+ assert_equal __, [].methods.include?(:each)
end
def test_iterating_with_each
result = [2, 3, 4].inject(0) { |sum, item| sum + item }
assert_equal __, result
- result2 = [2, 3, 4].inject(1) { |sum, item| sum * item }
+ result2 = [2, 3, 4].inject(1) { |product, item| product * item }
assert_equal __, result2
# Extra Credit:
# Concepts
# * Pull in a java class
# * calling a method, Camel vs snake
-# * Resovling module/class name conflicts
+# * Resolving module/class name conflicts
# * Showing what gets returned
# * Ruby Strings VS Java Strings
# * Calling custom java class
# keep in mind you can't call method_missing like that in Ruby
# 1.9. normally.
#
- # Thanks. We now return you to your regularly schedule Ruby
+ # Thanks. We now return you to your regularly scheduled Ruby
# Koans.
end
assert_equal __, fido.bark
end
- def test_module_methods_are_also_availble_in_the_object
+ def test_module_methods_are_also_available_in_the_object
fido = Dog.new
assert_nothing_raised(Exception) do
fido.set_name("Rover")
# below). You should be able to initialize the proxy object with any
# object. Any messages sent to the proxy object should be forwarded
# to the target object. As each message is sent, the proxy should
-# record the name of the method send.
+# record the name of the method sent.
#
# The proxy class is started for you. You will need to add a method
# missing handler and any other supporting methods. The specification
require File.expand_path(File.dirname(__FILE__) + '/edgecase')
# Greed is a dice game where you roll up to five dice to accumulate
-# points. The following "score" function will be used calculate the
+# points. The following "score" function will be used to calculate the
# score of a single roll of the dice.
#
# A greed roll is scored as follows:
# interesting string operations are available on symbols.
def test_symbols_cannot_be_concatenated
- # Exceptions will be pondered further father down the path
+ # Exceptions will be pondered further farther down the path
assert_raise(___) do
:cats + :dogs
end
end
# Standard, generic replacement value.
-# If value19 is given, it is used inplace of value for Ruby 1.9.
+# If value19 is given, it is used in place of value for Ruby 1.9.
def __(value="FILL ME IN", value19=:mu)
if RUBY_VERSION < "1.9"
value
end
end
-desc "Run some simple consistancy checks"
+desc "Run some simple consistency checks"
task :check => ["check:abouts", "check:asserts"]
assert_equal __(true), Chihuahua.ancestors.include?(Object)
end
- def test_subcases_inherit_behavior_from_parent_class
+ def test_subclasses_inherit_behavior_from_parent_class
chico = Chihuahua.new("Chico")
assert_equal __("Chico"), chico.name
end
# Concepts
# * Pull in a java class
# * calling a method, Camel vs snake
-# * Resovling module/class name conflicts
+# * Resolving module/class name conflicts
# * Showing what gets returned
# * Ruby Strings VS Java Strings
# * Calling custom java class
# below). You should be able to initialize the proxy object with any
# object. Any messages sent to the proxy object should be forwarded
# to the target object. As each message is sent, the proxy should
-# record the name of the method send.
+# record the name of the method sent.
#
# The proxy class is started for you. You will need to add a method
# missing handler and any other supporting methods. The specification
require File.expand_path(File.dirname(__FILE__) + '/edgecase')
# Greed is a dice game where you roll up to five dice to accumulate
-# points. The following "score" function will be used calculate the
+# points. The following "score" function will be used to calculate the
# score of a single roll of the dice.
#
# A greed roll is scored as follows:
end
# Standard, generic replacement value.
-# If value19 is given, it is used inplace of value for Ruby 1.9.
+# If value19 is given, it is used in place of value for Ruby 1.9.
def __(value="FILL ME IN", value19=:mu)
if RUBY_VERSION < "1.9"
value