Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


2nd arg to should[_not] should be constrained to a String #142

dchelimsky opened this Issue · 3 comments

3 participants


obj.should matcher, :something_other_than => "A String" should raise an error saying a String is required.


This will help to avoid subtle syntax errors in tests. For example:

it { should have_link(new_email), :href => users_path(new_user) }

currently succeeds silently regardless of the value of href. The problem here is that :href => users_path(new_user) is inadvertently passed to the should as a message param instead of being passed to the have_link matcher. Because message currently is not restricted to the String type, the test does not raise a syntax error, and the test passes no matter what href is in the link. Here is the correct syntax for that test:

it { should have_link(new_email, :href => users_path(new_user)) }


With #173 merged can this be closed?



@dchelimsky dchelimsky closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.