[rspec-users] First Post (Best Practices)

Ants Pants antsmailinglist at gmail.com
Thu May 13 07:41:05 EDT 2010

Hello everyone,

I'm just working my way through the RSpec/Cucumber book, I love the tool but
not so much the learning curve :(

Starting with my first view, is it okay for me, in the BDD world, to do the
following or can I put them all in one 'it' block to save on having to
render the page every time. Or must they be in separate blocks with separate
renders? Or is there a fourth more elegant solution?

  %w{ name address_1 address_2 address_3 postcode town_city state country
email phone www }.each do |field|
    it "renders form field #{field} to create a new competition" do
      @competition.stub!(field.intern).and_return ''
      render "competitions/new.html.erb"
      response.should have_selector("input[type=text]", :name =>
"competition[#{field}]", :value => '')

Is it okay to post this type of  question if nothing jumps out at me after


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20100513/50980af4/attachment.html>

More information about the rspec-users mailing list