On Jan 24, 2012, at 11:27 PM, Julian L. wrote:
Same problem with rspec 2.6 and 2.8.
Dont make me switch to Test::Unit. Anyone?
It’d be nice to have a bit of context for this issue.
It’s most likely an issue with your model’s validation
Not sure what else to tell you. Ive a complex bit of logic I want to
exercise thats accepting a hierarchy of objects submitted to the
application as JSON. The controller pulls it apart into a hierarchical
key-value hash. Ive a recursive operation that walks this structure,
pulling out individual objects and saving them.
Everything works fine when I test it manually (e.g. in console). When I
run the same sequence of operations with the same values in console
(i.e. I tested it by copying the values and operations out of the spec
into the console), it all works fine.
But it all fails horribly in rspec because the ids are getting
overwritten with 0s. I can get to the point in my code where I hand
things over to ActiveRecord, and the hash Im giving to create is exactly
what Im after including the id value.
FWIW, the ids Im trying to use are UUIDs.
Since Im entirely sure the hash Im handing to create is correct, Im left
with trying to grub around inside ActiveRecord, which I dont look
forward to. So: in what way does RSpec modify the behavior of
ActiveRecord that might bear on this?