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.

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. 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. They are the only seed data that would go into
the production 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

But with the @javascript tests they were not loading (or were getting
deleted).




On Fri, Oct 8, 2010 at 2:24 PM, Marnen Laibow-Koser <[email protected]>wrote:

> David Kahn wrote:
> > Thanks Marnen and Radhames for the help... got things working. Radhames,
> > took your lead and tried the selenium driver instead of culerity.
> >
> > I think there is some issue with culerity on Rails 3/1.9.2 (a broken
> > pipe
> > error occurs regularly) but w selenium things went smooth. You probably
> > already know this but for completeness of this post, I actually found
> > while
> > looking at Scenario Backgrounds the cucumber hooks for running something
> > before each scenario in the whole suite (below)... in this case the user
> > roles always have to be there so it makes more sense to put this there
> > than
> > inside each feature.
>
> 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.
>
>
> >
> > env.rb
> >
> > Before do
> >   Factory.create(:sysadmin_role)
> >   Factory.create(:practice_admin_role)
> >   Factory.create(:practice_user_role)
> > end
>
> 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]<rubyonrails-talk%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>

-- 
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.

Reply via email to