In config/rails_helper.rb, add the following to the RSpec.configure do |config| block:

  config.include ActionView::RecordIdentifier

You can then use dom_id within your specs.