Is it possible to mix a normal parameter argument for a step, with tabular data? Something like this: Given there is a country "Spain" with the cities: |name | |Madrid | |Barcelona | |Valencia | And this step_definition Given /^there is a country "Spain" with the cities:$/ do |country_name, cities_table| ... end Thanks Juanma -- Posted via http://www.ruby-forum.com/.
Yes, that should work. But you''d have to do Given /^there is a country "(.*)" with the cities:$/ do |country_name, cities_table| ... end Erik On Thu, Jan 29, 2009 at 12:47 AM, Juanma Cervera <lists at ruby-forum.com> wrote:> Is it possible to mix a normal parameter argument for a step, with > tabular data? > > Something like this: > > Given there is a country "Spain" with the cities: > |name | > |Madrid | > |Barcelona | > |Valencia | > > And this step_definition > > Given /^there is a country "Spain" with the cities:$/ do |country_name, > cities_table| > ... > end > > Thanks > Juanma > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
On Thu, Jan 29, 2009 at 10:37 AM, Erik Pukinskis <erikpukinskis at gmail.com> wrote:> Yes, that should work. But you''d have to do > > Given /^there is a country "(.*)" with the cities:$/ do |country_name, > cities_table| > ... > end >Correct. And it''s documented in the Wiki: http://wiki.github.com/aslakhellesoy/cucumber/calling-steps-from-step-definitions Aslak> Erik > > On Thu, Jan 29, 2009 at 12:47 AM, Juanma Cervera <lists at ruby-forum.com> wrote: >> Is it possible to mix a normal parameter argument for a step, with >> tabular data? >> >> Something like this: >> >> Given there is a country "Spain" with the cities: >> |name | >> |Madrid | >> |Barcelona | >> |Valencia | >> >> And this step_definition >> >> Given /^there is a country "Spain" with the cities:$/ do |country_name, >> cities_table| >> ... >> end >> >> Thanks >> Juanma >> -- >> Posted via http://www.ruby-forum.com/. >> _______________________________________________ >> rspec-users mailing list >> rspec-users at rubyforge.org >> http://rubyforge.org/mailman/listinfo/rspec-users >> > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >-- Aslak (::)
On Thu, Jan 29, 2009 at 12:29 PM, aslak hellesoy <aslak.hellesoy at gmail.com> wrote:> On Thu, Jan 29, 2009 at 10:37 AM, Erik Pukinskis > <erikpukinskis at gmail.com> wrote: >> Yes, that should work. But you''d have to do >> >> Given /^there is a country "(.*)" with the cities:$/ do |country_name, >> cities_table| >> ... >> end >> > > Correct. And it''s documented in the Wiki: > http://wiki.github.com/aslakhellesoy/cucumber/calling-steps-from-step-definitions >Actually - this is more relevant in your case: http://wiki.github.com/aslakhellesoy/cucumber/using-tabular-data-in-features Aslak> Aslak > >> Erik >> >> On Thu, Jan 29, 2009 at 12:47 AM, Juanma Cervera <lists at ruby-forum.com> wrote: >>> Is it possible to mix a normal parameter argument for a step, with >>> tabular data? >>> >>> Something like this: >>> >>> Given there is a country "Spain" with the cities: >>> |name | >>> |Madrid | >>> |Barcelona | >>> |Valencia | >>> >>> And this step_definition >>> >>> Given /^there is a country "Spain" with the cities:$/ do |country_name, >>> cities_table| >>> ... >>> end >>> >>> Thanks >>> Juanma >>> -- >>> Posted via http://www.ruby-forum.com/. >>> _______________________________________________ >>> rspec-users mailing list >>> rspec-users at rubyforge.org >>> http://rubyforge.org/mailman/listinfo/rspec-users >>> >> _______________________________________________ >> rspec-users mailing list >> rspec-users at rubyforge.org >> http://rubyforge.org/mailman/listinfo/rspec-users >> > > > > -- > Aslak (::) >-- Aslak (::)