Mark Needham

Thoughts on Software Development

rspec – Invalid character '\240′ in expression

with 2 comments

We have been using rspec on my project for the unit testing of our Ruby code and while running one of the specs last week I ended up getting this somewhat en-cryptic error message:

Invalid character '\240' in expression
...

After convincing myself that this error wasn't actually possible it turned out that I had somehow entered an 'invisible to TextMate' character after one of the method definitions – on the editor it just looked like a space.

I'm not sure exactly what the character was but deleting it got rid of the error and got my test/spec running again.

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • HackerNews
  • StumbleUpon
  • Twitter

Written by Mark Needham

October 6th, 2008 at 8:48 pm

Posted in Ruby

Tagged with ,

2 Responses to 'rspec – Invalid character '\240′ in expression'

Subscribe to comments with RSS or TrackBack to 'rspec – Invalid character '\240′ in expression'.

  1. Thank you!

    I have been sitting this this error for an hour now, wondering that the hell was wrong. Having recently played with different ruby version I obviously thought they caused it.

    David Billskog

    18 Nov 09 at 7:24 am

  2. Thanks Man !
    It would have probably taken me 5 hours to figure out the error, if it weren't for this post. Yeah it was a weird invisible character. I commented out the places where the suspected character might have been.
    And then it worked

    Shafayet Ahmad

    5 Aug 10 at 11:11 pm

Leave a Reply