I'm writing a controller test for a rails 3.1 app using testunit 2.4.0.
I want to assert that a certain heading does not appear on the page.
I'm using assert_select like this:
assert_select 'h1', {:text => /Key Dates/, :count => 0}
and getting the following error:
ArgumentError: assertion message must be String or Proc: <</Key Dates/>
expected but was <"Planner Maternity leave">.>(<Test::Unit::Assertions::AssertionMessage>)
I've tracked this down to the fact that assert_select
calls build_message
which creates an instance of AssertionMessage
and passes it through to test-unit's assert
. However in version 2.2 of testunit (Feb 2011) checks were added which check the type of the message passed in. These checks trigger the ArgumentError
seen above.
I'm not sure whether the mistake lies with test-unit being over-strict or assert_select passing the wrong object type.
Can you advise how best to follow this up? Any work-arounds?