1 require File.expand_path(File.dirname(__FILE__) + '/edgecase')
3 class AboutScope < EdgeCase::Koan
20 def test_dog_is_not_available_in_the_current_scope
26 def test_you_can_reference_nested_classes_using_the_scope_operator
29 assert_equal __, fido.identify
30 assert_equal __, rover.identify
32 assert_equal __, fido.class != rover.class
33 assert_equal __, Jims::Dog != Joes::Dog
36 # ------------------------------------------------------------------
41 def test_bare_bones_class_names_assume_the_current_scope
42 assert_equal __, AboutScope::String == String
45 def test_nested_string_is_not_the_same_as_the_system_string
46 assert_equal __, String == "HI".class
49 def test_use_the_prefix_scope_operator_to_force_the_global_scope
50 assert_equal __, ::String == "HI".class
53 # ------------------------------------------------------------------
57 def test_constants_are_defined_with_an_initial_uppercase_letter
61 # ------------------------------------------------------------------
65 def test_class_names_are_just_constants
66 assert_equal __, MyString == ::String
67 assert_equal __, MyString == "HI".class
70 def test_constants_can_be_looked_up_explicitly
71 assert_equal __, PI == AboutScope.const_get("PI")
72 assert_equal __, MyString == AboutScope.const_get("MyString")
75 def test_you_can_get_a_list_of_constants_for_any_class_or_module
76 assert_equal __, Jims.constants
77 assert Object.constants.size > _n_