Skip to content

szymon-przybyl/rspec2-rails-views-matchers

 
 

Repository files navigation

Test views, be true! :)

Build Status

Mikhalok

Why?

  • you need to test some complex views
  • and you want to use rspec2
  • and assert_select seems is something strange to you
  • have_tag in rspec-rails are deprecated now
  • you need user-firendly output in error messages

Being true

Install

add to your Gemfile(in group :test :) ):

gem 'rspec2-rails-views-matchers'

Usage

some examples:

rendered.should have_tag('form',:with => {:action => user_path, :method => 'post'}) do
  with_tag "input", :with => { :name => "user[email]",    :type => 'email' }
  with_tag "input#special_submit", :count => 1
  without_tag "h1", :text => 'unneeded tag'
  without_tag "p",  :text => /content/i
end

additional list of defined matchers ("form" matchers)

and of course you can use without_matchers

More info

You can find on RubyDoc, take a look at {RSpec::Matchers#have_tag have_tag} method.

Also, please read {file:docs/CHANGELOG.md CHANGELOG}, it might be helpful.

Contribution

  1. fork
  2. add tests for feature
  3. write implementation
  4. send pull request

Contributors

About

Nokogiri based have_tag, with_tag matchers for rspec 2

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 100.0%