Skip to content

Commit

Permalink
Add missing my_attr_reader namespace test (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
ysv authored Aug 30, 2019
1 parent 0e1012d commit 872c8d1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions courses/ruby/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ starting to work on tasks.
- [ex02-strings](./ex02-strings)
- [ex03-wallet](./ex03-wallet)

##### Resources:
#### Resources:

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

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

##### Resources:
#### Resources:

- [Don't Know Metaprogramming In Ruby?](http://rubylearning.com/blog/2010/11/23/dont-know-metaprogramming-in-ruby/#what-is-metaprogramming:18bee3e64eb657db6a08ae0ff05e44b8)
- [How to Use attr_accessor, attr_writer & attr_reader](https://www.rubyguides.com/2018/11/attr_accessor/)
Expand Down
10 changes: 10 additions & 0 deletions courses/ruby/ex04-myattr/my_attr_reader_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -120,5 +120,15 @@ def initialize
# Check that only expected methods were defined.
assert_equal %i[readable1 readable2 readable3] - new_class_methods, []
end

def test_my_attr_reader_namespace
# skip
assert_raises NoMethodError do
my_attr_reader(:readable)
end

assert_respond_to Module, :my_attr_reader
assert_respond_to Class, :my_attr_reader
end
end

0 comments on commit 872c8d1

Please sign in to comment.