Skip to content

Instantly share code, notes, and snippets.

@evanfarrar
Created September 5, 2010 17:32
Show Gist options
  • Save evanfarrar/566187 to your computer and use it in GitHub Desktop.
Save evanfarrar/566187 to your computer and use it in GitHub Desktop.
class Main < Shoes
url '/', :index
url '/foo', :foo
url '/bar', :bar
def index
if !owner && !@child #If I am the parent and I have no child
@child = window(:title => 'child')
end
sync_child
para 'in index'
button 'go to foo' do
visit '/foo'
end
button 'go to bar' do
visit '/bar'
end
end
def foo
sync_child
para 'in foo'
button 'go to index' do
visit '/'
end
button 'go to bar' do
visit '/bar'
end
end
def bar
sync_child
para 'in bar'
button 'go to index' do
visit '/'
end
button 'go to foo' do
visit '/foo'
end
end
def sync_child
if !owner && @child
@child.sync_with_owner!
end
end
end
class Shoes::App
def sync_with_owner!
visit owner.location
end
end
Shoes.app(:title => 'parent')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment