[LRUG] Test does not load many to many fixture

Riccardo Tacconi rtacconi at gmail.com
Wed Feb 10 06:16:59 PST 2010


Graham,

I tried to add the fixtures in the test case without success. Rails guide,
as you noticed is wrong and very incomplete. I have found a blog post with
fixture tips:

http://techpolesen.blogspot.com/2007/04/rails-fixture-tips.html

I created a rake task to clean the test DB from data, but I have to disable
foreign keys checks. I configured the fixtures to laod in my environment.rb
in this way:

ENV['FIXTURES'] ||= 'categories, departments, users, teams, roles,
roles_users, videos'

but I am still not able to load roles_users

On Wed, Feb 10, 2010 at 12:44 PM, Graham Ashton <graham at effectif.com> wrote:

> On 10 Feb 2010, at 11:30, Riccardo Tacconi wrote:
>
> > Do I have to specify somewhere how to load this fixture?
>
> As I recall (it's been a very long time since I've used fixtures) you need
> to mention which fixtures to use in your test case. I just checked the Rails
> guide on the subject though [1] which claims that Rails will load all
> fixtures by default. This suggests that my memory is failing. Loading
> everything seems a bit daft; it could take ages.
>
> Have you tried adding something like this to the top of your test case?
>
>  fixtures :roles, :users, :roles_users
>
> Alternatively, try factory_girl or blueprint, which are much less pain to
> work with.
>
> [1] http://guides.rubyonrails.org/testing.html#the-low-down-on-fixtures
> _______________________________________________
> Chat mailing list
> Chat at lists.lrug.org
> http://lists.lrug.org/listinfo.cgi/chat-lrug.org
>



-- 
Riccardo Tacconi
Web developer at Wolseley UK
VIRTUELOGIC LIMITED (Director)

http://www.linkedin.com/in/riccardotacconi
http://riccardotacconi.blogspot.com/
http://twitter.com/rtacconi
Linux user: #400461
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lrug.org/pipermail/chat-lrug.org/attachments/20100210/1c6b1f39/attachment-0003.html>


More information about the Chat mailing list