[Rspec-devel] Expecting Rails behaviour

Luke Redpath luke at agileevolved.com
Sat Aug 26 07:34:39 EDT 2006


Lachie

Take a look at my blog post here:

http://www.lukeredpath.co.uk/2006/7/7/testing-your-rails-views-with- 
hpricot

I'd love to see something like this rolled into RSpec.

Cheers
Luke

> I've successfully integrated and used Test::Rails::ViewTestCase with
> rspec-on-rails (I can post the code if you're interested). However, I
> wasn't specifying HTML views, so I'm not sure what the best way to
> handle these assertions is. Has anyone looked into using Hpricot?
>
> TU assert_image              src
> TU assert_error_on           field, type
> TU assert_field              form_action, type, model, column,  
> value = nil
> TU assert_input              form_action, type, name, value = nil
> TU assert_label              form_action, name, include_f = true
> TU assert_links_to           href, content = nil
> TU * deny_links_to
> TU assert_multipart_form     form_action
> TU assert_post_form          form_action
> TU assert_select             form_action, model, column, options
> TU assert_submit             form_action, value
> TU assert_tag_in_form        form_action, options
> TU * deny
>
> [General]
> Again, no-brainers for rspec!
>
> TU assert_empty              obj
> RS obj.should_be_empty
> TU * deny_empty
> RS obj.should_not_be_empty
>
> TU assert_includes           obj, item, message = nil
> RS obj.should_include item
> TU * deny_includes
> RS obj.should_not_include item
>
>
> -- 
> Lachie
> http://lachie.info/
> http://www.flickr.com/photos/lachie/
> _______________________________________________
> Rspec-devel mailing list
> Rspec-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-devel



More information about the Rspec-devel mailing list