semantic_rails_view_helpers/README.md

598 B

Make your Rails Capybara testing even faster and more accurate! Looking for text strings is for the birds.

Your Views

Write out attributes using attributes_for:

#object
  = attributes_for object do |f|
    %h2= f.field(:name)
    %h3= f.field(:description)

Then look for those fields using Capybara! Because you shouldn't care about the DOM, just that your field is in there:

@object = Object.create!(:name => @name, :description => @description)

visit object_path(@object)

find_attribute(:name, @object.name)
find_attribute(:description, @object.description)