Helper Me Test plugin

Plugin details

Providing quick and easy ways to create and write tests for your Rails helpers.

Websitehttp://github.com/vigetlabs/helper_me_test/ Repositorygit://github.com/vigetlabs/helper_me_test.git Author Brian Landau Tags generator, Testing, helper LicenseMIT

Documentation

Install the plugin:
ruby script/plugin install git://github.com/vigetlabs/helper_me_test.git

Generators:

Helper Test Generator:

 > script/generate helper_tests [SampleHelper Admin::AnotherHelper ...]



Helper Generator:

 > script/generate helper HelperName [methods ...]



Test Rake task:

rake test:helpers




Assertions:

Tag Assertions:

def test_some_html_string_with_assert_tag_in
   html = "onetwohello world"
   assert_tag_in html, :ul, :attributes => {:id => 'list'}, :child => {:tag => 'li'}
   assert_tag_in html, :p
end



Selector Assertions:

def test_some_html_string_with_assert_select_in
   html = "onetwohello world"
   assert_select_in html 'ul#list' do
      assert_select_in 'li'
   end
   assert_select_in html,'p#content', 'hello world'
end



Hpricot Assertions:

def test_some_html_string_with_assert_hpricot_in
   html = "onetwohello world"
   assert_hpricot_in html, 'ul[@id="list"][li="one"]'
   assert_hpricot_in html, 'p[@id="content"]'
end



Further Documentation

There is currently no advanced documentation for this plugin.

New documentation

Edit plugin | (0 older versions) | Last edited by: brianjlandau, 3 months ago