ruby on rails - cucumber step: how do i get the input data from a different step? -


i have scenario:

given on edit_stamp page , change date "14.5.2010"              #<-- need data ... should see new times has been set #<-- down here 

i'm updating date of model, , in last step want verify model indeed updated date selected in first step.

how can grab selected date top, in last step-definition?

then(/^i should see new times has been set$/)   s = stamp.first   find_by_id("day_date#{s.id}").has_text?("14.5.2010") end 

this have now, don't want write date(14.5.2010) step-definition, want fetch previous step.

try this:

and (/^i change date "(.*?)"$/) |input_date|   @new_date = input_date   # , here whatever doing date end  then(/^i should see new times has been set$/)   s = stamp.first   s.date_or_whatever_attribute_you_are_using.to_s.should == @new_date end 

those instance variables (@xx) persist alongside whole scenario.


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -