shoes4 icon indicating copy to clipboard operation
shoes4 copied to clipboard

Allow passing data to url from visist

Open felipesere opened this issue 11 years ago • 1 comments

Currently it is possible to define a url with a variable segment like so:

url '/{foo}', :foo

This will call the method foo with whatever is part of the url, eg

visit '/bar'

will call foo with argument bar.

This is very limiting, as we can only pass around string arguments. It would be nice to be able to pass around a hash, like so

visit '/bar', number: 42
def foo(bar, data) 
   a = data[:number]
end

felipesere avatar Jul 17 '14 10:07 felipesere

Hi there,

thank you for your suggestion. I like it! :)

I set it to the 4.1 mile stone as it is not part of the shoes3 DSL and shoes3 compatibility is the main goal for 4.0. However, feel free to send a PR we'll merge it either way. As it's easy to do, once I got more time I might also implement it :)

Cheers and thanks! Tobi

PragTob avatar Jul 17 '14 11:07 PragTob