Resetting a sequence

127 views
Skip to first unread message

Mohsen Qureshi

unread,
Jun 19, 2013, 12:54:00 PM6/19/13
to factor...@googlegroups.com
Hi everyone,

I have tried to google up on this, and tried a few things my self i.e. trying to access value of a sequence and try resetting it to 0. However I'm not getting anywhere with it. I am using it with Cucumber, and my use case is that I write to the DB and call a web service, which reads the DB and returns a XML response. I have a sample XML which I compare it to.


However my problem begins when running the scenarios together. When running the scenarios one at a time, the sequences all start with 1, which is what the ID's are in the expected XML. When running the whole suite, the sequences increment and thus fail as the expected XML has ID's of 1.

Has anyone successfully been able to reset a sequence?

Thanks
Mo

Keenan Brock

unread,
Jun 20, 2013, 12:35:31 PM6/20/13
to factor...@googlegroups.com
Hello Mohsen,

I don't know how to do what you suggest.

But recently, when comparing objects and hashes, I've been just comparing the values I want to compare. So in rspec, I've been using include() rather than eq()

1. you may be able to use nokogiri and read the record and only compare the fields that interest you.
2. you can take the new data, and gsub(/<id>\d*<\/id>/,"") to get rid of the id field all together.
3. think about using external ids instead of internal ids. So instead of using your id, use a tag field as the externally facing unique id.

Best of luck,
Keenan
--
--
Individuals over processes. Interactions over tools. Agile Rails training from thoughtbot, the makers of Clearance, Shoulda, & Factory Girl:
http://thoughtbot.com/services/training
 
You received this message because you are subscribed to the "factory_girl" mailing list.
To post to this group, send email to factor...@googlegroups.com
To unsubscribe from this group, send email to
factory_girl...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/factory_girl?hl=en
---
You received this message because you are subscribed to the Google Groups "factory_girl" group.
To unsubscribe from this group and stop receiving emails from it, send an email to factory_girl...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages