Created
February 21, 2015 07:56
-
-
Save nigelr/799bb331e4eefd643f42 to your computer and use it in GitHub Desktop.
create menu
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rspec' | |
class Menu | |
def item val, &block | |
p val | |
yield if block_given? | |
end | |
def test_it | |
item('') do | |
item('1') do | |
item('1.1') | |
item('1.2') | |
item('1.3') | |
end | |
item('2') do | |
item('2.1') | |
item('2.2') do | |
item('2.2.1') | |
item('2.2.2') | |
end | |
end | |
item('3') do | |
item('3.1') | |
item('3.2') | |
item('3.3') | |
end | |
end | |
end | |
end | |
describe Menu do | |
it '1' do | |
a = Menu.new | |
a.test_it | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment