Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #6332 (closed defect: fixed)

Opened 3 years ago

Last modified 3 years ago

[PATCH] assert_select selects the wrong tag by its contents

Reported by: jgarber Assigned to: David
Priority: high Milestone: 1.2
Component: ActionPack Version: edge
Severity: critical Keywords: assert_select testing
Cc:

Description

Suppose you have the following two tags in your template:

<b>Name</b>...<b>Body</b>

If I do:

assert_select('b', 'Name')

I get:

Test::Unit::AssertionFailedError: <"Name"> expected but was <"Body">.

and if I do:

assert_select('b', 'Body')

I get:

Test::Unit::AssertionFailedError: <"Body"> expected but was <"Name">.

Attachments

assert_select_test_to_demonstrate_6332.diff (0.7 kB) - added by jgarber on 10/02/06 21:22:37.
assert_select_text_patch.diff (8.9 kB) - added by jgarber on 10/02/06 21:50:37.

Change History

10/02/06 21:22:37 changed by jgarber

  • attachment assert_select_test_to_demonstrate_6332.diff added.

(in reply to: ↑ description ) 10/02/06 21:29:55 changed by Assaf

Ticket #5936 includes a second patch to text handling behavior. Can you test it out?

10/02/06 21:48:07 changed by jgarber

Assaf pointed out his last patch on #5936, which solved my problem. Please apply that patch!

10/02/06 21:50:16 changed by jgarber

  • summary changed from assert_select selects the wrong tag by its contents to [PATCH] assert_select selects the wrong tag by its contents.

Not sure whether this should be labeled patch or the other should be reopened. Either way, the patch helped me. When I applied it, 2 of 5 hunks failed, so here's the patch applied to a very fresh copy of trunk.

10/02/06 21:50:37 changed by jgarber

  • attachment assert_select_text_patch.diff added.

10/05/06 07:40:19 changed by jgarber

  • priority changed from normal to high.
  • severity changed from normal to critical.
  • milestone changed from 1.x to 1.2.

This really ought to get into 1.2. We don't want to release something and then have to change a method's behavior. The patch comes from Assaf, the original contributor of assert_select. Let the man fix his code! :-)

10/09/06 00:20:32 changed by david

  • status changed from new to closed.
  • resolution set to fixed.

(In [5240]) Fixed that assert_select selects the wrong tag by its contents (closes #6332) [jgarber]