Skip to content

Commit fb2f6ad

Browse files
committed
about_scope
1 parent c87f5db commit fb2f6ad

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

.path_progress

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
0,1,2,5,6
22
,8,9,10,13,15,16
33
,18,18,19,20,20,21,22,23,24,32,33,35,35,37,39,40,41,42,42,42,43,44,46,49,50,51,52,55,56,59,60,60,61,63,64,65,67
4-
,70,71,73,74,75,75,76,77,78,79,81,81,82,84,84,85,85,87,88,90,91,93,94,96,98,99,99,100,101,103,104,106,107,107,108,109,111,111,114,115,116,116,116,117,119,121,122,123,124,125,127,128,130,130,131,132,134,135,139,141,143,145,146,149,150,151,153,151,153,153,153,154,154,154,155,158,159,159,160,163,166,166,167,167,168,172,173,176,177,178,178,181,182,187,187,187,190,191,191,192,192,195,199,200,203,202,203,204,205,205,205,205,206,207,209,210,210,210,214,210,217,220,220,221,221,224,226
4+
,70,71,73,74,75,75,76,77,78,79,81,81,82,84,84,85,85,87,88,90,91,93,94,96,98,99,99,100,101,103,104,106,107,107,108,109,111,111,114,115,116,116,116,117,119,121,122,123,124,125,127,128,130,130,131,132,134,135,139,141,143,145,146,149,150,151,153,151,153,153,153,154,154,154,155,158,159,159,160,163,166,166,167,167,168,172,173,176,177,178,178,181,182,187,187,187,190,191,191,192,192,195,199,200,203,202,203,204,205,205,205,205,206,207,209,210,210,210,214,210,217,220,220,221,221,224,226,228,228,230,232,232,233,234,234,235

about_scope.rb

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,19 @@ def identify
1818
end
1919

2020
def test_dog_is_not_available_in_the_current_scope
21-
assert_raise(___) do
21+
assert_raise(NameError) do
2222
fido = Dog.new
2323
end
2424
end
2525

2626
def test_you_can_reference_nested_classes_using_the_scope_operator
2727
fido = Jims::Dog.new
2828
rover = Joes::Dog.new
29-
assert_equal __, fido.identify
30-
assert_equal __, rover.identify
29+
assert_equal :jims_dog, fido.identify
30+
assert_equal :joes_dog, rover.identify
3131

32-
assert_equal __, fido.class != rover.class
33-
assert_equal __, Jims::Dog != Joes::Dog
32+
assert_equal true, fido.class != rover.class
33+
assert_equal true, Jims::Dog != Joes::Dog
3434
end
3535

3636
# ------------------------------------------------------------------
@@ -39,41 +39,41 @@ class String
3939
end
4040

4141
def test_bare_bones_class_names_assume_the_current_scope
42-
assert_equal __, AboutScope::String == String
42+
assert_equal true, AboutScope::String == String
4343
end
4444

4545
def test_nested_string_is_not_the_same_as_the_system_string
46-
assert_equal __, String == "HI".class
46+
assert_equal false, String == "HI".class
4747
end
4848

4949
def test_use_the_prefix_scope_operator_to_force_the_global_scope
50-
assert_equal __, ::String == "HI".class
50+
assert_equal true, ::String == "HI".class
5151
end
5252

5353
# ------------------------------------------------------------------
5454

5555
PI = 3.1416
5656

5757
def test_constants_are_defined_with_an_initial_uppercase_letter
58-
assert_equal __, PI
58+
assert_equal AboutScope::PI, PI
5959
end
6060

6161
# ------------------------------------------------------------------
6262

6363
MyString = ::String
6464

6565
def test_class_names_are_just_constants
66-
assert_equal __, MyString == ::String
67-
assert_equal __, MyString == "HI".class
66+
assert_equal true, MyString == ::String
67+
assert_equal true, MyString == "HI".class
6868
end
6969

7070
def test_constants_can_be_looked_up_explicitly
71-
assert_equal __, PI == AboutScope.const_get("PI")
72-
assert_equal __, MyString == AboutScope.const_get("MyString")
71+
assert_equal true, PI == AboutScope.const_get("PI")
72+
assert_equal true, MyString == AboutScope.const_get("MyString")
7373
end
7474

7575
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_
76+
assert_equal [:Dog], Jims.constants
77+
assert Object.constants.size > 2
7878
end
7979
end

0 commit comments

Comments
 (0)