[rspec-users] cucumber and fixtures
Mark Thomson
mark.thomson at ieee.org
Fri Oct 10 03:23:27 EDT 2008
Hilarious. This is exactly what I needed today as well and eventually
found this thread through Google, not realizing it was already sitting
in my inbox. :-).
In my case I wanted to use fixtures in testing because the development
db had already been populated by a data migration, and I didn't want to
write more code to both define and load the data as would be required
using seed-fu. It seemed easier to install the ar_fixtures plugin and
use that to dump the data to a yaml file and then load the data in as
part of my story execution. Hence my need for the solution Daniel mentioned.
Despite my inexperience, I was a little surprised that I had difficulty
figuring out how to do this. I'm still not sure why "fixtures :model"
like you would use in Test::Unit does not work. And I can report that
"self.class.fixtures :all" recommended here:
http://www.mail-archive.com/rspec-users@rubyforge.org/msg03194.html, did
not work for me. I presume that at some point some more extensive
documentation for Cucumber will appear and I think this is an example of
an issue that would be helpful to have described in more detail.
Mark.
Daniel Higginbotham wrote:
> Pat Maddox wrote:
>
>> Daniel Higginbotham <lists at ruby-forum.com> writes:
>>
>>
>>>> ActiveRecord::Schema.verbose = false
>>>> { :name => "blah", :id => 1 },
>>>>
>>> end
>>> end
>>>
>>> Are you similarly able to load your YAML fixtures from spec/fixtures
>>> when you're running a Cucumber feature?
>>>
>>> Thanks,
>>> Daniel Higginbotham
>>>
>> I don't know that it's built into Cucumber, but loading fixtures is
>> pretty simple from what I remember. Something like
>> AR::Fixtures.load('path/to/file.yml') or something. Look around and I'm
>> sure you can find the couple lines to make it work.
>>
>> Pat
>>
>
> Thanks Pat!
>
> It looks like
>
> Fixtures.create_fixtures("spec/fixtures", "users")
>
> works.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20081010/9e141ae1/attachment.html>
More information about the rspec-users
mailing list