Skip to content

Instantly share code, notes, and snippets.

@alesya-h
Created September 23, 2015 11:43
Show Gist options
  • Save alesya-h/7c01f7778c912b20f2f8 to your computer and use it in GitHub Desktop.
Save alesya-h/7c01f7778c912b20f2f8 to your computer and use it in GitHub Desktop.
a = routes1 do |x|
x.get 'bar'
x.post 'baz'
x.scope 'nested' do |y|
y.get 'quux'
y.scope 'more-nesting' do |z|
z.post 'boo'
end
end
x.scope 'another-scope' do |y|
y.get 'aaa'
end
end
b = routes2 do
get 'bar'
post 'baz'
scope 'nested' do
get 'quux'
scope 'more-nesting' do
post 'boo'
end
end
scope 'another-scope' do
get 'aaa'
end
end
expect(a).to eq(b)
expect(a).to eq({
get: ['bar'],
post: ['baz'],
scopes: {
'nested' => {
get: ['quux'],
scopes: {
'more-nesting' => {
post: ['boo']
}
}
},
'another-scope' => {
get: ['aaa']
}
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment