This project is archived and is in readonly mode.
Add assert_select helper to ActionView::TestCase
Reported by Brian Landau | June 17th, 2008 @ 10:19 PM
This patch changes ActionView::TestCase to the more appropriate name of ActionView::Helpers::TestCase, it also refactors some code in that file that was unclear.
This path also adds 2 assertions "assert_tag_in" and "assert_tag_not_in" to aid in testing helpers. Finally it adds these to the "test_help.rb" file in railities allowing these to be used elsewhere.
Comments and changes to this ticket
-
Brian Landau June 18th, 2008 @ 02:28 PM
Yes I feel so. assert_select I feel is more powerful when dealing with a whole page's DOM but when it's a smaller set of tags I feel that assert_tag has a more descriptive and readable syntax.
But we could easily add an assert_select_in to the ActionView::Assertions.
-
Brian Landau June 20th, 2008 @ 09:01 PM
Some how I forgot to put my tests in that patch. Here they are.
-
Pratik July 9th, 2008 @ 01:29 PM
- Assigned user set to josh
- Tag set to actionpack, assertions, enhancement, helper, patch, tested, tests
-
Brian Landau July 11th, 2008 @ 10:48 PM
- no changes were found...
-
Brian Landau July 11th, 2008 @ 10:48 PM
Here is another patch that creates an "assert_select_in" test assertion method.
-
Brian Landau July 11th, 2008 @ 10:50 PM
This is a combination of all the previous patches.
Also all of these changes are available in the github branch I created
-
josh July 17th, 2008 @ 12:21 AM
- Title changed from Change ActionView::TestCase to ActionView::Helpers::TestCase and add assertions to Add assert_select helper to ActionView::TestCase
It looks like you totally reimplemented assert_select for assert_select_in. Is there anyway you can piggy back off the original. Not very DRY.
Also I'm not sure if I'm down with changing the namespace either.
-
Brian Landau July 18th, 2008 @ 04:10 PM
Joshua:
1. It sounds great to DRY it up but what should the namespace be for the common components? Also it's not an exact duplicate of assert_select obviously as we aren't selecting from the response and it requires a target HTML parameter.
So any thoughts on where to extract out common code would be appreciated.
2. The reason for the namespace change is that this TestCase is almost entirely for testing the output of helpers. This is supported by the fact that it automatically includes the methods for the helper named as same as the test name.
-
josh July 19th, 2008 @ 01:34 AM
1. Yeah, it looks tricky ;)
2. The helpers module is to hold the stuff that gets included into the view. The "TestCase" isn't really to be used in you view. You really are testing the view layer, so I think the name still fits.
-
josh July 19th, 2008 @ 09:08 PM
- State changed from new to open
- Tag changed from actionpack, assertions, enhancement, helper, patch, tested, tests to actionpack, assertions, patch
-
josh July 27th, 2008 @ 10:08 PM
- State changed from open to wontfix
- Tag changed from actionpack, assertions, patch to actionpack, assertions
Closing until further progress is made.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>