module Shoulda::ActionView::Macros

def should_render_a_form

Macro that creates a test asserting that the rendered view contains a
element.
def should_render_a_form
  should "display a form" do
    assert_select "form", true, "The template doesn't contain a <form> element"
  end
end

def should_render_page_with_metadata(options)

should_render_page_with_metadata :title => /index/
Example:

You can also use this method to test the rendered views title.

should_render_page_with_metadata :description => "Description of this page", :keywords => /post/

Example:
Values can be string or Regexps.
Macro that creates a test asserting that the rendered view contains the selected metatags.
def should_render_page_with_metadata(options)
  options.each do |key, value|
    should "have metatag #{key}" do
      if key.to_sym == :title
        assert_select "title", value
      else
        assert_select "meta[name=?][content#{"*" if value.is_a?(Regexp)}=?]", key, value
      end
    end
  end
end