David Kahn wrote: [The following paragraph was me. Please quote properly.] > No, no, no, it really doesn't. Do you actually touch all three of those > roles for every single Cucumber scenario? (I'll bet you don't.) If you > don't, then you're just making extra records and confusing what you're > testing. The Before block is not the place to create records. > [And back to you...]
> Its a grey area, as user roles a a presupposition of the system, and > probably 90%+ of all tests would fail without them --- and they are far > from > my mind when writing scenarios. They should not be far from your mind! You should set them up in every test and scenario for which you need them, so that you know exactly which features depend on them. > I could put them instead in the step > which > creates any user, but that is less pretty as I might create several > users > throughout a single scenario. That's OK. Create the users with appropriate roles as you need them (Pickle can really help here). > They are the only seed data that would go > into > the production database. Fine, then seed the production database. Never seed the test database. > > Originally I added them in env.rb using the following which would add > them > once: > AfterConfiguration do |config| > Factory.create(:sysadmin_role) > Factory.create(:practice_admin_role) > Factory.create(:practice_user_role) > end I know. That's bad practice, as I've been explaining. > > But with the @javascript tests they were not loading (or were getting > deleted). So take the time now to drop the bad practice and do it right! Best, -- Marnen Laibow-Koser http://www.marnen.org [email protected] -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

