Module Merb::Test::Rspec::ViewMatchers
In: lib/merb-core/test/matchers/view_matchers.rb

Methods

Classes and Modules

Class Merb::Test::Rspec::ViewMatchers::HasContent
Class Merb::Test::Rspec::ViewMatchers::HasTag
Class Merb::Test::Rspec::ViewMatchers::HaveSelector
Class Merb::Test::Rspec::ViewMatchers::MatchTag
Class Merb::Test::Rspec::ViewMatchers::NotMatchTag

Public Instance methods

Parameters

expected<String>:The string to look for.

Returns

HaveSelector:A new have selector matcher.

RSpec matcher to test for the presence of tags.

Parameters

tag<~to_s>:The name of the tag.
attributes<Hash>:Tag attributes.

Returns

HasTag:A new has tag matcher.

Examples

  # Check for <div>
  body.should have_tag("div")

  # Check for <span id="notice">
  body.should have_tag("span", :id => :notice)

  # Check for <h1 id="foo" class="bar">
  body.should have_tag(:h2, :class => "bar", :id => "foo")

  # Check for <div attr="val">
  body.should have_tag(:div, :attr => :val)
match_selector(expected)

Alias for have_selector

Parameters

name<~to_s>:The name of the tag to look for.
attrs<Hash>:Attributes to look for in the tag (see below).

Options (attrs)

:content<String>:Optional content to match.

Returns

MatchTag:A new match tag matcher.

Parameters

attrs<Hash>:A set of attributes that must not be matched.

Returns

NotMatchTag:A new not match tag matcher.
with_tag(tag, attributes = {}, &blk)

Alias for have_tag

[Validate]