← Back to Upcase

RSpec dynamic value

(Charlieanna) #1

I have an Event model which has a name and a unique code. The unique code is generated on after_initialiser block. Now during the integration tests how can I get this code back so that I can continue testing with the event?

click_link "Create an event"
fill_in "Name",with:"Oracle"
click_button "Create Event"

I want to get back the code of the event created. Can I use factorygirl in some way to do that?

Thanks a lot!!!

(Jon Seidel) #2

What happens and what is the expected interaction / next steps that the user would take once the Event is created?

For example, once the Event is created, is there a button or link to view/modify the event? Or is a new page displayed or section updated via Ajax? Once you decide “what happens next?” without regard to the underlying code, I would think you would be able to take the next step in your feature spec.