Cucumber/RSpec and seed data

1,080 views
Skip to first unread message

Will

unread,
Jan 3, 2011, 3:56:17 PM1/3/11
to Boston Ruby Group
What is the best way to load seed data (from db/seeds.rb) prior to
feature tests and specs running?

Our system needs to have some default configuration settings (users,
roles, permissions, etc.) seeded before it can be brought up.
Currently this is all stored in the seeds.rb file.

I would like to write features where a user has a particular role and
permissions utilizing the seeded data.

Is there a best practice for this?

Thanks

Harold Giménez

unread,
Jan 3, 2011, 4:09:27 PM1/3/11
to boston-r...@googlegroups.com
All you need to do is require the seed.rb file. For example, you can add this one line to features/support/seed_data.rb:

require Rails.root.join('db','seeds')


--
You received this message because you are subscribed to the Boston Ruby Group mailing list
To post to this group, send email to boston-r...@googlegroups.com
To unsubscribe from this group, send email to boston-rubygro...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/boston-rubygroup

Will

unread,
Jan 3, 2011, 4:11:50 PM1/3/11
to Boston Ruby Group
Brilliant. Thanks!

On Jan 3, 4:09 pm, Harold Giménez <harold.gime...@gmail.com> wrote:
> All you need to do is require the seed.rb file. For example, you can add
> this one line to features/support/seed_data.rb:
>
> require Rails.root.join('db','seeds')
>
Reply all
Reply to author
Forward
0 new messages