public
Description: make assert_select nicer
Homepage:
Clone URL: git://github.com/technicalpickles/nice_assert_select.git
Click here to lend your support to: nice_assert_select and make a donation at www.pledgie.com !
name age message
file .gitignore Wed Feb 18 14:01:54 -0800 2009 Preparing release. [technicalpickles]
file LICENSE Wed Feb 18 13:45:05 -0800 2009 Updated LICENSE year, fixed formatting of README. [technicalpickles]
file README.rdoc Wed Feb 18 14:03:18 -0800 2009 Fixed README. [technicalpickles]
file Rakefile Thu Feb 19 00:47:13 -0800 2009 Adjusted test patterns to work. [technicalpickles]
file VERSION.yml Thu Feb 19 00:52:24 -0800 2009 Version bump to 0.1.1 [technicalpickles]
directory lib/ Thu Feb 19 00:52:18 -0800 2009 Fixed including NiceAssertSelect into ActionCon... [technicalpickles]
file nice_assert_select.gemspec Thu Feb 19 00:52:29 -0800 2009 Regenerated gemspec for version 0.1.1 [technicalpickles]
directory test/ Wed Feb 18 13:37:16 -0800 2009 Initial implementation. [technicalpickles]
README.rdoc

nice_assert_select

Tired of ugly assert_select calls?

  assert_select "form[action=?][method=post]", sources_path do
    assert_select "input[type=text][name=?]", 'source[name]'
    assert_select "input[type=hidden][name=_method][value=put]"
    assert_select "input[type=submit]"
  end

How about some nice assert_selects?

  assert_select form(:action => :post, :action => sources_path) do
    assert_select text_field(:name => 'source[name]')
    assert_select form_method_field(:put)
    assert_select submit_button
  end

nice_assert_select provides helpers for making the calls more rubyish and more readable. Currently, they are mostly limited to form related selectors that do attribute matching.

  form
  text_field
  hidden_field
  password_field
  form_method_field (this is the hidden field Rails uses for determing what HTTP method to use, since browsers are generally limited to GET and POST)
  submit_button

It is by no means comprehensive, as it was extracted from a project which only needed these assert_selects.

Installing

For Rails 2.1 and on, add this to your config/environment.rb:

  config.gem 'technicalpickles-nice_assert_select', :lib => 'nice_assert_select', :source => 'http://gems.github.com'

COPYRIGHT

Copyright © 2009 Josh Nichols. See LICENSE for details.