Method: Shoulda::ActionView::Macros#should_render_page_with_metadata
- Defined in:
- lib/shoulda/action_view/macros.rb
#should_render_page_with_metadata(options) ⇒ Object
Macro that creates a test asserting that the rendered view contains the selected metatags. Values can be string or Regexps. Example:
:description => "Description of this page", :keywords => /post/
You can also use this method to test the rendered views title.
Example:
:title => /index/
42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/shoulda/action_view/macros.rb', line 42 def () .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 |