Skip to content

Instantly share code, notes, and snippets.

@nigelr
Created February 21, 2015 07:56
Show Gist options
  • Save nigelr/799bb331e4eefd643f42 to your computer and use it in GitHub Desktop.
Save nigelr/799bb331e4eefd643f42 to your computer and use it in GitHub Desktop.
create menu
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