TextMate's RSpec and Rails Bundle Conflict
(Blogged for reference.)
I’ve been bothered for a while now by a minor annoyance in TextMate’s handling of Ruby on Rails and RSpec files. There’s a quirk in TextMate’s logic for discovering a file’s type that may cause RSpec’s *_spec.rb
files to be treated as normal Ruby (or Ruby on Rails) *.rb
files (and vice versa), meaning your syntax highlighting and keyboard shortcuts will be wrong. Nothing serious, but still a hassle to have to manually set the language every time you open or even switch to a file.
It turns out Allan documented this a while ago, and it has a pretty quick fix.
I was able to follow his instructions for removing the manual bindings, but for some reason all my Rails project files were then being treated as plain Ruby. I ended up adding this little hack to the RSpec grammar:
firstLineMatch = 'spec_helper';
And now all is right.