Skip to content

Commit 872c8d1

Browse files
authored
Add missing my_attr_reader namespace test (#10)
1 parent 0e1012d commit 872c8d1

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

courses/ruby/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ starting to work on tasks.
3535
- [ex02-strings](./ex02-strings)
3636
- [ex03-wallet](./ex03-wallet)
3737

38-
##### Resources:
38+
#### Resources:
3939

4040
- [Enumerable](https://ruby-doc.org/core-2.6.3/Enumerable.html)
4141
- [String](https://ruby-doc.org/core-2.4.0/String.html)
@@ -51,7 +51,7 @@ do part of the work at compile time that would otherwise be done at runtime.
5151

5252
- [ex04-myattr](./ex04-myattr)
5353

54-
##### Resources:
54+
#### Resources:
5555

5656
- [Don't Know Metaprogramming In Ruby?](http://rubylearning.com/blog/2010/11/23/dont-know-metaprogramming-in-ruby/#what-is-metaprogramming:18bee3e64eb657db6a08ae0ff05e44b8)
5757
- [How to Use attr_accessor, attr_writer & attr_reader](https://www.rubyguides.com/2018/11/attr_accessor/)

courses/ruby/ex04-myattr/my_attr_reader_test.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,5 +120,15 @@ def initialize
120120
# Check that only expected methods were defined.
121121
assert_equal %i[readable1 readable2 readable3] - new_class_methods, []
122122
end
123+
124+
def test_my_attr_reader_namespace
125+
# skip
126+
assert_raises NoMethodError do
127+
my_attr_reader(:readable)
128+
end
129+
130+
assert_respond_to Module, :my_attr_reader
131+
assert_respond_to Class, :my_attr_reader
132+
end
123133
end
124134

0 commit comments

Comments
 (0)